How do you make a script only run once?

Post » Thu Oct 02, 2014 4:47 am

I'm making an OnEquipped script, but I only want the script to run the very first time you equip the item, and every other time you equip it after that the script won't run. Basically so it's like you can configure the item how you want it when you first get it. How would I do that?

Thanks in advance. :)

User avatar
Monika Krzyzak
 
Posts: 3471
Joined: Fri Oct 13, 2006 11:29 pm

Post » Thu Oct 02, 2014 6:55 am

For that particular event, use a state.

AUTO STATE WaitingEvent OnEquipped(parems here)GoToState("Done");code here EndEventENDSTATE STATE DoneEvent OnEquipped(parems here);nothingEndEventENDSTATE

The compiler will throw the empty event. Script will never run again unless you take out the states and empty event.

User avatar
Janeth Valenzuela Castelo
 
Posts: 3411
Joined: Wed Jun 21, 2006 3:03 am

Post » Wed Oct 01, 2014 8:26 pm

Okay thanks! :)

User avatar
Naughty not Nice
 
Posts: 3527
Joined: Sat Nov 04, 2006 6:14 am


Return to V - Skyrim