• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

I want a system that save unit and item (not hero)

Status
Not open for further replies.
Level 7
Joined
Jul 12, 2017
Messages
139
Hi, I want to find a system/trigger that save unit with an item that use stack as player progression (when player finish 1 quest, stack will be added to the item in that unit)

I tried to use codeless save/load but it doesn't save the unit with an item so I don't know what to do.

Thanks in advance.
 

Uncle

Warcraft Moderator
Level 70
Joined
Aug 10, 2018
Messages
7,389
TriggerHappy's Codeless save/load system can do anything you want it to do. It saves Integers, which can be used to represent anything.

You just need to understand how to order things properly so that when you load your saved Item charges you apply them to the correct items.

Saving a Unit is even easier than saving a Hero since it doesn't have as many properties to track.
  • Set Variable SaveUnits[1] = Footman
  • Set Variable SaveUnits[2] = Knight
  • Set Variable SaveUnits[3] = Rifleman

So if your Unit is a Knight then you would Save the value 2. Then when you Load that value you simply create the unit using that value as the [Index]:
  • Unit - Create 1 SaveUnits[Loaded value]

I attached a map with a simplified example of the system that can autosave/autoload.
 

Attachments

  • Save and Load Example.w3x
    149.3 KB · Views: 11
Last edited:
Level 7
Joined
Jul 12, 2017
Messages
139
Now I kinda understand about unit but to load an item charge though, what variable or trigger should I use?

I also want to load an item with a charge (progress) that is on the hero, but that hero need to be deleted so how can I keep only the item&charge. Like put this item&charge back once player select the same hero but if they select other hero, they won't get the item but the charge (progress) is still there.

Am I making it confusing?
 

Uncle

Warcraft Moderator
Level 70
Joined
Aug 10, 2018
Messages
7,389
You're only able to Save/Load Integers. What you do is use those Integers to represent different things.

Conveniently, Item Charges are already Integers so that keeps it simple.

For example:
  • Set VariableSet SaveCount = (SaveCount + 1)
  • Set VariableSet SaveValue[SaveCount] = (Charges remaining in PlayerItem[(Player number of SaveLoadEvent_Player)])
  • Set VariableSet SaveMaxValue[SaveCount] = 99999
We've now saved the Number of charges in the player's item. When you load this value you can do whatever you want with it. If your player hasn't chosen a Hero/Item yet, you could keep track of this value in a variable so it's ready to be used later on.
 

Attachments

  • Save and Load Example 2.w3x
    151.4 KB · Views: 12
Level 7
Joined
Jul 12, 2017
Messages
139
You're only able to Save/Load Integers. What you do is use those Integers to represent different things.

Conveniently, Item Charges are already Integers so that keeps it simple.

For example:
  • Set VariableSet SaveCount = (SaveCount + 1)
  • Set VariableSet SaveValue[SaveCount] = (Charges remaining in PlayerItem[(Player number of SaveLoadEvent_Player)])
  • Set VariableSet SaveMaxValue[SaveCount] = 99999
We've now saved the Number of charges in the player's item. When you load this value you can do whatever you want with it. If your player hasn't chosen a Hero/Item yet, you could keep track of this value in a variable so it's ready to be used later on.

The example you gave me is when the unit is already existed on the map but what about if I pick hero and spawn it later?

Also, I did this, on the left side is a player unit with an item in it while the right side is the trigger that I save those units.


1644852542101.png


I tried to run it but it doesn't save the stack in the unit on 2nd playthrough, do I need to play it in multiplayer or local for it to work or is there something missing? I copied this trigger of yours, changed a bit of value and unit and put it in but it doesn't seem to work though.

1644854741616.png
 

Uncle

Warcraft Moderator
Level 70
Joined
Aug 10, 2018
Messages
7,389
You Set the PlayerHero variable when the Player picks their Hero. You Set the PlayerItem variable when the Hero acquires their Item or when you first create the Item.

I didn't intend for you to copy my exact triggers, they were just examples I threw together to show you how the system works.

There can be issues with Saving/Loading multiple times in the same game if I recall correctly. Probably just loading, I forget.

Also, remember to Load data in the reverse order of how you Saved it.

 
Last edited:
Level 7
Joined
Jul 12, 2017
Messages
139
You Set the PlayerHero variable when the Player picks their Hero. You Set the PlayerItem variable when the Hero acquires their Item or when you first create the Item.

