Jump to content

StealthIsKey

Members
  • Content count

    1
  • Joined

  • Last visited

Community Reputation

0 Neutral

About StealthIsKey

  • Rank
    Recruit

Profile Information

  • Gender
    Male

Command & Conquer Profile

  • Favourite C&C
    Tiberian Sun
  1. I was trying to keep track of some status in gameplay and react as soon as certain condition's met, and I've written some code similar to that below. -- function to run on a unit of this type created function KeepTrackAndReactOnCreated(self) if unitCnt == nil then unitCnt = {} -- global variable end local plyr = ObjectTeamName(self) if unitCnt[plyr] == nil then unitCnt[plyr] = 1 else unitCnt[plyr] = unitCnt[plyr] + 1 end if unitCnt[plyr] >= 5 then ObjectGrantUpgrade(self, "Upgrade_SomeUpgrade") end end -- function to run on a unit of this type destroyed function KeepTrackAndReactOnDestroyed(self) local plyr = ObjectTeamName(self) unitCnt[plyr] = unitCnt[plyr] - 1 if unitCnt[plyr] < 5 then ObjectRemoveUpgrade(self, "Upgrade_SomeUpgrade") end end It's working just fine, until I saved the game and then loaded it...It seems that every time I load the SavedGame file, unitCnt doesn't exist, as if the global variable and its value were not saved to the SavedGame file. Does anyone has any idea of how I can solve this problem? Is there any way to save a global variable and its value to a SavedGame file and have them loaded later? Or is it just impossible to do so?
×