[Python] Where to store custom data?

Discussion in 'Civ4 - Creation & Customization' started by Padmewan, May 5, 2006.

  1. Padmewan

    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 :(
     
  2. The Great Apple

    The Great Apple Big Cheese

    Joined:
    Mar 24, 2002
    Messages:
    3,361
    Location:
    Oxford, England
  3. Padmewan

    Padmewan King

    Joined:
    Nov 26, 2003
    Messages:
    748
    Location:
    Planet
    Nice. Looking forward to banging my head against this one...
    :confused: :wallbash: :crazyeye: :D
     
  4. Padmewan

    Padmewan King

    Joined:
    Nov 26, 2003
    Messages:
    748
    Location:
    Planet
    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?
     
  5. Shqype

    Shqype Shqyptar

    Joined:
    Nov 15, 2005
    Messages:
    2,468
    Location:
    New York + Shqypni
    I thought unit IDs weren't unique, but the same numbers could be used for different civilizations?
     
  6. The Great Apple

    The Great Apple Big Cheese

    Joined:
    Mar 24, 2002
    Messages:
    3,361
    Location:
    Oxford, England
    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.
     

Share This Page