Forcing OnObjectEquipped event to start after load

Post » Tue Jun 19, 2012 2:01 pm

I have a script with an OnObjectEquipped event inside of a script that extends Actor. That event applies values to variables based on the weapon that is equipped. However, unless I'm mistaken, it does not "fire" until a weapon is equipped after a saved game is loaded. Basically, that means that any already equipped weapon never gets registered to apply values to the variables.

For example, if I want want Variable-A to be set to 1 when a certain sword is equipped, and I load a saved game with the sword already equipped, Variable-A will not be set to 1.

Is there a way around that? Thank you! :-)
User avatar
Laura Cartwright
 
Posts: 3483
Joined: Mon Sep 25, 2006 6:12 pm

Post » Wed Jun 20, 2012 2:41 am

Does the script not save the value that it had when the game was saved and exited?
User avatar
Ria dell
 
Posts: 3430
Joined: Sun Jun 25, 2006 4:03 pm

Post » Tue Jun 19, 2012 11:13 pm

That is a piece of knowledge far beyond mine :-P
Do values for variables save in saved games?
Is that something I have to force?
User avatar
Cheryl Rice
 
Posts: 3412
Joined: Sat Aug 11, 2007 7:44 am

Post » Wed Jun 20, 2012 12:24 am

I'm not really sure, but I think the entire script might get saved and return to where it was when the game is loaded
User avatar
Brentleah Jeffs
 
Posts: 3341
Joined: Tue Feb 13, 2007 12:21 am

Post » Tue Jun 19, 2012 4:20 pm

Yeah the variables http://www.gamesas.com/topic/1354218-an-open-letter-to-bethesda-regarding-ck/page__view__findpost__p__20413868 be safe.
Your properties and variables will always save their values for as long as the instance of the script exists and isn’t reset.

As for the problem...
Can't you just call the event from OnInit() ?

If that doesn't work put the 'work' into a function that both events call.
User avatar
sas
 
Posts: 3435
Joined: Thu Aug 03, 2006 8:40 am

Post » Wed Jun 20, 2012 12:58 am

Thank you both! :-)

If variables are saved, then that should solve my issue. Thank you again! :-D
User avatar
dell
 
Posts: 3452
Joined: Sat Mar 24, 2007 2:58 am


Return to V - Skyrim