Jump to content

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


Recommended Posts

Are you testing on a new game each time? Or at the very least one that has not seen your mod in question yet?

 

If not, I suggest that you do so. There are some things that do not get updated mid-game especially if they have already been loaded and stored in the save file.

Link to comment
Share on other sites

Are you testing on a new game each time? Or at the very least one that has not seen your mod in question yet?

 

If not, I suggest that you do so. There are some things that do not get updated mid-game especially if they have already been loaded and stored in the save file.

 

Well I'm not trying to provoke anything but the save file I use doesn't have any mods installed nor does it have this mod save either. What I usually do is make changes in the CK and the script save those changes test in game. The reason I know the script is behaving odd is because I will add things such as Debug.Notification with a comment to make sure that the script is being updated. Hence why you see that on PG 2 of this thread that I added the Debug via the script for testing purposes only.

Link to comment
Share on other sites

FINALLY FIGURED IT OUT!!!!!!!!!!!!!!

 

I'm going to paste this here just in case anyone else want to use it. You have use a Global Variable with a value of 32767. I reverse engineered a conjure chest mod. SOLVED!

Scriptname summonspawnthronespell extends activemagiceffect  

Furniture Property FurnitureBase  Auto  

Float Property FrontDistance  Auto  

Float Property AngleOffset  Auto

Activator Property SummonFX  Auto  

Activator Property BanishFX  Auto

GlobalVariable Property SearchDistance  Auto

 
Event onEffectStart(actor akcaster, actor aktarget)

	objectreference oldFurnitureRef = (game.findclosestreferenceoftypefromref(furniturebase, game.getplayer(), (SearchDistance.getvalue() as int)))

	IF oldFurnitureRef != NONE

		Debug.Notification("There is nothing near!")

		oldFurnitureRef.placeatme(banishfx)

		utility.wait(0.5)		

		oldFurnitureRef.disable()
		oldFurnitureRef.delete()

	ENDIF

	ObjectReference FurnitureItem = Game.GetPlayer().placeatme(FurnitureBase, 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

 

 

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.

 

 

From what i can see you are not a very careful reader.
You keep using "Register..." while i had already explained that.
Once the MagicEffect finishes it will automatically Unregister anything that had been Register.
This means that you can not use any "Register..." functions with/on a MagicEffect Event if you need that function to fire after your spell has finished, only inside the time that the MagicEffect is active, which is actually from a few milliseconds to seconds.
* At least this whole thing had a happy end and you were able to find a solution.
Congrats !.
Stay frosty and safe at home !.
Edited by maxarturo
Link to comment
Share on other sites

  • Recently Browsing   0 members

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