1. We have added a Gift Upgrades feature that allows you to gift an account upgrade to another member, just in time for the holiday season. You can see the gift option when going to the Account Upgrades screen, or on any user profile screen.
    Dismiss Notice

Is iUnit stable through game save/load?

Discussion in 'Civ5 - SDK / LUA' started by Pazyryk, Jul 3, 2014.

  1. Pazyryk

    Pazyryk Deity

    Joined:
    Jun 13, 2008
    Messages:
    3,584
    I know it is usually. But I keep seeing bugs in my mod that would be most easily explained by iUnit changing at some point. Possibly but not necessarily at game save/load.

    In tests it seem to persist and to be constant with embark/disembark. But I wonder if there is some special circumstance where it changes for some reason. (I'm not expecting it to persist through upgrade... I know that is really a new unit...)
     
  2. whoward69

    whoward69 DLL Minion

    Joined:
    May 30, 2011
    Messages:
    8,524
    Location:
    Near Portsmouth, UK
    CvUnit::m_iID - which is what is returned by GetID() - is part of the unit's data persisted into the save game file, so yes, it's stable across save/load
     
  3. Pazyryk

    Pazyryk Deity

    Joined:
    Jun 13, 2008
    Messages:
    3,584
    ...grrr. I was hoping someone would say "iUnit changes when ... x ... happens". Otherwise the fault must be in my Lua somewhere.
     

Share This Page