• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[Trigger] Trying for higher numbers with codeless save/load

Status
Not open for further replies.

I found out this system will fail fast if you go a little past the default wc3's max like only being able to load around level 90 when level was saved at 34,000. I learnt that there's quite a few variables to change instead of just one for the whole system and now the code fails to identify while always being incorrect. I'm pretty terrible when it comes to save/load's as they always seem to fail on me.

Edit: Not sure what to post as a trigger since its a big system, Suppose the parts I changed I should post here, after matching each part it still fails to load.
  • Save Init
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Player Group - Pick every player in (All players) and do (Actions)
        • Loop - Actions
          • Set VariableSet testname[(Player number of (Picked player))] = (Name of (Picked player))
          • Player - Set name of (Picked player) to bob
      • Player Group - Pick every player in (All players) and do (Actions)
        • Loop - Actions
          • Player - Set name of (Picked player) to testname[(Player number of (Picked player))]
      • -------- ------------------- --------
      • -------- This willl be the directory the save codes will be saved to. --------
      • -------- ------------------- --------
      • Set VariableSet MapName = CodelessSave
      • -------- ------------------- --------
      • -------- This message will display to players who don't have local files enabled --------
      • -------- ------------------- --------
      • Set VariableSet LocalFiles_WarningMessage = |cffe53b3bYou need to enable local files to load your character from disk!
      • Custom script: set udg_LocalFiles_WarningMessage = udg_LocalFiles_WarningMessage + "\nTo enable local files, please run: |cffffcc00" + File.localFileScriptName + "|cffe53b3b (remove the |cffffcc00.txt|r extension) from your |cffffcc00Warcraft III folder|r|cffe53b3b.\n\n"
      • Set VariableSet LocalFiles_WarningMessage = (LocalFiles_WarningMessage + |cff4ae84aYour progress will still be automatically saved.|r)
      • Custom script: set udg_LocalFiles_WarningMessage = udg_LocalFiles_WarningMessage + "\n\n"
      • -------- ------------------- --------
      • -------- Show the save code --------
      • -------- ------------------- --------
      • Set VariableSet SaveShowCode = True
      • -------- ------------------- --------
      • -------- Save hero name (only works with the save slots, not raw save codes) --------
      • -------- Also make sure to set the object editor field "Text - Proper Names Used" to 999 for all of your heroes. --------
      • -------- ------------------- --------
      • Set VariableSet SaveHeroName = True
      • -------- ------------------- --------
      • -------- Set these to the values they are in the Advanced -> Gameplay constants --------
      • -------- Allows us to calculate how much XP a hero has --------
      • -------- Note: You can also save EXP the easy way but it will generate a longer code. --------
      • -------- ------------------- --------
      • Set VariableSet HeroXPConstant = 1
      • Set VariableSet HeroXPLevelFactor = 1
      • Set VariableSet HeroXPPrevLevelFactor = 1
      • Set VariableSet HeroXPRequired = 200
      • -------- ------------------- --------
      • -------- Max STR/AGI/INT --------
      • -------- ------------------- --------
      • Set VariableSet SaveUnitMaxStat = (1000000000 x 2)
      • -------- ------------------- --------
      • -------- Store unit types that can be saved here --------
      • -------- ------------------- --------
      • Set VariableSet SaveUnitType[0] = No unit-type
      • Set VariableSet SaveUnitType[1] = Tauren Chieftain
      • Set VariableSet SaveUnitType[2] = Lich
      • Set VariableSet SaveUnitType[3] = Demon Hunter
      • Set VariableSet SaveUnitType[4] = Sea Witch
      • Set VariableSet SaveUnitType[5] = Beastmaster
      • Set VariableSet SaveUnitType[6] = Blood Mage
      • Set VariableSet SaveUnitType[7] = Demon Hunter (Demon Form)
      • Set VariableSet SaveUnitTypeMax = 7
      • -------- ------------------- --------
      • -------- Store item types that can be saved here --------
      • -------- ------------------- --------
      • Set VariableSet SaveItemType[0] = (Item-type of No item)
      • Set VariableSet SaveItemType[1] = Crown of Kings +5
      • Set VariableSet SaveItemType[2] = Kelen's Dagger of Escape
      • Set VariableSet SaveItemType[3] = Mask of Death
      • Set VariableSet SaveItemType[4] = Orb of Frost
      • Set VariableSet SaveItemType[5] = Ring of Protection +5
      • Set VariableSet SaveItemType[6] = Blood Key
      • Set VariableSet SaveItemType[7] = Cheese
      • Set VariableSet SaveItemType[8] = Claws of Attack +15
      • Set VariableSet SaveItemTypeMax = 8
      • -------- ------------------- --------
      • -------- Store ability types that can be saved here --------
      • -------- ------------------- --------
      • Set VariableSet SaveAbilityType[1] = Endurance Aura
      • Set VariableSet SaveAbilityType[2] = Reincarnation
      • Set VariableSet SaveAbilityType[3] = War Stomp
      • Set VariableSet SaveAbilityType[4] = Frost Nova
      • Set VariableSet SaveAbilityType[5] = Frost Armor (Autocast)
      • Set VariableSet SaveAbilityType[6] = Dark Ritual
      • Set VariableSet SaveAbilityType[7] = Death And Decay
      • Set VariableSet SaveAbilityType[8] = Mana Burn
      • Set VariableSet SaveAbilityType[9] = Immolation
      • Set VariableSet SaveAbilityType[10] = Evasion
      • Set VariableSet SaveAbilityType[11] = Metamorphosis
      • Set VariableSet SaveAbilityType[12] = Forked Lightning
      • Set VariableSet SaveAbilityType[13] = Frost Arrows
      • Set VariableSet SaveAbilityType[14] = Mana Shield
      • Set VariableSet SaveAbilityType[15] = Tornado
      • Set VariableSet SaveAbilityType[16] = Summon Bear
      • Set VariableSet SaveAbilityType[17] = Summon Quilbeast
      • Set VariableSet SaveAbilityType[18] = Summon Hawk
      • Set VariableSet SaveAbilityType[19] = Stampede
      • Set VariableSet SaveAbilityType[20] = Flame Strike
      • Set VariableSet SaveAbilityType[21] = Banish
      • Set VariableSet SaveAbilityType[22] = Siphon Mana
      • Set VariableSet SaveAbilityType[23] = Phoenix
      • Set VariableSet SaveAbilityType[24] = Shockwave
      • Set VariableSet SaveAbilityTypeMax = 24
      • -------- ------------------- --------
      • -------- Automatically copy variables --------
      • -------- ------------------- --------
      • Set VariableSet SaveLoadEvent = -1.00
      • Set VariableSet SaveCount = 0
      • Set VariableSet SaveValue[0] = 0
      • Set VariableSet SaveMaxValue[0] = 0
      • Set VariableSet SaveTempInt = 0
      • Set VariableSet SavePlayerHero[0] = No unit
      • Set VariableSet SaveLoadEvent_Code = <Empty String>
      • Set VariableSet SaveLoadEvent_Player = Player 1 (Red)

  • Save GUI
    • Events
      • Player - Player 1 (Red) types a chat message containing -save as An exact match
      • Player - Player 2 (Blue) types a chat message containing -save as An exact match
      • Player - Player 3 (Teal) types a chat message containing -save as An exact match
      • Player - Player 4 (Purple) types a chat message containing -save as An exact match
      • Player - Player 5 (Yellow) types a chat message containing -save as An exact match
      • Player - Player 6 (Orange) types a chat message containing -save as An exact match
      • Player - Player 7 (Green) types a chat message containing -save as An exact match
      • Player - Player 8 (Pink) types a chat message containing -save as An exact match
      • Player - Player 9 (Gray) types a chat message containing -save as An exact match
      • Player - Player 10 (Light Blue) types a chat message containing -save as An exact match
      • Player - Player 11 (Dark Green) types a chat message containing -save as An exact match
    • Conditions
      • (SavePlayerHero[((Player number of (Triggering player)) - 1)] is A Hero) Equal to True
    • Actions
      • Game - Display to (All players) the text: test
      • -------- ------------------- --------
      • -------- NOTE: You must load values in the reverse order you saved them in. This is why we save the unit type last. --------
      • -------- ------------------- --------
      • Set VariableSet SaveTempUnit = SavePlayerHero[((Player number of (Triggering player)) - 1)]
      • Set VariableSet SaveCount = -1
      • -------- ------------------- --------
      • -------- Save Abilities --------
      • -------- ------------------- --------
      • For each (Integer SaveTempInt) from 0 to SaveAbilityTypeMax, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Level of SaveAbilityType[SaveTempInt] for SaveTempUnit) Greater than 0
            • Then - Actions
              • -------- Save level of ability --------
              • Set VariableSet SaveCount = (SaveCount + 1)
              • Set VariableSet SaveValue[SaveCount] = (Level of SaveAbilityType[SaveTempInt] for SaveTempUnit)
              • Set VariableSet SaveMaxValue[SaveCount] = 10
              • -------- Save the array index --------
              • Set VariableSet SaveCount = (SaveCount + 1)
              • Set VariableSet SaveValue[SaveCount] = SaveTempInt
              • Set VariableSet SaveMaxValue[SaveCount] = SaveAbilityTypeMax
            • Else - Actions
      • -------- Save the number of abilities the unit has --------
      • Set VariableSet SaveCount = (SaveCount + 1)
      • Set VariableSet SaveValue[SaveCount] = (SaveCount / 2)
      • Set VariableSet SaveMaxValue[SaveCount] = SaveAbilityTypeMax
      • -------- ------------------- --------
      • -------- Save Skill Points --------
      • -------- ------------------- --------
      • Set VariableSet SaveCount = (SaveCount + 1)
      • Set VariableSet SaveValue[SaveCount] = (Unspent skill points of SaveTempUnit)
      • Set VariableSet SaveMaxValue[SaveCount] = 999
      • -------- ------------------- --------
      • -------- Save Items --------
      • -------- ------------------- --------
      • For each (Integer SaveTempInt) from 0 to 5, do (Actions)
        • Loop - Actions
          • Set VariableSet SaveCount = (SaveCount + 1)
          • Custom script: set udg_SaveValue[udg_SaveCount] = SaveCode_I2I(GetItemTypeId(UnitItemInSlot(udg_SaveTempUnit, udg_SaveTempInt)))
          • Set VariableSet SaveMaxValue[SaveCount] = SaveItemTypeMax
      • -------- ------------------- --------
      • -------- Save Attributes --------
      • -------- ------------------- --------
      • Set VariableSet SaveCount = (SaveCount + 1)
      • Set VariableSet SaveValue[SaveCount] = (Strength of SaveTempUnit (Exclude bonuses))
      • Set VariableSet SaveMaxValue[SaveCount] = 900000000
      • -------- ------------------- --------
      • Set VariableSet SaveCount = (SaveCount + 1)
      • Set VariableSet SaveValue[SaveCount] = (Agility of SaveTempUnit (Exclude bonuses))
      • Set VariableSet SaveMaxValue[SaveCount] = 900000000
      • -------- ------------------- --------
      • Set VariableSet SaveCount = (SaveCount + 1)
      • Set VariableSet SaveValue[SaveCount] = (Intelligence of SaveTempUnit (Exclude bonuses))
      • Set VariableSet SaveMaxValue[SaveCount] = 900000000
      • -------- ------------------- --------
      • -------- Save Experience (%) and Level --------
      • -------- ------------------- --------
      • Set VariableSet SaveCount = (SaveCount + 1)
      • Custom script: set udg_SaveValue[udg_SaveCount] = R2I( (GetHeroXP(udg_SaveTempUnit)) / FindLevelXP(GetHeroLevel(udg_SaveTempUnit)) * 100) // percentage
      • Set VariableSet SaveMaxValue[SaveCount] = 1000000000
      • -------- ------------------- --------
      • Set VariableSet SaveCount = (SaveCount + 1)
      • Set VariableSet SaveValue[SaveCount] = (Hero level of SaveTempUnit)
      • Set VariableSet SaveMaxValue[SaveCount] = 9999999
      • -------- ------------------- --------
      • -------- Save Unit Type --------
      • -------- ------------------- --------
      • Set VariableSet SaveCount = (SaveCount + 1)
      • Custom script: set udg_SaveValue[udg_SaveCount] = SaveCode_U2I(GetUnitTypeId(udg_SaveTempUnit))
      • Set VariableSet SaveMaxValue[SaveCount] = SaveUnitTypeMax
      • -------- ------------------- --------
      • -------- Save to disk --------
      • -------- ------------------- --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • SaveLoad_Slot Less than 0
        • Then - Actions
          • Set VariableSet SaveLoad_Slot = 11
        • Else - Actions
      • Custom script: call SaveCode_Save(GetTriggerPlayer(), udg_SaveLoad_Slot)

  • Load GUI2
    • Events
      • Game - SaveLoadEvent becomes Equal to 1.00
    • Conditions
    • Actions
      • Set VariableSet SaveCount = -1
      • -------- ------------------- --------
      • -------- NOTE: You must load values in the reverse order you saved them in --------
      • -------- ------------------- --------
      • -------- Validate --------
      • -------- ------------------- --------
      • Custom script: set udg_SaveTempInt = integer(Savecode.create())
      • Custom script: if not (Savecode(udg_SaveTempInt).Load(udg_SaveLoadEvent_Player, udg_SaveLoadEvent_Code, 1)) then
      • Game - Display to (Player group(SaveLoadEvent_Player)) the text: Invalid load code (...
      • Skip remaining actions
      • Custom script: endif
      • Custom script: call DisplayTextToPlayer(GetLocalPlayer(), 0, 0, "Loaded " + User[udg_SaveLoadEvent_Player].nameColored + "'s character in " + R2S(udg_SaveTempReal) + " seconds!")
      • -------- ------------------- --------
      • -------- Load Hero --------
      • -------- ------------------- --------
      • Unit - Remove SavePlayerHero[((Player number of SaveLoadEvent_Player) - 1)] from the game
      • -------- ------------------- --------
      • Set VariableSet SaveCount = (SaveCount + 1)
      • Set VariableSet SaveMaxValue[SaveCount] = SaveUnitTypeMax
      • Custom script: call SaveCode_LoadNextValue()
      • -------- ------------------- --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (SaveUnitType[SaveValue[SaveCount]] is A Hero) Equal to True
          • SaveHeroName Equal to True
        • Then - Actions
          • Custom script: set udg_SaveTempUnit = SaveCode_LoadHeroWithProperName(udg_SaveLoadEvent_Player, udg_SaveUnitType[udg_SaveValue[udg_SaveCount]], 0, 0, 0)
        • Else - Actions
          • Unit - Create 1 SaveUnitType[SaveValue[SaveCount]] for SaveLoadEvent_Player at (Center of (Playable map area)) facing Default building facing degrees
          • Set VariableSet SaveTempUnit = (Last created unit)
      • Set VariableSet SavePlayerHero[((Player number of SaveLoadEvent_Player) - 1)] = SaveTempUnit
      • Selection - Select SaveTempUnit for SaveLoadEvent_Player
      • -------- ------------------- --------
      • -------- Load Experience and Level --------
      • -------- ------------------- --------
      • Set VariableSet SaveCount = (SaveCount + 1)
      • Set VariableSet SaveMaxValue[SaveCount] = 9999999
      • Custom script: call SaveCode_LoadNextValue()
      • -------- ------------------- --------
      • Set VariableSet SaveCount = (SaveCount + 1)
      • Set VariableSet SaveMaxValue[SaveCount] = 1000000000
      • Custom script: call SaveCode_LoadNextValue()
      • Custom script: set udg_SaveTempReal = FindLevelXP(udg_SaveValue[udg_SaveCount-1])
      • Hero - Set SaveTempUnit experience to (Integer((((Real(SaveValue[SaveCount])) / 100.00) x SaveTempReal))), Hide level-up graphics
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Hero level of SaveTempUnit) Not equal to SaveValue[(SaveCount - 1)]
        • Then - Actions
          • Hero - Set SaveTempUnit Hero-level to SaveValue[(SaveCount - 1)], Hide level-up graphics
        • Else - Actions
      • -------- ------------------- --------
      • -------- Load Attributes --------
      • -------- ------------------- --------
      • Set VariableSet SaveCount = (SaveCount + 1)
      • Set VariableSet SaveMaxValue[SaveCount] = 900000000
      • Custom script: call SaveCode_LoadNextValue()
      • Hero - Modify Intelligence of SaveTempUnit: Set to SaveValue[SaveCount].
      • -------- ------------------- --------
      • Set VariableSet SaveCount = (SaveCount + 1)
      • Set VariableSet SaveMaxValue[SaveCount] = 900000000
      • Custom script: call SaveCode_LoadNextValue()
      • Hero - Modify Agility of SaveTempUnit: Set to SaveValue[SaveCount].
      • -------- ------------------- --------
      • Set VariableSet SaveCount = (SaveCount + 1)
      • Set VariableSet SaveMaxValue[SaveCount] = 900000000
      • Custom script: call SaveCode_LoadNextValue()
      • Hero - Modify Strength of SaveTempUnit: Set to SaveValue[SaveCount].
      • -------- ------------------- --------
      • -------- Load Items --------
      • -------- ------------------- --------
      • For each (Integer A) from 0 to 5, do (Actions)
        • Loop - Actions
          • Set VariableSet SaveCount = (SaveCount + 1)
          • Set VariableSet SaveMaxValue[SaveCount] = SaveItemTypeMax
          • Custom script: call SaveCode_LoadNextValue()
          • Hero - Create SaveItemType[SaveValue[SaveCount]] and give it to SaveTempUnit
      • -------- ------------------- --------
      • -------- Load Skill Points --------
      • -------- ------------------- --------
      • Set VariableSet SaveCount = (SaveCount + 1)
      • Set VariableSet SaveMaxValue[SaveCount] = 999
      • Custom script: call SaveCode_LoadNextValue()
      • Hero - Modify unspent skill points of SaveTempUnit: Set to 0 points
      • Hero - Modify unspent skill points of SaveTempUnit: Set to (SaveValue[SaveCount] - (Unspent skill points of SaveTempUnit)) points
      • -------- ------------------- --------
      • -------- Load Abilities --------
      • -------- ------------------- --------
      • Set VariableSet SaveCount = (SaveCount + 1)
      • Set VariableSet SaveMaxValue[SaveCount] = SaveAbilityTypeMax
      • Custom script: call SaveCode_LoadNextValue()
      • Set VariableSet SaveTempReal = (Real(SaveValue[SaveCount]))
      • For each (Integer A) from 0 to (Integer(SaveTempReal)), do (Actions)
        • Loop - Actions
          • Set VariableSet SaveCount = (SaveCount + 1)
          • Set VariableSet SaveMaxValue[SaveCount] = SaveAbilityTypeMax
          • Custom script: call SaveCode_LoadNextValue()
          • Unit - Add SaveAbilityType[SaveValue[SaveCount]] to SaveTempUnit
          • Set VariableSet SaveCount = (SaveCount + 1)
          • Set VariableSet SaveMaxValue[SaveCount] = 10
          • Custom script: call SaveCode_LoadNextValue()
          • Unit - Set level of SaveAbilityType[SaveValue[(SaveCount - 1)]] for SaveTempUnit to SaveValue[SaveCount]
      • Custom script: call Savecode(udg_SaveTempInt).destroy()

