Create Global Variable: It's possible?

Post » Tue Jun 19, 2012 1:22 am

Is it possible to create a new global variable which will be stored with the game setting when saving the game?

I was thinking about it.

I know that Quests are the main way to keep data between saves, but Quests seems to me too "sequential"...

...I mean...the flow is "Quest initiated" to "Quest completed"...

...if you need something which must be referred many times (such as stating when X left a specific location), Quest doesn't seem to suit to me...or I am wrong?

Thanks,
Jashkar
User avatar
Sheila Esmailka
 
Posts: 3404
Joined: Wed Aug 22, 2007 2:31 am

Post » Mon Jun 18, 2012 8:25 pm

Yes it is. In the CK navigate to Miscellaneous->Global. In the list rightclick and select new. There you go: A new global variable for your mod to use in scripts.
User avatar
louise tagg
 
Posts: 3394
Joined: Sun Aug 06, 2006 8:32 am

Post » Tue Jun 19, 2012 6:26 am

Quest doesn't seem to suit to me...or I am wrong?
The latter ;]
As quests don't have to have any stages, they can run silently in the background through the whole game and store any data you want in their properties.
Global variables under Miscellaneous->Global branch can store only numbers, so in fact quest are the only place capable of storing other data than numbers (e.g. references to objects).
User avatar
Chris Cross Cabaret Man
 
Posts: 3301
Joined: Tue Jun 19, 2007 11:33 pm

Post » Tue Jun 19, 2012 11:58 am

The latter ;]
As quests don't have to have any stages, they can run silently in the background through the whole game and store any data you want in their properties.
Global variables under Miscellaneous->Global branch can store only numbers, so in fact quest are the only place capable of storing other data than numbers (e.g. references to objects).

Oh...thanks!!! :P

So quests are more something like "stickers with properties" than mere objectives...great!!

Thank you! :)
Jashkar
User avatar
Patrick Gordon
 
Posts: 3366
Joined: Thu May 31, 2007 5:38 am

Post » Tue Jun 19, 2012 6:51 am

Keep in mind, even LOCAL variables are nonpersistant unless you have some way of keeping the data alive. If you need a local variable to be maintained between function calls, you will need to include something like

RegisterForUpdate(5000)

in the Init block of the script. Just be sure to have a way of UN-Registering it when you no longer need the variables to be stored.
User avatar
chirsty aggas
 
Posts: 3396
Joined: Wed Oct 04, 2006 9:23 am


Return to V - Skyrim