IsharaMeradin Posted October 25, 2020 Share Posted October 25, 2020 in this case the group of events you need to fire first need to have assigned the "AUTO STATE". If I have the event OnEffectStart in a default state, and then check for the state I want to use, will having the same event in another state fail becasue the event has already happened? diziet Possibly, yes. In this case you can use the OnBeginState to perform stuff when having the script change states. So... whatever state is default (an auto state or the "empty state") will use the OnEffectStart event and then the states that it switches to can use OnBeginState to perform their state specific stuff that should happen when the effect starts. Link to comment Share on other sites More sharing options...
dizietemblesssma Posted October 25, 2020 Author Share Posted October 25, 2020 Possibly, yes. In this case you can use the OnBeginState to perform stuff when having the script change states. So... whatever state is default (an auto state or the "empty state") will use the OnEffectStart event and then the states that it switches to can use OnBeginState to perform their state specific stuff that should happen when the effect starts. Awesome, thankyou! A related question, does a trigger box have 3d, as in the 3d that the OnLoad event wiki page refers to. If so then will that OnLoad event fire when the trigger box is loaded in memory and I can keep the OnTriggerEnter event in the states? diziet Link to comment Share on other sites More sharing options...
IsharaMeradin Posted October 25, 2020 Share Posted October 25, 2020 Honestly, I do not know. You can always test it out and see what happens. Link to comment Share on other sites More sharing options...
dizietemblesssma Posted October 26, 2020 Author Share Posted October 26, 2020 Ok, for those who might land here after googling, or binging, or duckducking:) I attached the following to a triggerbox just inside Breezehome: ScriptName test_trigger Extends ObjectReference Event OnLoad() debug.messagebox("OnLoad event fired") EndEvent When I entered Breezehome I immediately got the messagebox, so I can use the OnLoad event for triggerboxes. Yey:) diziet Link to comment Share on other sites More sharing options...
maxarturo Posted October 26, 2020 Share Posted October 26, 2020 (edited) in this case the group of events you need to fire first need to have assigned the "AUTO STATE". If I have the event OnEffectStart in a default state, and then check for the state I want to use, will having the same event in another state fail becasue the event has already happened? diziet No, each group of 'events' inside a 'State' is independent from any other 'event' from any other 'Group of States' in your state sequence.So, the default event that was first called will again execute if it is used inside any of your 'Group of States' when that event is called to fire again. The 'OnBeginState' that IsharaMeradin proposed can work. BUT Using 'States' on a 'Magic Effect' will not work as intended.- If the script is used on a 'Fire and Forget' spell, you will never see the script's change of state, because each time you use the spell (fire the spell), you use a new instance of the magic effect and the script living on the magic effect fires each time from the beginning. - A similar related issue happens with "Ability Spells", i currently can't remember exactly, but it's has to do something with OnCellAttach/Detached, OnLoad/Unload, On save game > exit game > load save game, that will make the script living on the "Ab Spell" to execute from the beginning ignoring any changes made to its 'States' or any other functions stored in it. What i do remember is that: To bypass this issue when i faced it (quite some time ago), i had to make a simple script on the 'Ab Magic Effect' that it would send an "Activate Event" to an external object that was holding my actual 'Ab Magic Effect Script', so this way all changes made inside the script were saved and retain in each OnCellAttach/Detached, OnLoad/Unload... etc * Sorry that i can't be more detailed but i really can't remember the exact nature of the issue and i'm currently way too busy with work to search for it, you will need to do some testings yourself to find it. Edited October 26, 2020 by maxarturo Link to comment Share on other sites More sharing options...
dizietemblesssma Posted October 28, 2020 Author Share Posted October 28, 2020 The 'OnBeginState' that IsharaMeradin proposed can work. BUT Using 'States' on a 'Magic Effect' will not work as intended.- A similar related issue happens with "Ability Spells", i currently can't remember exactly, but it's has to do something with OnCellAttach/Detached, OnLoad/Unload, On save game > exit game > load save game, that will make the script living on the "Ab Spell" to execute from the beginning ignoring any changes made to its 'States' or any other functions stored in it.Ok, thanks for this, in my case I do have a constant spell, the old uequip NPCs in a bath, but with extras if MCM is used, if MCM is used the script stores some variables to fine tune the undressing. If the script were to start from the beginning upon loading a game then it would go to the right state for MCM installed or not; but would the variables stored before quitting the game be lost if the game was saved while the spell was running on an NPC? Or would the loaded game start the script from the beginning, go to the MCM state (say) and then access the variables stored by that state before the save game?There are basically three states, the beginning one which determines if MCM(SkyUI) is installed) and one state for yes it is installed and one for no it isn't. I don't mind in principle if the script keeps starting from the beginning if access to variables is not lost. diziet Link to comment Share on other sites More sharing options...
maxarturo Posted October 29, 2020 Share Posted October 29, 2020 As i said, i can't remember the exact nature of the issue. Plus, i can't provide a definite answer on you question, since i have no idea how your scripts + setup are created, the only person how can answer you... is you. Or anyone else how has all your assets to study / examining / test them. Link to comment Share on other sites More sharing options...
Recommended Posts