[Python] Where to store custom data?

Padmewan

King
Joined
Nov 26, 2003
Messages
748
Location
Planet
What is the advised method of storing custom data at various scopes, for example, data about a particular game, a civ, a unit?

I thought there was some kind of custom data manager developed by someone, but can't find it in the ModComps forum :(
 
Nice. Looking forward to banging my head against this one...
:confused: :wallbash: :crazyeye: :D
 
btw did you ever post your solution re: dictionary of an entity's attributes? If I ever do my "Mobile Cities" mod that would come in handy.

Also, it looks like the storage method used requires namespaces at the global level, right? So instead of storing an extra piece of datum on, say, a unit, you have to store something at the global scope and keyed to that unit through, presumably, that unit's unique ID?
 
I thought unit IDs weren't unique, but the same numbers could be used for different civilizations?
 
The page I linked to specifically is an enchancment of the original which allows data to be tied to the script data of objects (civs/units/plots etc.). This method is alot faster than the default method, which just ties the data into the global script data. Using this, the getScriptData() function for the object will return all the data on the object.

The first version of the CEP will probably add functionality for script data to be carried over as default when upgrading units. It will also probably add an event for which is applied on unit upgrade, so you can remove the scriptdata from the unit afterwards if you want.

Unit ID's are unique per civilization (maybe per team... I don't know). The first version of the CEP will probably change this to be a global ID as well.
 
Back
Top Bottom