DarkWandererAmon Posted June 4 Share Posted June 4 Hey all I am trying to come up with a script, that will be attached to a magic effect, so that when the spell is cast, that will enable a disabled activator and after a timer will disable the activator. I am studying this page https://ck.uesp.net/wiki/ObjectReference_Script and came up with this: Function fireTriggerEvent () self.disable() ;enable objects hooked up to this trigger endFunction But it isnt really working lol. I am assuming I need to Could anyone help please? Kind regards! Link to comment Share on other sites More sharing options...
IsharaMeradin Posted June 4 Share Posted June 4 You will need an ObjectReference property that points to your activator that needs to be disabled. If you set your magic effect to have the same duration as the length of time that you want to wait, you can get away with using the OnEffectStart and OnEffectFinish events to call the enabling and disabling of the activator. The following would be the simplest setup should the magic effect have a duration that lasts the correct amount of time needed. ObjectReference Property myActivator Auto Event OnEffectStart(Actor akTarget, Actor akCaster) myActivator.Enable() EndEvent Event OnEffectFinish(Actor akTarget, Actor akCaster) myActivator.Disable() EndEvent If, however, your magic effect does not or cannot have a duration you will need to register for a single update (game time or real time) to be triggered after the time has passed. But since magic effects do not linger past their duration, a secondary script (on a quest or object) would be needed to receive the registration and run the update event. I don't want to dig into script jumping without it being necessary, you'll need to decide whether or not the magic effect can have a duration that will work for your needs. Link to comment Share on other sites More sharing options...
DarkWandererAmon Posted June 4 Author Share Posted June 4 1 hour ago, IsharaMeradin said: ObjectReference Property myActivator Auto Event OnEffectStart(Actor akTarget, Actor akCaster) myActivator.Enable() EndEvent Event OnEffectFinish(Actor akTarget, Actor akCaster) myActivator.Disable() EndEvent Oh wow thank you will test this and report back! Link to comment Share on other sites More sharing options...
DarkWandererAmon Posted June 4 Author Share Posted June 4 Thank you so so much it worked! Can I change the myActivator to XMarker in the script, then attach link multiple stuff to that x marker so that it enables and disables multiple stuff? Link to comment Share on other sites More sharing options...
IsharaMeradin Posted June 4 Share Posted June 4 Yes. You can assign any ObjectReference to the property and it will enable / disable that object as needed. This would include an xMarker that is an enable state parent of multiple other objects. If you have not, you may also rename the myActivator variable name to something else that is meaningful to your mod. Or you can give it the same name as the object you are working with so that you can use the auto-fill feature. Link to comment Share on other sites More sharing options...
DarkWandererAmon Posted June 4 Author Share Posted June 4 1 hour ago, IsharaMeradin said: Yes. You can assign any ObjectReference to the property and it will enable / disable that object as needed. This would include an xMarker that is an enable state parent of multiple other objects. If you have not, you may also rename the myActivator variable name to something else that is meaningful to your mod. Or you can give it the same name as the object you are working with so that you can use the auto-fill feature. Thank you it worked flawlessly! Will credit you on my mod page! Link to comment Share on other sites More sharing options...
Recommended Posts