I didn't intend for you to copy my exact triggers, they were just examples I threw together to show you how the system works.

There can be issues with Saving/Loading multiple times in the same game if I recall correctly. Probably just loading, I forget.

Also, remember to Load data in the reverse order of how you Saved it.


I have tried to follow what you told me but it still doesn't work. I think it's my own fault for not getting it though

I want to save the item called player experience in Player Experience (unit) near hero selection area by adding stack when player completing certain stuffs.


here's my trigger
  • 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 13 (Maroon) types a chat message containing -save as An exact match
      • Player - Player 14 (Navy) types a chat message containing -save as An exact match
    • Conditions
      • SaveUseGUI Equal to True
      • (SavePlayerHero[((Player number of (Triggering player)) - 1)] is A Hero) Equal to True
    • Actions
      • -------- ------------------- --------
      • -------- 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 --------
      • Set VariableSet SaveCount = (SaveCount + 1)
      • Set VariableSet SaveValue[SaveCount] = (Charges remaining in PlayerItem[(Player number of SaveLoadEvent_Player)])
      • Set VariableSet SaveMaxValue[SaveCount] = 99999
      • -------- ------------------- --------
      • For each (Integer SaveTempInt) from 0 to 5, do (Actions)
        • Loop - Actions
          • Set VariableSet SaveCount = (SaveCount + 1)
          • Custom script: set udg_SaveValue[udg_SaveCount] = SaveHelper.ConvertItemId(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] = 999
      • -------- ------------------- --------
      • Set VariableSet SaveCount = (SaveCount + 1)
      • Set VariableSet SaveValue[SaveCount] = (Agility of SaveTempUnit (Exclude bonuses))
      • Set VariableSet SaveMaxValue[SaveCount] = 999
      • -------- ------------------- --------
      • Set VariableSet SaveCount = (SaveCount + 1)
      • Set VariableSet SaveValue[SaveCount] = (Intelligence of SaveTempUnit (Exclude bonuses))
      • Set VariableSet SaveMaxValue[SaveCount] = 999
      • -------- ------------------- --------
      • -------- Save Experience (%) and Level --------
      • -------- ------------------- --------
      • Set VariableSet SaveCount = (SaveCount + 1)
      • Custom script: set udg_SaveValue[udg_SaveCount] = R2I( (GetHeroXP(udg_SaveTempUnit)) / SaveHelper.GetLevelXP(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] = 100
      • -------- ------------------- --------
      • -------- Save Hero Name --------
      • -------- ------------------- --------
      • Set VariableSet SaveCount = (SaveCount + 1)
      • Custom script: set udg_SaveValue[udg_SaveCount] = SaveHelper.GetHeroNameID(GetHeroProperName(udg_SaveTempUnit))
      • Set VariableSet SaveMaxValue[SaveCount] = SaveNameMax
      • -------- ------------------- --------
      • -------- Save Unit Type --------
      • -------- ------------------- --------
      • Set VariableSet SaveCount = (SaveCount + 1)
      • Custom script: set udg_SaveValue[udg_SaveCount] = SaveHelper.ConvertUnitId(GetUnitTypeId(udg_SaveTempUnit))
      • Set VariableSet SaveMaxValue[SaveCount] = SaveUnitTypeMax
      • -------- ------------------- --------
      • -------- Save to disk --------
      • -------- ------------------- --------
      • Custom script: set udg_SaveTempInt = Savecode.create()
      • For each (Integer A) from 0 to SaveCount, do (Actions)
        • Loop - Actions
          • Custom script: call Savecode(udg_SaveTempInt).Encode(udg_SaveValue[bj_forLoopAIndex], udg_SaveMaxValue[bj_forLoopAIndex])
      • Set VariableSet SaveTempString = <Empty String>
      • Custom script: set udg_SaveTempString = Savecode(udg_SaveTempInt).Save(GetTriggerPlayer(), 1)
      • Custom script: call SaveFile.create(GetTriggerPlayer(), SaveHelper.GetUnitTitle(udg_SaveTempUnit), -1, udg_SaveTempString)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • SaveShowCode Equal to True
        • Then - Actions
          • Custom script: set udg_SaveCodeColored = Savecode_colorize(udg_SaveTempString)
          • Game - Display to (All players) the text: SaveCodeColored
        • Else - Actions
and here's load trigger

  • Load GUI
    • Events
      • Game - SaveLoadEvent becomes Equal to 1.00
    • Conditions
      • SaveUseGUI Equal to True
    • Actions
      • Set VariableSet SaveCount = 0
      • -------- ------------------- --------
      • -------- 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!")
      • Unit - Remove SavePlayerHero[((Player number of SaveLoadEvent_Player) - 1)] from the game
      • -------- ------------------- --------
      • -------- Load Hero --------
      • -------- ------------------- --------
      • Set VariableSet SaveMaxValue[SaveCount] = SaveUnitTypeMax
      • Custom script: call SaveHelper.GUILoadNext()
      • -------- ------------------- --------
      • Unit - Create 1 SaveUnitType[SaveValue[SaveCount]] for SaveLoadEvent_Player at (Center of Region 040 <gen>) 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 Hero Name --------
      • -------- ------------------- --------
      • Set VariableSet SaveCount = (SaveCount + 1)
      • Set VariableSet SaveMaxValue[SaveCount] = SaveNameMax
      • Custom script: call SaveHelper.GUILoadNext()
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (SaveUnitType[SaveValue[(SaveCount - 1)]] is A Hero) Equal to True
          • SaveHeroName Equal to True
        • Then - Actions
          • Custom script: set udg_SaveTempString = SaveHelper.GetHeroNameFromID(udg_SaveValue[udg_SaveCount])
          • Custom script: call BlzSetHeroProperName(udg_SaveTempUnit, udg_SaveTempString)
        • Else - Actions
      • -------- ------------------- --------
      • -------- Load Experience and Level --------
      • -------- ------------------- --------
      • Set VariableSet SaveCount = (SaveCount + 1)
      • Set VariableSet SaveMaxValue[SaveCount] = 100
      • Custom script: call SaveHelper.GUILoadNext()
      • Set VariableSet SaveCount = (SaveCount + 1)
      • Set VariableSet SaveMaxValue[SaveCount] = 100
      • Custom script: call SaveHelper.GUILoadNext()
      • -------- ------------------- --------
      • Custom script: set udg_SaveTempReal = SaveHelper.GetLevelXP(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] = 999
      • Custom script: call SaveHelper.GUILoadNext()
      • Hero - Modify Intelligence of SaveTempUnit: Set to SaveValue[SaveCount].
      • -------- ------------------- --------
      • Set VariableSet SaveCount = (SaveCount + 1)
      • Set VariableSet SaveMaxValue[SaveCount] = 999
      • Custom script: call SaveHelper.GUILoadNext()
      • Hero - Modify Agility of SaveTempUnit: Set to SaveValue[SaveCount].
      • -------- ------------------- --------
      • Set VariableSet SaveCount = (SaveCount + 1)
      • Set VariableSet SaveMaxValue[SaveCount] = 999
      • Custom script: call SaveHelper.GUILoadNext()
      • Hero - Modify Strength of SaveTempUnit: Set to SaveValue[SaveCount].
      • -------- ------------------- --------
      • -------- Load Items --------
      • Set VariableSet SaveCount = (SaveCount + 1)
      • Set VariableSet SaveMaxValue[SaveCount] = 99999
      • Custom script: call SaveHelper.GUILoadNext()
      • Set VariableSet PlayerCharges[(Player number of SaveLoadEvent_Player)] = SaveValue[SaveCount]
      • -------- --------
      • Set VariableSet SaveCount = (SaveCount + 1)
      • Set VariableSet SaveMaxValue[SaveCount] = 99999
      • Custom script: call SaveHelper.GUILoadNext()
      • Set VariableSet UnitGroup1 = (Units owned by SaveLoadEvent_Player of type Player Experience (Progress))
      • Unit Group - Pick every unit in UnitGroup1 and do (Actions)
        • Loop - Actions
          • Unit - Remove (Picked unit) from the game
      • Custom script: call DestroyGroup(udg_UnitGroup1)
      • Unit - Create 1 HeroTypes[SaveValue[SaveCount]] for SaveLoadEvent_Player at (Center of Region 040 <gen>) facing Default building facing degrees
      • Set VariableSet PlayerHero[(Player number of SaveLoadEvent_Player)] = (Last created unit)
      • Hero - Create Player Experience and give it to PlayerHero[(Player number of SaveLoadEvent_Player)]
      • Set VariableSet PlayerItem[(Player number of SaveLoadEvent_Player)] = (Last created item)
      • Item - Set charges remaining in (Last created item) to PlayerCharges[(Player number of SaveLoadEvent_Player)]
      • -------- ------------------- --------
      • 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 SaveHelper.GUILoadNext()
          • 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 SaveHelper.GUILoadNext()
      • 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 SaveHelper.GUILoadNext()
      • 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 SaveHelper.GUILoadNext()
          • Unit - Add SaveAbilityType[SaveValue[SaveCount]] to SaveTempUnit
          • Set VariableSet SaveCount = (SaveCount + 1)
          • Set VariableSet SaveMaxValue[SaveCount] = 10
          • Custom script: call SaveHelper.GUILoadNext()
          • Unit - Set level of SaveAbilityType[SaveValue[(SaveCount - 1)]] for SaveTempUnit to SaveValue[SaveCount]
      • Custom script: call Savecode(udg_SaveTempInt).destroy()

and if you don't get the full picture, here's my map.

I know it's really bad of me but if you could, would it be possible to do it for me? Just saving the player experience [item] stack in Player Experience and that's it but if not then pls tell me what I'm still missing. The trigger is on top called codeless save and load.

I'm very sorry for the late reply but I've done what I can with this unfamiliar stuff I have never touched, sad.
 

Attachments

  • Azeroth Heroes Survival 2.8.w3x
    21 MB · Views: 16

Uncle

Warcraft Moderator
Level 70
Joined
Aug 10, 2018
Messages
7,389
To be honest, I'm not even sure what I'm doing so should I delete that line?
No, just remove the - 1 arithmetic from it.

Understand that Player 1 (red) has the Player Number 1, Player 2 (blue) has the Player Number 2, and this pattern continues for each player. It's a pretty simple concept, their number is self evident.

You're using this Player Number in the [Index] of your Arrays in order to save data for specified players. This is one of the many ways of keeping track of things for each player and it works great.

However, subtracting 1 from the Player Number serves little to no purpose here. Why use SavePlayerHero[0] (1 - 1 = 0) when you can just use SavePlayerHero[1]. Don't get me wrong, it's perfectly fine to use Index [0] but in this case it's just unnecessary. There's no reason to give yourself more work if you don't have to.


Also, I'd rename the variable to PlayerHero since you'll most likely want to be using this throughout all of your triggers. You should ask yourself, what does each Player have in common that I need to keep track of, and create Variable arrays for each of those things.

For example (X = Player Number):
PlayerHero[X] = This Unit array contains each player's hero
PlayerLives[X] = This Integer array keeps track of how many lives a player has
PlayerCanRepick[X] = This Boolean array determines whether a player can repick or not (true/false)

Obviously your map may not have a Lives system or a Repicking system but this is just an example. All of this information can be tracked using Arrays + Player Number. The goal is to have a design where if you have access to a Hero you can get all of that hero's Player related variables and if you have access to a Player you can get access to their Hero and all of their Unit related variables. Combine this with Unit Groups/Player Groups and you'll be able to easily manipulate your Players/Heroes at any given time in any given trigger.

With all of that in mind, I don't think you should bother tackling a save system until you've got the fundamentals down for tracking data in Variables and working with Arrays. Otherwise, you'll be skipping over an important step that is integral to understanding the save system and basically any advanced triggers.
 
Last edited:
Level 7
Joined
Jul 12, 2017
Messages
139
No, just remove the - 1 arithmetic from it.

Understand that Player 1 (red) has the Player Number 1, Player 2 (blue) has the Player Number 2, and this pattern continues for each player. It's a pretty simple concept, their number is self evident.

You're using this Player Number in the [Index] of your Arrays in order to save data for specified players. This is one of the many ways of keeping track of things for each player and it works great.

However, subtracting 1 from the Player Number serves little to no purpose here. Why use SavePlayerHero[0] (1 - 1 = 0) when you can just use SavePlayerHero[1]. Don't get me wrong, it's perfectly fine to use Index [0] but in this case it's just unnecessary. There's no reason to give yourself more work if you don't have to.


Also, I'd rename the variable to PlayerHero since you'll most likely want to be using this throughout all of your triggers. You should ask yourself, what does each Player have in common that I need to keep track of, and create Variable arrays for each of those things.

For example (X = Player Number):
PlayerHero[X] = This Unit array contains each player's hero
PlayerLives[X] = This Integer array keeps track of how many lives a player has
PlayerCanRepick[X] = This Boolean array determines whether a player can repick or not (true/false)

Obviously your map may not have a Lives system or a Repicking system but this is just an example. All of this information can be tracked using Arrays + Player Number. The goal is to have a design where if you have access to a Hero you can get all of that hero's Player related variables and if you have access to a Player you can get access to their Hero and all of their Unit related variables. Combine this with Unit Groups/Player Groups and you'll be able to easily manipulate your Players/Heroes at any given time in any given trigger.

With all of that in mind, I don't think you should bother tackling a save system until you've got the fundamentals down for tracking data in Variables and working with Arrays. Otherwise, you'll be skipping over an important step that is integral to understanding the save system and basically any advanced triggers.

1. The -1 comes from the save/load system itself when I import it. The only things I've touched were adding item to the save/load GUI trigger, changing a bit of name here and there but I swear I didn't touch anything big.

2. My map does have repick system (or more like command to remove a hero to pick a new one, obviously you didn't check it). I haven't touched map for a while but I think I do have an array + player number that is randoming hero and tracking their abilities to some extent.

3. I really really really really want to add this system, the map is not new, it's like 4+ years old now. I'm just incapable of adding this since TriggerHappy description of this system is like, just put this trigger in the map and you just change it but there's no further info. All I want to do is to track this one item to the future game and that's it.

I just want to know how, like straight to the point where I change stuffs to make it work, no need for explaination, I just want an answer, thank you for your time.
 

Uncle

Warcraft Moderator
Level 70
Joined
Aug 10, 2018
Messages
7,389
Ah, I see now. I forgot that was one of TriggerHappy's variables, I assumed you had imported the system from my Demo map in which case most of those variables don't exist anymore.

2. My main point here is that you can tie your own variables into the save/load triggers. Like if you want to save each player's hero + item, you should have variables tracking those things already, no need to create new "Save" variables for them.

3. I can't open your map unfortunately, it seems to stop responding while loading the models. I think your triggers are on the right track, maybe just fix that -1 thing and try it. Or better yet, try to save/load JUST the Item for example. If you can save/load the Item then you can work your way up from there. Also, remember to give Aerial Shackles 2 levels and adjust it's tooltip properly, you can see an example in both demo maps.
 
Level 7
Joined
Jul 12, 2017
Messages
139
Ah, I see now. I forgot that was one of TriggerHappy's variables, I assumed you had imported the system from my Demo map in which case most of those variables don't exist anymore.

2. My main point here is that you can tie your own variables into the save/load triggers. Like if you want to save each player's hero + item, you should have variables tracking those things already, no need to create new "Save" variables for them.

3. I can't open your map unfortunately, it seems to stop responding while loading the models. I think your triggers are on the right track, maybe just fix that -1 thing and try it. Or better yet, try to save/load JUST the Item for example. If you can save/load the Item then you can work your way up from there. Also, remember to give Aerial Shackles 2 levels and adjust it's tooltip properly, you can see an example in both demo maps.

The map takes like 15 mins to load normally, it will be opened sure enough just give it time since it has a lot of custom models.

I just want to know where and how to save the item so that it track to another game?
 
Level 7
Joined
Jul 12, 2017
Messages
139
I showed you how to save/load an item already. You can literally copy and paste the triggers.

I'm giving you solutions but if you don't try them out then I can't help you. Read what I just said in #3.
You mean in #4 right? I did try them out but it doesn't work. It said to enable local file and how do I do that?

Also, I forgot to ask. The above trigger is for save right? what about load?

  • Load GUI
    • Events
      • Game - SaveLoadEvent becomes Equal to 1.00
    • Conditions
      • SaveUseGUI Equal to True
    • Actions
      • Set VariableSet SaveCount = 0
      • -------- ------------------- --------
      • -------- 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!")
      • Unit - Remove SavePlayerHero[((Player number of SaveLoadEvent_Player) - 1)] from the game
      • -------- ------------------- --------
      • -------- Load Hero --------
      • -------- ------------------- --------
      • Set VariableSet SaveMaxValue[SaveCount] = SaveUnitTypeMax
      • Custom script: call SaveHelper.GUILoadNext()
      • -------- ------------------- --------
      • Unit - Create 1 SaveUnitType[SaveValue[SaveCount]] for SaveLoadEvent_Player at (Center of Region 040 <gen>) 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 Hero Name --------
      • -------- ------------------- --------
      • Set VariableSet SaveCount = (SaveCount + 1)
      • Set VariableSet SaveMaxValue[SaveCount] = SaveNameMax
      • Custom script: call SaveHelper.GUILoadNext()
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (SaveUnitType[SaveValue[(SaveCount - 1)]] is A Hero) Equal to True
          • SaveHeroName Equal to True
        • Then - Actions
          • Custom script: set udg_SaveTempString = SaveHelper.GetHeroNameFromID(udg_SaveValue[udg_SaveCount])
          • Custom script: call BlzSetHeroProperName(udg_SaveTempUnit, udg_SaveTempString)
        • Else - Actions
      • -------- ------------------- --------
      • -------- Load Experience and Level --------
      • -------- ------------------- --------
      • Set VariableSet SaveCount = (SaveCount + 1)
      • Set VariableSet SaveMaxValue[SaveCount] = 100
      • Custom script: call SaveHelper.GUILoadNext()
      • Set VariableSet SaveCount = (SaveCount + 1)
      • Set VariableSet SaveMaxValue[SaveCount] = 100
      • Custom script: call SaveHelper.GUILoadNext()
      • -------- ------------------- --------
      • Custom script: set udg_SaveTempReal = SaveHelper.GetLevelXP(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] = 999
      • Custom script: call SaveHelper.GUILoadNext()
      • Hero - Modify Intelligence of SaveTempUnit: Set to SaveValue[SaveCount].
      • -------- ------------------- --------
      • Set VariableSet SaveCount = (SaveCount + 1)
      • Set VariableSet SaveMaxValue[SaveCount] = 999
      • Custom script: call SaveHelper.GUILoadNext()
      • Hero - Modify Agility of SaveTempUnit: Set to SaveValue[SaveCount].
      • -------- ------------------- --------
      • Set VariableSet SaveCount = (SaveCount + 1)
      • Set VariableSet SaveMaxValue[SaveCount] = 999
      • Custom script: call SaveHelper.GUILoadNext()
      • Hero - Modify Strength of SaveTempUnit: Set to SaveValue[SaveCount].
      • -------- ------------------- --------
      • -------- Load Items --------
      • Set VariableSet SaveCount = (SaveCount + 1)
      • Set VariableSet SaveMaxValue[SaveCount] = 99999
      • Custom script: call SaveHelper.GUILoadNext()
      • Set VariableSet PlayerCharges[(Player number of SaveLoadEvent_Player)] = SaveValue[SaveCount]
      • -------- --------
      • Set VariableSet SaveCount = (SaveCount + 1)
      • Set VariableSet SaveMaxValue[SaveCount] = 99999
      • Custom script: call SaveHelper.GUILoadNext()
      • Set VariableSet UnitGroup1 = (Units owned by SaveLoadEvent_Player of type Player Experience (Progress))
      • Unit Group - Pick every unit in UnitGroup1 and do (Actions)
        • Loop - Actions
          • Unit - Remove (Picked unit) from the game
      • Custom script: call DestroyGroup(udg_UnitGroup1)
      • Unit - Create 1 HeroTypes[SaveValue[SaveCount]] for SaveLoadEvent_Player at (Center of Region 040 <gen>) facing Default building facing degrees
      • Set VariableSet PlayerHero[(Player number of SaveLoadEvent_Player)] = (Last created unit)
      • Hero - Create Player Experience and give it to PlayerHero[(Player number of SaveLoadEvent_Player)]
      • Set VariableSet PlayerItem[(Player number of SaveLoadEvent_Player)] = (Last created item)
      • Item - Set charges remaining in (Last created item) to PlayerCharges[(Player number of SaveLoadEvent_Player)]
      • -------- ------------------- --------
      • 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 SaveHelper.GUILoadNext()
          • 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 SaveHelper.GUILoadNext()
      • 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 SaveHelper.GUILoadNext()
      • 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 SaveHelper.GUILoadNext()
          • Unit - Add SaveAbilityType[SaveValue[SaveCount]] to SaveTempUnit
          • Set VariableSet SaveCount = (SaveCount + 1)
          • Set VariableSet SaveMaxValue[SaveCount] = 10
          • Custom script: call SaveHelper.GUILoadNext()
          • Unit - Set level of SaveAbilityType[SaveValue[(SaveCount - 1)]] for SaveTempUnit to SaveValue[SaveCount]
      • Custom script: call Savecode(udg_SaveTempInt).destroy()
Is it like this?
 
Last edited:
Status
Not open for further replies.
Top