notaconfirmeduser Posted July 28, 2022 Posted July 28, 2022 Hi I'd like the player to enter a trigger zone, which would cause an object or NPC to appear, but then the object would fade after several seconds.I'm working on a spooky mod, where objects or NPCs fade in or out like the Dunwich quarries situation. Any way to do this without too much fuss? A timer comes to mind, and a enable/disable self activate trigger, but I don't know how to use the two together. Thanks for any advice.
SKKmods Posted July 28, 2022 Posted July 28, 2022 Trigger with attached script OnTriggerEnter event which enables a no keyword LinkedRef starts a timer which disables the LinkedRef, outline would be;Event OnTriggerEnter(ObjectReference akActionRef) If (akActionRef == Game.GetPlayer()) ObjectReference MyLinkedRef = Self.GetLinkedRef(apKeyword = None) If (MyLinkedRef != None) && (MyLinkedRef.IsEnabled() == False) ; stops retriggering when active MyLinkedRef.Enable() Self.StartTimer(afInterval = 30.0, aiTimerID = 10) ; ObjectReference attached timers must have a timer value Endif EndIf EndEvent Event OnTimer(Int aiTimerID) ObjectReference MyLinkedRef = Self.GetLinkedRef(apKeyword = None) If (MyLinkedRef != None) MyLinkedRef.Disable() Endif EndEvent
notaconfirmeduser Posted July 30, 2022 Author Posted July 30, 2022 Wow, looks great! Big fan of your work. I'm stunned that one of the modders I respect would respond to me.Thanks so much. I'll give it a try. Timers were always a bit of a black box to me, but this seems straightforward. On 7/28/2022 at 8:03 PM, SKK50 said: Trigger with attached script OnTriggerEnter event which enables a no keyword LinkedRef starts a timer which disables the LinkedRef, outline would be;Event OnTriggerEnter(ObjectReference akActionRef) If (akActionRef == Game.GetPlayer() ObjectReference MyLinkedRef = Self.GetLinkedRef(apKeyword = None) If (MyLinkedRef != None) && (MyLinkedRef.IsEnabled() == False) ; stops retriggering when active MyLinkedRef.Enable() Self.StartTimer(afInterval = 30.0, aiTimerID = 10) ; ObjectReference attached timers must have a timer value Endif EndIf EndEvent Event OnTimer(Int aiTimerID) ObjectReference MyLinkedRef = Self.GetLinkedRef(apKeyword = None) If (MyLinkedRef != None) MyLinkedRef.Disable() Endif EndEvent
Recommended Posts