• 🏆 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!

Leak or Lag Problem

Status
Not open for further replies.
Level 5
Joined
Sep 21, 2012
Messages
68
Set Variable A = Point B
Create C at A
RemoveLocation(udg_A)

Hi, I'm just wondering if I use 10 times of that in a trigger then will it cause leak?
Sorry for spaming, just look at this

Set Variable A = Point B
Create C at A
RemoveLocation(udg_A)
Set Variable A = Point B
Create C at A
RemoveLocation(udg_A)
Set Variable A = Point B
Create C at Variable A
RemoveLocation(udg_A)
x10.....
all of that in a trigger... so will it cause leak or lag?

P/s: Noob At English
 
Level 5
Joined
Sep 21, 2012
Messages
68
I have one more question is that if you use a system like GUI Damage Engine then is it possible for it to cause something wrongs with my map by using it too much? Because my map uses that system in every attacks (also spells), be attacked. I'm dealing with a problem is that if I played the map longer than 30 minutes then the chance it got error (I'm talking about save/load code) is very high (maybe 40%). Currently my map is using both GUI Damage Engine and CodeGen.
 

Dr Super Good

Spell Reviewer
Level 63
Joined
Jan 18, 2005
Messages
27,192
I have one more question is that if you use a system like GUI Damage Engine then is it possible for it to cause something wrongs with my map by using it too much? Because my map uses that system in every attacks (also spells), be attacked. I'm dealing with a problem is that if I played the map longer than 30 minutes then the chance it got error (I'm talking about save/load code) is very high (maybe 40%). Currently my map is using both GUI Damage Engine and CodeGen.
Sounds like something is wrong with the save/load system... It should function the same at map initialization as it does after hours in a leaky map.

Make sure it is not hitting the op limit. If it does something silly like pick every unit or item on the map looking for what to save then that could easily cause the thread to reach the op limit before saving is complete.
 
Level 5
Joined
Sep 21, 2012
Messages
68
Hi, I am using your CodeGen Save/Load system and I have 1 issue with that. May I ask that your CodeGen is completely leakless ? Because I am dealing with a problem is that when I played my map for a long time (like 45 mins or more) then the code when you -save gets error in the next game. It was like the game before (before the game that you -load then you get error with your code) you play very normal. Nothing was going wrong in that game. But in the next game (remake), I typed -load "code" then I get error with my hero, like:
-Strength: 34253 (Instead of 80, I noticed that 34253 supposed to be 34253 gold but now its 0)
-Agility: 1239 (Instead of 65, samething happens 1239 supposed to be 1239 lumber but now its 0)
-Intelligence: 50 (Instead of 55, samething happens 50 supposed to be 50 food but now its 0)

Well, if I played the game less than 30 minutes, everything goes fine in the next game without getting my code error. I thought it was my map gets too many leaks so I checked but I couldn't find any. So........ i don't know what to do except asking you about this. Hopefully you can reply me asap @@. Thank you so much for your time reading this.

Trigger Happy: Memory leaks would have nothing to do with it and there's likely something wrong with your triggers.

That was the conversation between me and Trigger Happy (just want to post it here for more clearly about my problem).
I'm pretty new with the World Editor so may i ask what is "op limit"......
 
Last edited:

Dr Super Good

Spell Reviewer
Level 63
Joined
Jan 18, 2005
Messages
27,192
The fact you get a code means it is unlikely you are hitting the op limit. The op limit is a limit on the number of JASS virtual machine operations that can be executed consecutively within a single thread before the thread is terminated. It is a form of infinite loop protection that will protect against simple forms of infinite loop like a never ending loop statement or a loop that is so big/complex it might as well never end.

It might be a good idea to post the saving an loading triggers. The error might be an easy spot.
 
