Jump to content

[LE] Need help to make a chair disappear after using it/sitting in it.


Recommended Posts

Try applying the second part of what I last said as it would still be viable no matter the method of getting the throne in place. Use a player alias script with the OnGetUp event. Start the quest when the spell is cast and stop the quest after doing all the stuff you want done when the player gets up.

 

*****************************

Wondering if MoveTo isn't moving the throne because the throne reference is in a property. Properties make objects persistent and that might be keeping it from moving. Instead of a property, could use GetFormFromFile and assign it to a local variable. But I can understand not wanting to mess with that if you can get the throne to disable and delete.

Link to comment
Share on other sites

In order for your Summon Spell to move the throne from your interior pre-placed throne cell to the player's exterior cell, your magic effect must first obtain that cell, then move it.



Now once you have spawn the throne, the throne's scripts must also obtain the "ParentCell" in which your xMarker target is, you need to modify the "State StandingUp" of the script to instead of > Disable, Delete > to "Obtain the Parent cell" and then "Self.MoveTo()" that cell.


I hope it helps.

Link to comment
Share on other sites

 

In order for your Summon Spell to move the throne from your interior pre-placed throne cell to the player's exterior cell, your magic effect must first obtain that cell, then move it.
Now once you have spawn the throne, the throne's scripts must also obtain the "ParentCell" in which your xMarker target is, you need to modify the "State StandingUp" of the script to instead of > Disable, Delete > to "Obtain the Parent cell" and then "Self.MoveTo()" that cell.
I hope it helps.

 

 

Still not working. I did as you said and nothing spawn. Now this isn't relevant but I was messing around with the script and was able to move to the cell where the throne is when I cast the spell but even with the script below it doesn't move to me.

Scriptname summonspawnthronespell extends activemagiceffect  



Float Property FrontDistance  Auto  

Float Property AngleOffset  Auto

Activator Property SummonFX  Auto  

Activator Property BanishFX  Auto

ObjectReference Property throne  Auto  


Event onEffectStart(Actor akCaster, Actor akTarget)

if (throne.GetParentCell() == Game.GetPlayer().GetParentCell())

	throne.moveto(Game.GetPlayer(), FrontDistance * Math.Sin(Game.GetPlayer().GetAngleZ()), FrontDistance * Math.Cos(Game.GetPlayer().GetAngleZ()))
	throne.SetAngle(0.0,0.0,(Game.GetPlayer().GetAngleZ() + AngleOffset))
	throne.placeatme(SummonFX)

endif

EndEvent
Link to comment
Share on other sites

I also tried this and this doesn't work either. All these scripts compile fine in CK but in game they don't spawn the Throne at my location, that's what I mean by don't work.

Scriptname summonspawnthronespell extends activemagiceffect  

Cell Property TheCell auto 

Float Property FrontDistance  Auto  

Float Property AngleOffset  Auto

Activator Property SummonFX  Auto  

Activator Property BanishFX  Auto

ObjectReference Property throne  Auto  


Event onEffectStart(Actor akCaster, Actor akTarget)

if (throne.getParentCell() == TheCell)

	throne.moveto(Game.GetPlayer(), FrontDistance * Math.Sin(Game.GetPlayer().GetAngleZ()), FrontDistance * Math.Cos(Game.GetPlayer().GetAngleZ()))
	throne.SetAngle(0.0,0.0,(Game.GetPlayer().GetAngleZ() + AngleOffset))
	throne.placeatme(SummonFX)

endif

EndEvent
Edited by wapeddell1
Link to comment
Share on other sites

I think a good fix for duplicates is to add a cool down that last about one minute to the working spell below. I just don't know how to use registerforupdategametime you have to forgive me as I've been absent from modding Skyrim and Fallout 4 for about 5 years. If you have a solution let me know.

 

 

 

Scriptname summonspawnthronespell extends activemagiceffect

 

Furniture Property throne Auto

 

Float Property FrontDistance Auto

 

Float Property AngleOffset Auto

 

Activator Property SummonFX Auto

 

Activator Property BanishFX Auto

 

 

Event onEffectStart(actor akcaster, actor aktarget)

 

