global/targetted scripts

Post » Sat May 28, 2011 4:18 pm

to keep it short, how well does the engine keep track of locals in global or targetted scripts when the script starts/stops infrequently? are the locals saved to the savegame? is there loading/reloading consequences? what about savegame cleaning effects?

i'm trying to gauge if using the locals of a global script is reliable in the long run, or if i should use globals instead for integrity.

for example, the scripts i'm using tracks when the player casts spells while an item is equipped. a targetted script is started when the sound effect plays, and the targetted script keeps track of counters and cast tallies, as well as fires the 'effect'. i'm wondering if the counters and tallies should rather be globals incase the script isn't reliable when saved.

so does anyone have any good info on this at all?
User avatar
Jenna Fields
 
Posts: 3396
Joined: Mon Dec 11, 2006 11:36 am

Post » Sat May 28, 2011 12:17 pm

The state of variables in a global script will be saved in save games as long as the the script has run at least once since the game was loaded.
User avatar
Eibe Novy
 
Posts: 3510
Joined: Fri Apr 27, 2007 1:32 am

Post » Sat May 28, 2011 11:18 pm

interesting, that's good to know. so these scripts can break of someone loads, saves, and reload nearly immediately. maybe i need to replan this.
User avatar
:)Colleenn
 
Posts: 3461
Joined: Thu Aug 31, 2006 9:03 am

Post » Sat May 28, 2011 2:57 pm

I hope this isn't considered rude by net-iquette, but I resurrected this post from before cuz I read it and had a question about what I read.

abyssal terror wrote "interesting, that's good to know. so these scripts can break of someone loads, saves, and reload nearly immediately..."

So, lets say I have some global script variables I must keep track of. This suggests to me that if I don't want to lose the info, I have to run the scripts upon load to preserve the variable every time a game is loaded?

ST
User avatar
Nauty
 
Posts: 3410
Joined: Wed Jan 24, 2007 6:58 pm

Post » Sat May 28, 2011 10:15 pm

So, lets say I have some global script variables I must keep track of. This suggests to me that if I don't want to lose the info, I have to run the scripts upon load to preserve the variable every time a game is loaded?

As long as we're talking about local variables of a global script: yes. If that information is so valuable, I'd probably resort to using a global variable, though.
User avatar
Jinx Sykes
 
Posts: 3501
Joined: Sat Jan 20, 2007 11:12 pm


Return to III - Morrowind