Never mind, I figured out an alternative since the only solution to this would of been trying to convert this to support reals instead of integers. The alternative solution being saving more values as in parts of a big number at a time.

  • Save GUI
    • Events
      • Player - Player 1 (Red) types a chat message containing -save as An exact match
      • Player - Player 2 (Blue) types a chat message containing -save as An exact match
      • Player - Player 3 (Teal) types a chat message containing -save as An exact match
      • Player - Player 4 (Purple) types a chat message containing -save as An exact match
      • Player - Player 5 (Yellow) types a chat message containing -save as An exact match
      • Player - Player 6 (Orange) types a chat message containing -save as An exact match
      • Player - Player 7 (Green) types a chat message containing -save as An exact match
      • Player - Player 8 (Pink) types a chat message containing -save as An exact match
      • Player - Player 9 (Gray) types a chat message containing -save as An exact match
      • Player - Player 10 (Light Blue) types a chat message containing -save as An exact match
      • Player - Player 11 (Dark Green) types a chat message containing -save as An exact match
    • Conditions
      • (SavePlayerHero[((Player number of (Triggering player)) - 1)] is A Hero) Equal to True
    • Actions
      • Game - Display to (All players) the text: test
      • -------- ------------------- --------
      • -------- NOTE: You must load values in the reverse order you saved them in. This is why we save the unit type last. --------
      • -------- ------------------- --------
      • Set VariableSet SaveTempUnit = SavePlayerHero[((Player number of (Triggering player)) - 1)]
      • Set VariableSet SaveCount = -1
      • -------- ------------------- --------
      • -------- Save Abilities --------
      • -------- ------------------- --------
      • For each (Integer SaveTempInt) from 0 to SaveAbilityTypeMax, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Level of SaveAbilityType[SaveTempInt] for SaveTempUnit) Greater than 0
            • Then - Actions
              • -------- Save level of ability --------
              • Set VariableSet SaveCount = (SaveCount + 1)
              • Set VariableSet SaveValue[SaveCount] = (Level of SaveAbilityType[SaveTempInt] for SaveTempUnit)
              • Set VariableSet SaveMaxValue[SaveCount] = 10
              • -------- Save the array index --------
              • Set VariableSet SaveCount = (SaveCount + 1)
              • Set VariableSet SaveValue[SaveCount] = SaveTempInt
              • Set VariableSet SaveMaxValue[SaveCount] = SaveAbilityTypeMax
            • Else - Actions
      • -------- Save the number of abilities the unit has --------
      • Set VariableSet SaveCount = (SaveCount + 1)
      • Set VariableSet SaveValue[SaveCount] = (SaveCount / 2)
      • Set VariableSet SaveMaxValue[SaveCount] = SaveAbilityTypeMax
      • -------- ------------------- --------
      • -------- Save Skill Points --------
      • -------- ------------------- --------
      • Set VariableSet SaveCount = (SaveCount + 1)
      • Set VariableSet SaveValue[SaveCount] = (Unspent skill points of SaveTempUnit)
      • Set VariableSet SaveMaxValue[SaveCount] = 999
      • -------- ------------------- --------
      • -------- Save Items --------
      • -------- ------------------- --------
      • For each (Integer SaveTempInt) from 0 to 5, do (Actions)
        • Loop - Actions
          • Set VariableSet SaveCount = (SaveCount + 1)
          • Custom script: set udg_SaveValue[udg_SaveCount] = SaveCode_I2I(GetItemTypeId(UnitItemInSlot(udg_SaveTempUnit, udg_SaveTempInt)))
          • Set VariableSet SaveMaxValue[SaveCount] = SaveItemTypeMax
      • -------- ------------------- --------
      • -------- Save Attributes --------
      • -------- ------------------- --------
      • Set VariableSet SaveCount = (SaveCount + 1)
      • Set VariableSet SaveValue[SaveCount] = (Strength of SaveTempUnit (Exclude bonuses))
      • Set VariableSet SaveValue[SaveCount] = (Integer((Substring((String((Strength of SaveTempUnit (Exclude bonuses)))), 1, 3))))
      • Set VariableSet SaveMaxValue[SaveCount] = 9999
      • Game - Display to (All players) the text: (String(SaveValue[SaveCount]))
      • -------- ------------------- --------
      • Set VariableSet SaveCount = (SaveCount + 1)
      • Set VariableSet SaveValue[SaveCount] = (Integer((Substring((String((Strength of SaveTempUnit (Exclude bonuses)))), 4, 7))))
      • Set VariableSet SaveMaxValue[SaveCount] = 9999
      • Game - Display to (All players) the text: (String(SaveValue[SaveCount]))
      • -------- ------------------- --------
      • Set VariableSet SaveCount = (SaveCount + 1)
      • Set VariableSet SaveValue[SaveCount] = (Integer((Substring((String((Strength of SaveTempUnit (Exclude bonuses)))), 8, 11))))
      • Set VariableSet SaveMaxValue[SaveCount] = 9999
      • Game - Display to (All players) the text: (String(SaveValue[SaveCount]))
      • Game - Display to (All players) the text: ((String(SaveValue[(SaveCount - 2)])) + ((String(SaveValue[(SaveCount - 1)])) + (String(SaveValue[SaveCount]))))
      • -------- ------------------- --------
      • Set VariableSet SaveCount = (SaveCount + 1)
      • Set VariableSet SaveValue[SaveCount] = (Agility of SaveTempUnit (Exclude bonuses))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • SaveValue[SaveCount] Greater than or equal to 9999
        • Then - Actions
          • Set VariableSet SaveValue[SaveCount] = 9999
        • Else - Actions
      • Set VariableSet SaveMaxValue[SaveCount] = 9999
      • -------- ------------------- --------
      • Set VariableSet SaveCount = (SaveCount + 1)
      • Set VariableSet SaveValue[SaveCount] = (Intelligence of SaveTempUnit (Exclude bonuses))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • SaveValue[SaveCount] Greater than or equal to 9999
        • Then - Actions
          • Set VariableSet SaveValue[SaveCount] = 9999
        • Else - Actions
      • Set VariableSet SaveMaxValue[SaveCount] = 9999
      • -------- ------------------- --------
      • -------- Save Experience (%) and Level --------
      • -------- ------------------- --------
      • Set VariableSet SaveCount = (SaveCount + 1)
      • Custom script: set udg_SaveValue[udg_SaveCount] = R2I( (GetHeroXP(udg_SaveTempUnit)) / FindLevelXP(GetHeroLevel(udg_SaveTempUnit)) * 100) // percentage
      • Set VariableSet SaveMaxValue[SaveCount] = 100
      • -------- ------------------- --------
      • Set VariableSet SaveCount = (SaveCount + 1)
      • Set VariableSet SaveValue[SaveCount] = (Hero level of SaveTempUnit)
      • Set VariableSet SaveMaxValue[SaveCount] = 9999
      • -------- ------------------- --------
      • -------- Save Unit Type --------
      • -------- ------------------- --------
      • Set VariableSet SaveCount = (SaveCount + 1)
      • Custom script: set udg_SaveValue[udg_SaveCount] = SaveCode_U2I(GetUnitTypeId(udg_SaveTempUnit))
      • Set VariableSet SaveMaxValue[SaveCount] = SaveUnitTypeMax
      • -------- ------------------- --------
      • -------- Save to disk --------
      • -------- ------------------- --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • SaveLoad_Slot Less than 0
        • Then - Actions
          • Set VariableSet SaveLoad_Slot = 11
        • Else - Actions
      • Custom script: call SaveCode_Save(GetTriggerPlayer(), udg_SaveLoad_Slot)

  • Load GUI2
    • Events
      • Game - SaveLoadEvent becomes Equal to 1.00
    • Conditions
    • Actions
      • Set VariableSet SaveCount = -1
      • -------- ------------------- --------
      • -------- NOTE: You must load values in the reverse order you saved them in --------
      • -------- ------------------- --------
      • -------- Validate --------
      • -------- ------------------- --------
      • Custom script: set udg_SaveTempInt = integer(Savecode.create())
      • Custom script: if not (Savecode(udg_SaveTempInt).Load(udg_SaveLoadEvent_Player, udg_SaveLoadEvent_Code, 1)) then
      • Game - Display to (Player group(SaveLoadEvent_Player)) the text: Invalid load code (...
      • Skip remaining actions
      • Custom script: endif
      • Custom script: call DisplayTextToPlayer(GetLocalPlayer(), 0, 0, "Loaded " + User[udg_SaveLoadEvent_Player].nameColored + "'s character in " + R2S(udg_SaveTempReal) + " seconds!")
      • -------- ------------------- --------
      • -------- Load Hero --------
      • -------- ------------------- --------
      • Unit - Remove SavePlayerHero[((Player number of SaveLoadEvent_Player) - 1)] from the game
      • -------- ------------------- --------
      • Set VariableSet SaveCount = (SaveCount + 1)
      • Set VariableSet SaveMaxValue[SaveCount] = SaveUnitTypeMax
      • Custom script: call SaveCode_LoadNextValue()
      • -------- ------------------- --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (SaveUnitType[SaveValue[SaveCount]] is A Hero) Equal to True
          • SaveHeroName Equal to True
        • Then - Actions
          • Custom script: set udg_SaveTempUnit = SaveCode_LoadHeroWithProperName(udg_SaveLoadEvent_Player, udg_SaveUnitType[udg_SaveValue[udg_SaveCount]], 0, 0, 0)
        • Else - Actions
          • Unit - Create 1 SaveUnitType[SaveValue[SaveCount]] for SaveLoadEvent_Player at (Center of (Playable map area)) facing Default building facing degrees
          • Set VariableSet SaveTempUnit = (Last created unit)
      • Set VariableSet SavePlayerHero[((Player number of SaveLoadEvent_Player) - 1)] = SaveTempUnit
      • Selection - Select SaveTempUnit for SaveLoadEvent_Player
      • -------- ------------------- --------
      • -------- Load Experience and Level --------
      • -------- ------------------- --------
      • Set VariableSet SaveCount = (SaveCount + 1)
      • Set VariableSet SaveMaxValue[SaveCount] = 9999
      • Custom script: call SaveCode_LoadNextValue()
      • -------- ------------------- --------
      • Set VariableSet SaveCount = (SaveCount + 1)
      • Set VariableSet SaveMaxValue[SaveCount] = 100
      • Custom script: call SaveCode_LoadNextValue()
      • Custom script: set udg_SaveTempReal = FindLevelXP(udg_SaveValue[udg_SaveCount-1])
      • Hero - Set SaveTempUnit experience to (Integer((((Real(SaveValue[SaveCount])) / 100.00) x SaveTempReal))), Hide level-up graphics
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Hero level of SaveTempUnit) Not equal to SaveValue[(SaveCount - 1)]
        • Then - Actions
          • Hero - Set SaveTempUnit Hero-level to SaveValue[(SaveCount - 1)], Hide level-up graphics
        • Else - Actions
      • -------- ------------------- --------
      • -------- Load Attributes --------
      • -------- ------------------- --------
      • Set VariableSet SaveCount = (SaveCount + 1)
      • Set VariableSet SaveMaxValue[SaveCount] = 9999
      • Custom script: call SaveCode_LoadNextValue()
      • Hero - Modify Intelligence of SaveTempUnit: Set to SaveValue[SaveCount].
      • -------- ------------------- --------
      • Set VariableSet SaveCount = (SaveCount + 1)
      • Set VariableSet SaveMaxValue[SaveCount] = 9999
      • Custom script: call SaveCode_LoadNextValue()
      • Hero - Modify Agility of SaveTempUnit: Set to SaveValue[SaveCount].
      • -------- ------------------- --------
      • Set VariableSet SaveCount = (SaveCount + 1)
      • Set VariableSet SaveMaxValue[SaveCount] = 9999
      • Custom script: call SaveCode_LoadNextValue()
      • Set VariableSet teststring[3] = (String(SaveValue[SaveCount]))
      • -------- ------------------- --------
      • Set VariableSet SaveCount = (SaveCount + 1)
      • Set VariableSet SaveMaxValue[SaveCount] = 9999
      • Custom script: call SaveCode_LoadNextValue()
      • Set VariableSet teststring[2] = (String(SaveValue[SaveCount]))
      • -------- ------------------- --------
      • Set VariableSet SaveCount = (SaveCount + 1)
      • Set VariableSet SaveMaxValue[SaveCount] = 9999
      • Custom script: call SaveCode_LoadNextValue()
      • Set VariableSet teststring[1] = (String(SaveValue[SaveCount]))
      • -------- ------------------- --------
      • Set VariableSet teststring[4] = (teststring[1] + (teststring[2] + teststring[3]))
      • Hero - Modify Strength of SaveTempUnit: Set to (Integer(teststring[4])).
      • -------- ------------------- --------
      • -------- Load Items --------
      • -------- ------------------- --------
      • For each (Integer A) from 0 to 5, do (Actions)
        • Loop - Actions
          • Set VariableSet SaveCount = (SaveCount + 1)
          • Set VariableSet SaveMaxValue[SaveCount] = SaveItemTypeMax
          • Custom script: call SaveCode_LoadNextValue()
          • Hero - Create SaveItemType[SaveValue[SaveCount]] and give it to SaveTempUnit
      • -------- ------------------- --------
      • -------- Load Skill Points --------
      • -------- ------------------- --------
      • Set VariableSet SaveCount = (SaveCount + 1)
      • Set VariableSet SaveMaxValue[SaveCount] = 999
      • Custom script: call SaveCode_LoadNextValue()
      • Hero - Modify unspent skill points of SaveTempUnit: Set to 0 points
      • Hero - Modify unspent skill points of SaveTempUnit: Set to (SaveValue[SaveCount] - (Unspent skill points of SaveTempUnit)) points
      • -------- ------------------- --------
      • -------- Load Abilities --------
      • -------- ------------------- --------
      • Set VariableSet SaveCount = (SaveCount + 1)
      • Set VariableSet SaveMaxValue[SaveCount] = SaveAbilityTypeMax
      • Custom script: call SaveCode_LoadNextValue()
      • Set VariableSet SaveTempReal = (Real(SaveValue[SaveCount]))
      • For each (Integer A) from 0 to (Integer(SaveTempReal)), do (Actions)
        • Loop - Actions
          • Set VariableSet SaveCount = (SaveCount + 1)
          • Set VariableSet SaveMaxValue[SaveCount] = SaveAbilityTypeMax
          • Custom script: call SaveCode_LoadNextValue()
          • Unit - Add SaveAbilityType[SaveValue[SaveCount]] to SaveTempUnit
          • Set VariableSet SaveCount = (SaveCount + 1)
          • Set VariableSet SaveMaxValue[SaveCount] = 10
          • Custom script: call SaveCode_LoadNextValue()
          • Unit - Set level of SaveAbilityType[SaveValue[(SaveCount - 1)]] for SaveTempUnit to SaveValue[SaveCount]
      • Custom script: call Savecode(udg_SaveTempInt).destroy()
 

Attachments

  • Codeless Save Load v1.3.9 - tests.w3x
    106.4 KB · Views: 9
Last edited:

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,198
As a guess you just need to change the experience compression function to not suffer from numerical overflow.

Specifically at such high level numbers allocate a full integer (32 bits of data) for the experience and save that rather than level. That will give you the full range of levels as supported by Warcraft III which also uses 32 bit integers for experience.
 
Status
Not open for further replies.
Top