Are iUnit and iCity stable through game save/load?

Pazyryk

Deity
Joined
Jun 13, 2008
Messages
3,584
Does anyone know for sure?

If not, it could be a source of some of my errors. But it could be something else too.

The actual integers are really weird (e.g., everyone gets the same large integer for iCity for their first city).
 
As far as I've seen they are stable across saves, based on my experiences with my Mythology mod. However, they aren't unique across players, as you noticed; you have to do something like
pCity = pPlayer:GetCityByID(iCity) to get the usable structure. So you can't ONLY save iCity or iUnit and expect them to uniquely identify something after a reload.
 
And if I remember correctly, upgrading an unit will change it's ID.
 
Right, but that's because "upgrading" actually means destroying the old unit and creating a new unit with the same name, promotions, experience, etc. Embarking and disembarking may or may not do the same; I haven't checked too closely.

Obviously, this doesn't apply to cities.
 
Back
Top Bottom