ObjectReference FurnitureItem = Game.GetPlayer().placeatme(throne, 1)

 

FurnitureItem.moveto(Game.GetPlayer(), FrontDistance * Math.Sin(Game.GetPlayer().GetAngleZ()), FrontDistance * Math.Cos(Game.GetPlayer().GetAngleZ()))

FurnitureItem.SetAngle(0.0,0.0,(Game.GetPlayer().GetAngleZ() + AngleOffset))

FurnitureItem.placeatme(SummonFX)

 

EndEvent

Link to comment
Share on other sites

First of all do one thing at the time.

Leave out of your script the math + other fanctions and focus on your first objective, to move the object, after you have achive that then you keep building step by step your script.


1) Your "activemagiceffect" must get the "PLAYER"S" cell, and not the throne's.

2) Your "activemagiceffect" dosen't need/must not get both cells > (throne.GetParentCell() == Game.GetPlayer().GetParentCell())

3) Try spawning/placing first an xMarker at the player's position and then MoveTo the throne to that xMarker.




Even an experienced modder/scripter can easily encounter issues just by creating the whole script from start, example:

In my mod's final Boss Fight scene i knew exactly what i needed/wanted to do, so i create the whole script from the beggining.

Then i started to encounter different issues/glitches while testing, this force me to re-build the script step by step, and at the end it turned out that the culpable was a simple line "SetAlpha()".


Papyrus has a lot of flaws that you can only discover while testing and building step by step.


Edit: typo...

Edited by maxarturo
Link to comment
Share on other sites

I think a good fix for duplicates is to add a cool down that last about one minute to the working spell below. I just don't know how to use registerforupdategametime you have to forgive me as I've been absent from modding Skyrim and Fallout 4 for about 5 years. If you have a solution let me know.

 

 

 

Scriptname summonspawnthronespell extends activemagiceffect

 

Furniture Property throne Auto

 

Float Property FrontDistance Auto

 

Float Property AngleOffset Auto

 

Activator Property SummonFX Auto

 

Activator Property BanishFX Auto

 

 

Event onEffectStart(actor akcaster, actor aktarget)

 

ObjectReference FurnitureItem = Game.GetPlayer().placeatme(throne, 1)

 

FurnitureItem.moveto(Game.GetPlayer(), FrontDistance * Math.Sin(Game.GetPlayer().GetAngleZ()), FrontDistance * Math.Cos(Game.GetPlayer().GetAngleZ()))

FurnitureItem.SetAngle(0.0,0.0,(Game.GetPlayer().GetAngleZ() + AngleOffset))

FurnitureItem.placeatme(SummonFX)

 

EndEvent

 

One way to do this is with a hidden "bool" property.


Bool Property IsRunning = False Auto Hidden
 
Event onEffectStart(actor akcaster, actor aktarget)
If ( IsRunning == False )
        IsRunning = True
        ObjectReference FurnitureItem = Game.GetPlayer().placeatme(throne, 1)
 
        FurnitureItem.moveto(Game.GetPlayer(), FrontDistance * Math.Sin(Game.GetPlayer().GetAngleZ()), FrontDistance * Math.Cos(Game.GetPlayer().GetAngleZ()))
        FurnitureItem.SetAngle(0.0,0.0,(Game.GetPlayer().GetAngleZ() + AngleOffset))
        FurnitureItem.placeatme(SummonFX)
        RegisterForUpdateGameTime(24.0) ; in hours, set it up accordingly
EndIf
EndEvent
 
 
Event OnUpdateGameTime()
    IsRunning = False
    UnregisterForUpdateGameTime()
endEvent

Edited by maxarturo
Link to comment
Share on other sites

Oh... S***..., i completely forgot about that.

Once the MagicEffect finishes it will automatically Unregister anything that had been Register, you need to use instead:

Function WaitGameTime(float afHours) native global






Bool Property IsRunning = False Auto Hidden

Event onEffectStart(actor akcaster, actor aktarget)
If ( IsRunning == False )
IsRunning = True
ObjectReference FurnitureItem = Game.GetPlayer().placeatme(throne, 1)