Level 5
Joined
Sep 21, 2012
Messages
68
  • CodeGen Save
    • Events
      • Player - Player 1 (Red) types a chat message containing -luu as An exact match
      • Player - Player 2 (Blue) types a chat message containing -luu as An exact match
      • Player - Player 3 (Teal) types a chat message containing -luu as An exact match
      • Player - Player 4 (Purple) types a chat message containing -luu as An exact match
      • Player - Player 5 (Yellow) types a chat message containing -luu as An exact match
      • Player - Player 6 (Orange) types a chat message containing -luu as An exact match
      • Player - Player 7 (Green) types a chat message containing -luu as An exact match
    • Conditions
      • (Number of units in (Units owned by (Triggering player) matching (((Matching unit) is A Hero) Equal to (==) True))) Greater than or equal to (>=) 1
    • Actions
      • Set SaveCount = 0
      • Set SaveLoad_Index = (Player number of (Triggering player))
      • Set Hero = Game_Hero[SaveLoad_Index]
      • Custom script: set udg_Save[udg_SaveCount] = CodeGen_ConvertUnit(GetUnitTypeId(udg_Hero))
      • Set SaveCount = (SaveCount + 1)
      • Set Save[SaveCount] = (Hero_Armor[SaveLoad_Index] - Item_Armor[SaveLoad_Index])
      • Set SaveCount = (SaveCount + 1)
      • Set Save[SaveCount] = (Hero_AttackDamage[SaveLoad_Index] - Item_AttackDamage[SaveLoad_Index])
      • Set SaveCount = (SaveCount + 1)
      • Set Save[SaveCount] = (Hero_Crit[SaveLoad_Index] - Item_Crit[SaveLoad_Index])
      • Set SaveCount = (SaveCount + 1)
      • Set Save[SaveCount] = (Hero_CritChance[SaveLoad_Index] - Item_CritChance[SaveLoad_Index])
      • Set SaveCount = (SaveCount + 1)
      • Set Save[SaveCount] = (Hero_AttackSpeed[SaveLoad_Index] - Item_AttackSpeed[SaveLoad_Index])
      • Set SaveCount = (SaveCount + 1)
      • Set Save[SaveCount] = (Hero_HPRegen[SaveLoad_Index] - Item_HPRegen[SaveLoad_Index])
      • Set SaveCount = (SaveCount + 1)
      • Set Save[SaveCount] = (Hero_MPRegen[SaveLoad_Index] - Item_MPRegen[SaveLoad_Index])
      • Set SaveCount = (SaveCount + 1)
      • Set Save[SaveCount] = (Hero_SpellArmor[SaveLoad_Index] - Item_SpellArmor[SaveLoad_Index])
      • Set SaveCount = (SaveCount + 1)
      • Set Save[SaveCount] = (Hero_SpellCrit[SaveLoad_Index] - Item_SpellCrit[SaveLoad_Index])
      • Set SaveCount = (SaveCount + 1)
      • Set Save[SaveCount] = (Hero_SpellCritChance[SaveLoad_Index] - Item_SpellCritChance[SaveLoad_Index])
      • Set SaveCount = (SaveCount + 1)
      • Set Save[SaveCount] = (Hero_SpellDamage[SaveLoad_Index] - Item_SpellDamage[SaveLoad_Index])
      • Set SaveCount = (SaveCount + 1)
      • Set Save[SaveCount] = (Hero_BlockDamage[SaveLoad_Index] - Item_BlockDamage[SaveLoad_Index])
      • Set SaveCount = (SaveCount + 1)
      • Set Save[SaveCount] = (Hero_BlockSpell[SaveLoad_Index] - Item_BlockSpell[SaveLoad_Index])
      • Set SaveCount = (SaveCount + 1)
      • Set Save[SaveCount] = (Hero level of Hero)
      • Set SaveCount = (SaveCount + 1)
      • Set Save[SaveCount] = (Strength of Hero (Exclude bonuses))
      • Set SaveCount = (SaveCount + 1)
      • Set Save[SaveCount] = (Agility of Hero (Exclude bonuses))
      • Set SaveCount = (SaveCount + 1)
      • Set Save[SaveCount] = (Intelligence of Hero (Exclude bonuses))
      • Set SaveCount = (SaveCount + 1)
      • Set Save[SaveCount] = ((Triggering player) Current gold)
      • Set SaveCount = (SaveCount + 1)
      • Set Save[SaveCount] = ((Triggering player) Current lumber)
      • Set SaveCount = (SaveCount + 1)
      • Set Save[SaveCount] = ((Triggering player) Food used)
      • Set SaveCount = (SaveCount + 1)
      • Set Save[SaveCount] = Hero_ItemExp[SaveLoad_Index]
      • Set SaveCount = (SaveCount + 1)
      • Set Item = (Item carried by Hero in slot 1)
      • Custom script: set udg_Save[udg_SaveCount] = CodeGen_ConvertItem(GetItemTypeId(udg_Item))
      • Item - Set the custom value of (Item carried by Hero in slot 1) to SaveLoad_Index
      • Set SaveCount = (SaveCount + 1)
      • Set Item = (Item carried by Hero in slot 2)
      • Custom script: set udg_Save[udg_SaveCount] = CodeGen_ConvertItem(GetItemTypeId(udg_Item))
      • Item - Set the custom value of (Item carried by Hero in slot 2) to SaveLoad_Index
      • Set SaveCount = (SaveCount + 1)
      • Set Item = (Item carried by Hero in slot 3)
      • Custom script: set udg_Save[udg_SaveCount] = CodeGen_ConvertItem(GetItemTypeId(udg_Item))
      • Item - Set the custom value of (Item carried by Hero in slot 3) to SaveLoad_Index
      • Set SaveCount = (SaveCount + 1)
      • Set Item = (Item carried by Hero in slot 4)
      • Custom script: set udg_Save[udg_SaveCount] = CodeGen_ConvertItem(GetItemTypeId(udg_Item))
      • Item - Set the custom value of (Item carried by Hero in slot 4) to SaveLoad_Index
      • Set SaveCount = (SaveCount + 1)
      • Set Item = (Item carried by Hero in slot 5)
      • Custom script: set udg_Save[udg_SaveCount] = CodeGen_ConvertItem(GetItemTypeId(udg_Item))
      • Item - Set the custom value of (Item carried by Hero in slot 5) to SaveLoad_Index
      • Set SaveCount = (SaveCount + 1)
      • Set Item = (Item carried by Hero in slot 6)
      • Custom script: set udg_Save[udg_SaveCount] = CodeGen_ConvertItem(GetItemTypeId(udg_Item))
      • Item - Set the custom value of (Item carried by Hero in slot 6) to SaveLoad_Index
      • Set SaveCount = (SaveCount + 1)
      • Set Item = (Item carried by Game_Carrier[SaveLoad_Index] in slot 1)
      • Custom script: set udg_Save[udg_SaveCount] = CodeGen_ConvertItem(GetItemTypeId(udg_Item))
      • Item - Set the custom value of (Item carried by Game_Carrier[SaveLoad_Index] in slot 1) to SaveLoad_Index
      • Set SaveCount = (SaveCount + 1)
      • Set Item = (Item carried by Game_Carrier[SaveLoad_Index] in slot 2)
      • Custom script: set udg_Save[udg_SaveCount] = CodeGen_ConvertItem(GetItemTypeId(udg_Item))
      • Item - Set the custom value of (Item carried by Game_Carrier[SaveLoad_Index] in slot 2) to SaveLoad_Index
      • Set SaveCount = (SaveCount + 1)
      • Set Item = (Item carried by Game_Carrier[SaveLoad_Index] in slot 3)
      • Custom script: set udg_Save[udg_SaveCount] = CodeGen_ConvertItem(GetItemTypeId(udg_Item))
      • Item - Set the custom value of (Item carried by Game_Carrier[SaveLoad_Index] in slot 3) to SaveLoad_Index
      • Set SaveCount = (SaveCount + 1)
      • Set Item = (Item carried by Game_Carrier[SaveLoad_Index] in slot 4)
      • Custom script: set udg_Save[udg_SaveCount] = CodeGen_ConvertItem(GetItemTypeId(udg_Item))
      • Item - Set the custom value of (Item carried by Game_Carrier[SaveLoad_Index] in slot 4) to SaveLoad_Index
      • Set SaveCount = (SaveCount + 1)
      • Set Item = (Item carried by Game_Carrier[SaveLoad_Index] in slot 5)
      • Custom script: set udg_Save[udg_SaveCount] = CodeGen_ConvertItem(GetItemTypeId(udg_Item))
      • Item - Set the custom value of (Item carried by Game_Carrier[SaveLoad_Index] in slot 5) to SaveLoad_Index
      • Set SaveCount = (SaveCount + 1)
      • Set Item = (Item carried by Game_Carrier[SaveLoad_Index] in slot 6)
      • Custom script: set udg_Save[udg_SaveCount] = CodeGen_ConvertItem(GetItemTypeId(udg_Item))
      • Item - Set the custom value of (Item carried by Game_Carrier[SaveLoad_Index] in slot 6) to SaveLoad_Index
      • -------- -------------------- --------
      • -------- Set the filename for where the loadcode will be stored. --------
      • -------- -------------------- --------
      • Set SaveLoad_Directory = Save
      • Set SaveLoad_Filename = ((Deathly Angel VN RPG + (Name of (Triggering player))) + ('s + ( + (((Name of Hero) + ( Cap Do + (String((Hero level of Hero))))) + .txt))))
      • -------- -------------------- --------
      • -------- Show Code --------
      • -------- -------------------- --------
      • Set ZPlayer_Force = (Player group((Triggering player)))
      • Game - Display to ZPlayer_Force the text: M· cña b¹n ®· ...
      • Custom script: set udg_Code = CodeGen_Compile()
      • Game - Display to ZPlayer_Force for 60.00 seconds the text: Code
      • Custom script: call DestroyForce(udg_ZPlayer_Force)
  • CodeGen Load
    • Events
      • Player - Player 1 (Red) types a chat message containing -load as A substring
      • Player - Player 2 (Blue) types a chat message containing -load as A substring
      • Player - Player 3 (Teal) types a chat message containing -load as A substring
      • Player - Player 4 (Purple) types a chat message containing -load as A substring
      • Player - Player 5 (Yellow) types a chat message containing -load as A substring
      • Player - Player 6 (Orange) types a chat message containing -load as A substring
      • Player - Player 7 (Green) types a chat message containing -load as A substring
    • Conditions
      • Multiple ConditionsAnd - All (Conditions) are true
        • Conditions
          • (String((Substring((Entered chat string), 1, 6))) as Lower case) Equal to (==) -load
          • (Number of units in (Units owned by (Triggering player) matching (((Matching unit) is A Hero) Equal to (==) True))) Equal to (==) 0
    • Actions
      • -------- -------------------- --------
      • -------- Check if load is valid --------
      • -------- -------------------- --------
      • Set Code = (Substring((Entered chat string), 7, 999))
      • Custom script: call CodeGen_Load(udg_Code)
      • Set SaveLoad_Index = (Player number of (Triggering player))
        • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • SaveLoad_Valid Equal to (==) False
          • Then - Actions
            • Set ZPlayer_Force = (Player group((Triggering player)))
            • Game - Display to ZPlayer_Force for 10.00 seconds the text: SaveLoad_Error
            • Custom script: call DestroyForce(udg_ZPlayer_Force)
            • Skip remaining actions
          • Else - Actions
      • Player Group - Remove (Triggering player) from HeroPick_Player
      • Set LoadCount = 0
      • Set SaveLoad_Point = (Center of Greenforst <gen>)
      • Unit - Create 1 SaveLoad_Hero[Load[LoadCount]] for (Triggering player) at SaveLoad_Point facing Default building facing (270.0) degrees
      • Set Hero = (Last created unit)
      • Set Game_Hero[SaveLoad_Index] = (Last created unit)
      • Selection - Select (Last created unit) for (Triggering player)
        • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • (Unit-type of Hero) Equal to (==) TriÖu HÃ¥i SÂ
          • Then - Actions
            • Unit - Create 1 Ma B¨ng Hé Ph¸p for (Triggering player) at SaveLoad_Point facing Default building facing (270.0) degrees
            • Set Game_Summon[SaveLoad_Index] = (Last created unit)
            • Unit - Add .Energy Shield to Hero
          • Else - Actions
      • Unit - Create 1 NgÂêi V¸c §å for (Triggering player) at SaveLoad_Point facing Default building facing (270.0) degrees
      • Set Game_Carrier[SaveLoad_Index] = (Last created unit)
      • -------- -------------------- --------
      • -------- Load heroes level --------
      • -------- -------------------- --------
      • Set LoadCount = (LoadCount + 1)
      • Set Hero_Armor[SaveLoad_Index] = Load[LoadCount]
      • Set LoadCount = (LoadCount + 1)
      • Set Hero_AttackDamage[SaveLoad_Index] = Load[LoadCount]
      • Set LoadCount = (LoadCount + 1)
      • Set Hero_Crit[SaveLoad_Index] = Load[LoadCount]
      • Set LoadCount = (LoadCount + 1)
      • Set Hero_CritChance[SaveLoad_Index] = Load[LoadCount]
      • Set LoadCount = (LoadCount + 1)
      • Set Hero_AttackSpeed[SaveLoad_Index] = Load[LoadCount]
      • Set LoadCount = (LoadCount + 1)
      • Set Hero_HPRegen[SaveLoad_Index] = Load[LoadCount]
      • Set LoadCount = (LoadCount + 1)
      • Set Hero_MPRegen[SaveLoad_Index] = Load[LoadCount]
      • Set LoadCount = (LoadCount + 1)
      • Set Hero_SpellArmor[SaveLoad_Index] = Load[LoadCount]
      • Set LoadCount = (LoadCount + 1)
      • Set Hero_SpellCrit[SaveLoad_Index] = Load[LoadCount]
      • Set LoadCount = (LoadCount + 1)
      • Set Hero_SpellCritChance[SaveLoad_Index] = Load[LoadCount]
      • Set LoadCount = (LoadCount + 1)
      • Set Hero_SpellDamage[SaveLoad_Index] = Load[LoadCount]
      • Set LoadCount = (LoadCount + 1)
      • Set Hero_BlockDamage[SaveLoad_Index] = Load[LoadCount]
      • Set LoadCount = (LoadCount + 1)
      • Set Hero_BlockSpell[SaveLoad_Index] = Load[LoadCount]
      • Set LoadCount = (LoadCount + 1)
      • Hero - Set Hero Hero-level to Load[LoadCount], Show level-up graphics
        • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • (Unit-type of Hero) Equal to (==) TriÖu HÃ¥i SÂ
            • (Hero level of Hero) Greater than or equal to (>=) 55
            • ((Triggering player) is in Game_Summon_PlayerGroup) Equal to (==) False
          • Then - Actions
            • Unit - Create 1 Ph¸p S Bãng Tèi for (Triggering player) at SaveLoad_Point facing Default building facing (270.0) degrees
            • Set Game_Summon2[SaveLoad_Index] = (Last created unit)
            • Player Group - Add (Triggering player) to Game_Summon_PlayerGroup
          • Else - Actions
        • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • (Hero level of Hero) Greater than or equal to (>=) 55
          • Then - Actions
            • Player Group - Add (Triggering player) to ThienXa_Group
            • Unit - Set level of .Kü N¨ng TÂÃng Chien Binh for Hero to 5
            • Unit - Set level of .Kü N¨ng TÂÃng Cung Thñ for Hero to 5
            • Unit - Set level of .Kü N¨ng TÂÃng Phï Thñy for Hero to 5
            • Unit - Set level of .Kü N¨ng TÂÃng S¸t Thñ for Hero to 5
            • Unit - Set level of .Kü N¨ng TÂÃng X¹ Thñ for Hero to 5
            • Unit - Set level of .Kü N¨ng TÂÃng Ph¸p S for Hero to 5
            • Unit - Set level of .Kü N¨ng TÂÃng §Êu SÃœ for Hero to 5
            • Unit - Set level of .Kü N¨ng TÂÃng Tu SÃœ for Hero to 5
            • Unit - Set level of .Kü N¨ng TÂÃng Ná Thñ for Hero to 5
            • Unit - Set level of .Kü N¨ng TÂÃng Th¸nh HiÖp SÃœ for Hero to 5
            • Unit - Set level of .Kü N¨ng TÂÃng Sø Gi¶ Rõng Xanh for Hero to 5
            • Unit - Set level of .Kü N¨ng TÂÃng TriÖu HÃ¥i S for Hero to 4
              • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Unit-type of Hero) Equal to (==) TriÖu HÃ¥i SÂ
                • Then - Actions
                  • Unit - Add Call of the Damned to Hero
                • Else - Actions
          • Else - Actions
            • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
              • If - Conditions
                • (Hero level of Hero) Greater than or equal to (>=) 40
              • Then - Actions
                • Unit - Set level of .Kü N¨ng TÂÃng Chien Binh for Hero to 4
                • Unit - Set level of .Kü N¨ng TÂÃng Cung Thñ for Hero to 4
                • Unit - Set level of .Kü N¨ng TÂÃng Phï Thñy for Hero to 4
                • Unit - Set level of .Kü N¨ng TÂÃng S¸t Thñ for Hero to 4
                • Unit - Set level of .Kü N¨ng TÂÃng X¹ Thñ for Hero to 4
                • Unit - Set level of .Kü N¨ng TÂÃng Ph¸p S for Hero to 4
                • Unit - Set level of .Kü N¨ng TÂÃng §Êu SÃœ for Hero to 4
                • Unit - Set level of .Kü N¨ng TÂÃng Tu SÃœ for Hero to 4
                • Unit - Set level of .Kü N¨ng TÂÃng Ná Thñ for Hero to 4
                • Unit - Set level of .Kü N¨ng TÂÃng TriÖu HÃ¥i S for Hero to 4
                • Unit - Set level of .Kü N¨ng TÂÃng Th¸nh HiÖp SÃœ for Hero to 4
                • Unit - Set level of .Kü N¨ng TÂÃng Sø Gi¶ Rõng Xanh for Hero to 4
              • Else - Actions
                • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
                  • If - Conditions
                    • (Hero level of Hero) Greater than or equal to (>=) 25
                  • Then - Actions
                    • Unit - Set level of .Kü N¨ng TÂÃng Chien Binh for Hero to 3
                    • Unit - Set level of .Kü N¨ng TÂÃng Cung Thñ for Hero to 3
                    • Unit - Set level of .Kü N¨ng TÂÃng Phï Thñy for Hero to 3
                    • Unit - Set level of .Kü N¨ng TÂÃng S¸t Thñ for Hero to 3
                    • Unit - Set level of .Kü N¨ng TÂÃng X¹ Thñ for Hero to 3
                    • Unit - Set level of .Kü N¨ng TÂÃng Ph¸p S for Hero to 3
                    • Unit - Set level of .Kü N¨ng TÂÃng §Êu SÃœ for Hero to 3
                    • Unit - Set level of .Kü N¨ng TÂÃng Tu SÃœ for Hero to 3
                    • Unit - Set level of .Kü N¨ng TÂÃng Ná Thñ for Hero to 3
                    • Unit - Set level of .Kü N¨ng TÂÃng TriÖu HÃ¥i S for Hero to 3
                    • Unit - Set level of .Kü N¨ng TÂÃng Th¸nh HiÖp SÃœ for Hero to 3
                    • Unit - Set level of .Kü N¨ng TÂÃng Sø Gi¶ Rõng Xanh for Hero to 3
                  • Else - Actions
                    • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
                      • If - Conditions
                        • (Hero level of Hero) Greater than or equal to (>=) 10
                      • Then - Actions
                        • Unit - Set level of .Kü N¨ng TÂÃng Chien Binh for Hero to 2
                        • Unit - Set level of .Kü N¨ng TÂÃng Cung Thñ for Hero to 2
                        • Unit - Set level of .Kü N¨ng TÂÃng Phï Thñy for Hero to 2
                        • Unit - Set level of .Kü N¨ng TÂÃng S¸t Thñ for Hero to 2
                        • Unit - Set level of .Kü N¨ng TÂÃng X¹ Thñ for Hero to 2
                        • Unit - Set level of .Kü N¨ng TÂÃng Ph¸p S for Hero to 2
                        • Unit - Set level of .Kü N¨ng TÂÃng §Êu SÃœ for Hero to 2
                        • Unit - Set level of .Kü N¨ng TÂÃng Tu SÃœ for Hero to 2
                        • Unit - Set level of .Kü N¨ng TÂÃng Ná Thñ for Hero to 2
                        • Unit - Set level of .Kü N¨ng TÂÃng TriÖu HÃ¥i S for Hero to 2
                        • Unit - Set level of .Kü N¨ng TÂÃng Th¸nh HiÖp SÃœ for Hero to 2
                        • Unit - Set level of .Kü N¨ng TÂÃng Sø Gi¶ Rõng Xanh for Hero to 2
                      • Else - Actions
        • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • (Hero level of Hero) Greater than or equal to (>=) 15
            • ((Owner of Hero) is in MBHP_Group1) Equal to (==) False
          • Then - Actions
            • Unit - Add .B¨ng Phong Tr¶m to Game_Summon[SaveLoad_Index]
            • Player Group - Add (Owner of Hero) to MBHP_Group1
          • Else - Actions
        • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • (Hero level of Hero) Greater than or equal to (>=) 35
            • ((Owner of Hero) is in MBHP_Group2) Equal to (==) False
          • Then - Actions
            • Unit - Add .B¨ng Phong Hé Ph¸p to Game_Summon[SaveLoad_Index]
            • Player Group - Add (Owner of (Triggering unit)) to MBHP_Group2
          • Else - Actions
        • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • (Hero level of Hero) Greater than or equal to (>=) 65
            • ((Owner of Hero) is in PSBT_Group1) Equal to (==) False
          • Then - Actions
            • Unit - Add .TËn ThÕ to Game_Summon2[SaveLoad_Index]
            • Player Group - Add (Triggering player) to PSBT_Group1
          • Else - Actions
        • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • (Hero level of Hero) Greater than or equal to (>=) 85
            • ((Triggering player) is in PSBT_Group2) Equal to (==) False
          • Then - Actions
            • Unit - Add .Søc M¹nh Tèi ThÂîng to Game_Summon2[SaveLoad_Index]
            • Player Group - Add (Triggering player) to PSBT_Group2
          • Else - Actions
      • Set LoadCount = (LoadCount + 1)
      • Hero - Modify Strength of Hero: Set to Load[LoadCount]
      • Hero - Modify Strength of Game_Summon[SaveLoad_Index]: Set to Load[LoadCount]
      • Hero - Modify Strength of Game_Summon2[SaveLoad_Index]: Set to Load[LoadCount]
      • Set LoadCount = (LoadCount + 1)
      • Hero - Modify Agility of Hero: Set to Load[LoadCount]
      • Set LoadCount = (LoadCount + 1)
      • Hero - Modify Intelligence of Hero: Set to Load[LoadCount]
      • Hero - Modify Intelligence of Game_Summon[SaveLoad_Index]: Set to Load[LoadCount]
      • Hero - Modify Intelligence of Game_Summon2[SaveLoad_Index]: Set to Load[LoadCount]
      • Set LoadCount = (LoadCount + 1)
      • Player - Set (Triggering player) Current gold to Load[LoadCount]
      • Set LoadCount = (LoadCount + 1)
      • Player - Set (Triggering player) Current lumber to Load[LoadCount]
      • Set LoadCount = (LoadCount + 1)
      • Player - Set (Triggering player) Food used to Load[LoadCount]
      • Set LoadCount = (LoadCount + 1)
      • Set Hero_ItemExp[(Player number of (Triggering player))] = Load[LoadCount]
      • Set LoadCount = (LoadCount + 1)
      • Hero - Create SaveLoad_Item[Load[LoadCount]] and give it to Hero
      • Item - Set the custom value of (Last created item) to SaveLoad_Index
      • Set LoadCount = (LoadCount + 1)
      • Hero - Create SaveLoad_Item[Load[LoadCount]] and give it to Hero
      • Item - Set the custom value of (Last created item) to SaveLoad_Index
      • Set LoadCount = (LoadCount + 1)
      • Hero - Create SaveLoad_Item[Load[LoadCount]] and give it to Hero
      • Item - Set the custom value of (Last created item) to SaveLoad_Index
      • Set LoadCount = (LoadCount + 1)
      • Hero - Create SaveLoad_Item[Load[LoadCount]] and give it to Hero
      • Item - Set the custom value of (Last created item) to SaveLoad_Index
      • Set LoadCount = (LoadCount + 1)
      • Hero - Create SaveLoad_Item[Load[LoadCount]] and give it to Hero
      • Item - Set the custom value of (Last created item) to SaveLoad_Index
      • Set LoadCount = (LoadCount + 1)
      • Hero - Create SaveLoad_Item[Load[LoadCount]] and give it to Hero
      • Item - Set the custom value of (Last created item) to SaveLoad_Index
      • Set LoadCount = (LoadCount + 1)
      • Hero - Create SaveLoad_Item[Load[LoadCount]] and give it to Game_Carrier[SaveLoad_Index]
      • Item - Set the custom value of (Last created item) to SaveLoad_Index
      • Set LoadCount = (LoadCount + 1)
      • Hero - Create SaveLoad_Item[Load[LoadCount]] and give it to Game_Carrier[SaveLoad_Index]
      • Item - Set the custom value of (Last created item) to SaveLoad_Index
      • Set LoadCount = (LoadCount + 1)
      • Hero - Create SaveLoad_Item[Load[LoadCount]] and give it to Game_Carrier[SaveLoad_Index]
      • Item - Set the custom value of (Last created item) to SaveLoad_Index
      • Set LoadCount = (LoadCount + 1)
      • Hero - Create SaveLoad_Item[Load[LoadCount]] and give it to Game_Carrier[SaveLoad_Index]
      • Item - Set the custom value of (Last created item) to SaveLoad_Index
      • Set LoadCount = (LoadCount + 1)
      • Hero - Create SaveLoad_Item[Load[LoadCount]] and give it to Game_Carrier[SaveLoad_Index]
      • Item - Set the custom value of (Last created item) to SaveLoad_Index
      • Set LoadCount = (LoadCount + 1)
      • Hero - Create SaveLoad_Item[Load[LoadCount]] and give it to Game_Carrier[SaveLoad_Index]
      • Item - Set the custom value of (Last created item) to SaveLoad_Index
      • Trigger - Add to Heroes Level Up <gen> the event (Unit - Hero Gains a level)
      • Custom script: call RemoveLocation(udg_SaveLoad_Point)
.... That was the trigger @@.

Tks u.
 
Level 8
Joined
Jan 28, 2016
Messages
486
Hopefully I didn't miss anything but as far as I can tell, there aren't any leaks in those two triggers. It's probably causing some lag for a brief moment as it loads but nothing that should make the map unplayable.
 
Level 5
Joined
Sep 21, 2012
Messages
68
Hopefully I didn't miss anything but as far as I can tell, there aren't any leaks in those two triggers. It's probably causing some lag for a brief moment as it loads but nothing that should make the map unplayable.
The map still playable but it generated wrong code like what I've mentioned in the #8 post..... I'm still wondering why it generated wrong code. As far as I can tell, if I played the map for a long time like 1 hour then it will generate wrong code. In the next game still -load able but wrong stats......
 

Dr Super Good

Spell Reviewer
Level 63
Joined
Jan 18, 2005
Messages
27,192
Debug the save/load system by printing a list to the player, say over 10 seconds, of what is being saved. If when he loads it is different then something breaks with the save/load system. It could be that another trigger is accidently changing player hero variables to other values and hence garbage gets correctly saved. If the code is too long then maybe the end of it is being truncated (there is a character limit on chat messages) which is resulting in garbage being loaded however I would imagine the system's checksum would fail in this case and throw an invalid code result for loading.
 
Level 5
Joined
Sep 21, 2012
Messages
68
What do I need to do now @@. All I do is just copy and paste so I don't know how to fix this problem....

Edit: By the way, can they affect the save/load system code?

  • Testing
    • Events
      • Unit - A unit enters (Entire map)
    • Conditions
      • Multiple ConditionsOr - Any (Conditions) are true
        • Conditions
          • (Unit-type of (Triggering unit)) Equal to (==) ChiÕn Binh
          • (Unit-type of (Triggering unit)) Equal to (==) Cung Thñ
          • (Unit-type of (Triggering unit)) Equal to (==) Häc Viªn
          • (Unit-type of (Triggering unit)) Equal to (==) Ná thñ
          • (Unit-type of (Triggering unit)) Equal to (==) Ph¸p SÂ
          • (Unit-type of (Triggering unit)) Equal to (==) Phï Thñy
          • (Unit-type of (Triggering unit)) Equal to (==) S¸t Thñ
          • (Unit-type of (Triggering unit)) Equal to (==) TriÖu HÃ¥i SÂ
          • (Unit-type of (Triggering unit)) Equal to (==) Tu SÃœ
          • (Unit-type of (Triggering unit)) Equal to (==) X¹ Thñ
          • (Unit-type of (Triggering unit)) Equal to (==) §Êu SÃœ
          • (Unit-type of (Triggering unit)) Equal to (==) Th¸nh HiÖp SÃœ
          • (Unit-type of (Triggering unit)) Equal to (==) Sø Gi¶ Rõng Xanh
    • Actions
      • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Triggering unit) is in Game_Group) Equal to (==) False
        • Then - Actions
          • Unit Group - Add (Triggering unit) to Game_Group
        • Else - Actions
  • Testing 2
    • Events
      • Unit - A unit enters (Entire map)
    • Conditions
      • Multiple ConditionsOr - Any (Conditions) are true
        • Conditions
          • (Unit-type of (Triggering unit)) Equal to (==) X¹ Thñ
          • (Unit-type of (Triggering unit)) Equal to (==) HuyÕt Kþ
          • (Unit-type of (Triggering unit)) Equal to (==) NgÂêi C©y
          • (Unit-type of (Triggering unit)) Equal to (==) Sãi
          • (Unit-type of (Triggering unit)) Equal to (==) Chim ¦ng
    • Actions
      • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Unit-type of (Triggering unit)) Equal to (==) X¹ Thñ
        • Then - Actions
          • Set Game_Summon_XaThu[(Player number of (Owner of (Triggering unit)))] = (Triggering unit)
        • Else - Actions
      • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Unit-type of (Triggering unit)) Equal to (==) HuyÕt Kþ
        • Then - Actions
          • Set Game_Summon_HuyetKy[(Player number of (Owner of (Triggering unit)))] = (Triggering unit)
        • Else - Actions
      • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Unit-type of (Triggering unit)) Equal to (==) NgÂêi C©y
        • Then - Actions
          • Set Game_Summon_NguoiCay[(Player number of (Owner of (Triggering unit)))] = (Triggering unit)
        • Else - Actions
      • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Unit-type of (Triggering unit)) Equal to (==) Sãi
        • Then - Actions
          • Set Game_Summon_Soi[(Player number of (Owner of (Triggering unit)))] = (Triggering unit)
        • Else - Actions
      • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Unit-type of (Triggering unit)) Equal to (==) Chim ¦ng
        • Then - Actions
          • Set Game_Summon_ChimUng[(Player number of (Owner of (Triggering unit)))] = (Triggering unit)
        • Else - Actions
 
Last edited:

Dr Super Good

Spell Reviewer
Level 63
Joined
Jan 18, 2005
Messages
27,192
When saving, print out the values being saved in a human readable string. This makes sure the save code is being generated correctly. When loading then print out the loaded values in a human readable string, this will tell you if the values are being loaded properly. The human readable string produced by saving should match the one produced by loading. If they do not match then one might be able to see where it is going wrong. If everything is wrong then maybe the save code is too long to enter into chat.

Such a human readable string might be as simple as comma separated values for every stored entry in the code.
 
Status
Not open for further replies.
Top