FurnitureItem.moveto(Game.GetPlayer(), FrontDistance * Math.Sin(Game.GetPlayer().GetAngleZ()), FrontDistance * Math.Cos(Game.GetPlayer().GetAngleZ()))
FurnitureItem.SetAngle(0.0,0.0,(Game.GetPlayer().GetAngleZ() + AngleOffset))
FurnitureItem.placeatme(SummonFX)

Utility.WaitGameTime(1.0) ; in hours, set it up accordingly
IsRunning = False
EndIf


Link to comment
Share on other sites

 

Oh... S***..., i completely forgot about that.
Once the MagicEffect finishes it will automatically Unregister anything that had been Register, you need to use instead:
Function WaitGameTime(float afHours) native global

Bool Property IsRunning = False Auto Hidden
 
Event onEffectStart(actor akcaster, actor aktarget)
If ( IsRunning == False )
        IsRunning = True
        ObjectReference FurnitureItem = Game.GetPlayer().placeatme(throne, 1)
 
        FurnitureItem.moveto(Game.GetPlayer(), FrontDistance * Math.Sin(Game.GetPlayer().GetAngleZ()), FrontDistance * Math.Cos(Game.GetPlayer().GetAngleZ()))
        FurnitureItem.SetAngle(0.0,0.0,(Game.GetPlayer().GetAngleZ() + AngleOffset))
        FurnitureItem.placeatme(SummonFX)
 
        Utility.WaitGameTime(1.0) ; in hours, set it up accordingly
        IsRunning = False
EndIf

 

This thing is starting to really make me angry nothing I throw at it seems to stop it.

 

Things I've tried.

Event onEffectStart(actor akcaster, actor aktarget)
If ( IsRunning == False )
        IsRunning = True
        ObjectReference FurnitureItem = Game.GetPlayer().placeatme(throne, 1)


Actor PlayerRef = Game.GetPlayer() ; call once and store - speeds up rest of script


Float myXoffset = FrontDistance * Math.Sin(PlayerRef.GetAngleZ())
Float myYoffset = FrontDistance * Math.Cos(PlayerRef.GetAngleZ())
Float myZangle = (PlayerRef.GetAngleZ() + AngleOffset)


FurnitureItem.moveto(PlayerRef,myXoffset ,myYoffset)
FurnitureItem.SetAngle(0.0,0.0,myZangle)
FurnitureItem.placeatme(SummonFX)


RegisterForSingleUpdateGameTime(24.5)
        IsRunning = False
EndIf
endEvent


Event OnEffectFinish(Actor akTarget, Actor akCaster)
Debug.Notification("We just cast a fireball!")
RegisterForSingleUpdateGameTime(24.5)
endEvent

^ This didn't work. Your code didn't work.

Event onEffectStart(actor akcaster, actor aktarget)
If ( IsRunning == False )
        IsRunning = True
        ObjectReference FurnitureItem = Game.GetPlayer().placeatme(throne, 1)

	Actor PlayerRef = Game.GetPlayer() ; call once and store - speeds up rest of script

	Float myXoffset = FrontDistance * Math.Sin(PlayerRef.GetAngleZ())
	Float myYoffset = FrontDistance * Math.Cos(PlayerRef.GetAngleZ())
	Float myZangle = (PlayerRef.GetAngleZ() + AngleOffset)

	FurnitureItem.moveto(PlayerRef,myXoffset ,myYoffset)
	FurnitureItem.SetAngle(0.0,0.0,myZangle)
	FurnitureItem.placeatme(SummonFX)
 
	Utility.Wait(60)
        IsRunning = False
EndIf
endEvent

Event OnEffectFinish(Actor akTarget, Actor akCaster)
	Debug.Notification("We just cast a fireball!")
RegisterForSingleUpdateGameTime(24.5)
endEvent

This didn't work.

Event OnEffectFinish(Actor akTarget, Actor akCaster)
	

Game.GetPlayer().UnequipSpell(ThroneSpell,2)
Debug.Notification("We just cast!")

endEvent



^ This didn't work.

Edited by wapeddell1
Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...