I was wondering if anyone knew how to make aceharts save/load system save abilitys. This is what i am using in my map right now, it saves hero, hero level, stats, gold, items, and all i need it to save now is abilitys.
This is just the initialization
The save part
The load part
This is just the initialization
Trigger:
- SaveLoad Initialization All Copy
- Events
- Map initialization
- Conditions
- Actions
- -------- List of Heroes --------
- Set SaveLoad_Heroes[1] = Priest
- Set SaveLoad_Heroes[2] = Warrior
- Set SaveLoad_Heroes[3] = Sorcerer
- Set SaveLoad_Heroes[4] = Paladin
- -------- Number of Heroes --------
- Set SaveLoad_Heroes_LastIndex = 4
- -------- List of Items --------
- Set SaveLoad_Items[1] = Short Sword
- Set SaveLoad_Items[2] = |cff00EE00Smith Sword|r|n
- Set SaveLoad_Items[3] = Leather Armor
- Set SaveLoad_Items[4] = Wooden Shield
- Set SaveLoad_Items[5] = Chainmail
- -------- Number of Items --------
- Set SaveLoad_Items_LastIndex = 5
- -------- List of Abilities --------
- Set SaveLoad_Abilities[1] = Bash
- Set SaveLoad_Abilities[2] = Flame Strike
- Set SaveLoad_Abilities[3] = Phoenix
- Set SaveLoad_Abilities[4] = Siphon Mana
- -------- Number of Abilities --------
- Set SaveLoad_Abilities_LastIndex = 4
- -------- These three lines may be changed if needed --------
- Set SaveLoad_Alphabet = ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789
- Set SaveLoad_CaseSensitive = False
- Set SaveLoad_UsePlayername = True
- -------- Required: false --------
- Set SaveLoad_Initialized = False
- -------- Leave as is. Used to autocreate variables when copy & pasting to a new map --------
- Set Code = AceHart
- Set Save[1] = 0
- Set SaveCount = 1
- Set Validate = False
- Set SaveLoad_Compress[1] = 0
- Set SaveLoad_Uncompress[1] = 0
- Events
The save part
Trigger:
- SaveLoad Save All Copy
- Events
- Player - Player 1 (Red) types a chat message containing -save as An exact match
- Conditions
- Player - Player 1 (Red) types a chat message containing -save as An exact match
- Actions
- -------- Prepare the save array with this player's Hero --------
- Set SaveCount = 0
- Set UnitGroup = (Units owned by (Triggering player) matching (((Matching unit) is A Hero) Equal to True))
- Unit Group - Pick every unit in UnitGroup and do (Actions)
- Loop - Actions
- -------- Save the Hero --------
- Set SaveCount = (SaveCount + 1)
- Set TempUnit = (Picked unit)
- Custom script: set udg_Save[udg_SaveCount] = SaveLoad_Unit2Integer( udg_TempUnit )
- Game - Display to (Player group((Triggering player))) the text: (Save[1]= + (String(Save[SaveCount])))
- -------- Hero level --------
- Set SaveCount = (SaveCount + 1)
- Set Save[SaveCount] = (Hero experience of (Picked unit))
- -------- Hero Position X --------
- Set SaveCount = (SaveCount + 1)
- Set Save[SaveCount] = (Integer((X of (Position of (Picked unit)))))
- -------- Hero Position Y --------
- Set SaveCount = (SaveCount + 1)
- Set Save[SaveCount] = (Integer((Y of (Position of (Picked unit)))))
- -------- Player's Gold --------
- Set SaveCount = (SaveCount + 1)
- Set Save[SaveCount] = ((Triggering player) Current gold)
- -------- Save Profession Levels --------
- Set SaveCount = (SaveCount + 1)
- Set Save[SaveCount] = Fishing_Level[(Player number of (Triggering player))]
- -------- Savehero STR/AGI/WIS --------
- Set SaveCount = (SaveCount + 1)
- Set Save[SaveCount] = (Strength of (Picked unit) (Exclude bonuses))
- Game - Display to (Player group((Triggering player))) the text: (Strength: + (String(Save[SaveCount])))
- Set SaveCount = (SaveCount + 1)
- Set Save[SaveCount] = (Agility of (Picked unit) (Exclude bonuses))
- Game - Display to (Player group((Triggering player))) the text: (Agility: + (String(Save[SaveCount])))
- Set SaveCount = (SaveCount + 1)
- Set Save[SaveCount] = (Intelligence of (Picked unit) (Exclude bonuses))
- Game - Display to (Player group((Triggering player))) the text: (Wisdom: + (String(Save[SaveCount])))
- -------- How many items does he carry --------
- Set SaveCount = (SaveCount + 1)
- Set Save[SaveCount] = (Number of items carried by (Picked unit))
- -------- Add all items --------
- For each (Integer A) from 1 to 6, do (Actions)
- Loop - Actions
- If (All Conditions are True) then do (Then Actions) else do (Else Actions)
- If - Conditions
- ((Item carried by (Picked unit) in slot (Integer A)) is owned) Equal to True
- Then - Actions
- -------- The actual item --------
- Set SaveCount = (SaveCount + 1)
- Set TempItem = (Item carried by (Picked unit) in slot (Integer A))
- Custom script: set udg_Save[udg_SaveCount] = SaveLoad_Item2Integer( udg_TempItem )
- Game - Display to (Player group((Triggering player))) the text: (Item Saved: + (Name of TempItem))
- Else - Actions
- If - Conditions
- If (All Conditions are True) then do (Then Actions) else do (Else Actions)
- Loop - Actions
- Loop - Actions
- -------- Turn values into code --------
- Custom script: set udg_Code = SaveLoad_Encode()
- -------- Show code to player --------
- Quest - Display to (Player group((Triggering player))) the Secret message: Your code:
- Game - Display to (Player group((Triggering player))) for 160.00 seconds the text: Code
- Events
The load part
Trigger:
- SaveLoad Load All Copy
- Events
- Player - Player 1 (Red) types a chat message containing -load as A substring
- Conditions
- (Substring((Entered chat string), 1, 6)) Equal to (Matched chat string)
- (Length of (Entered chat string)) Greater than 6
- Player - Player 1 (Red) types a chat message containing -load as A substring
- Actions
- -------- Try to decode what was typed --------
- Set Code = (Substring((Entered chat string), 7, (Length of (Entered chat string))))
- Custom script: set udg_Validate = SaveLoad_Decode( udg_Code )
- If (All Conditions are True) then do (Then Actions) else do (Else Actions)
- If - Conditions
- Validate Equal to False
- Then - Actions
- -------- Invalid code --------
- Game - Display to (Player group((Triggering player))) the text: There's some error ...
- Skip remaining actions
- Else - Actions
- If - Conditions
- -------- It worked, let's do something with it --------
- Unit Group - Pick every unit in (Units owned by (Triggering player) matching (((Matching unit) is A Hero) Equal to True)) and do (Actions)
- Loop - Actions
- Unit - Remove (Picked unit) from the game
- Loop - Actions
- Set SaveCount = 1
- -------- Restore Hero --------
- Game - Display to (All players) the text: (String(Save[1]))
- Custom script: set udg_TempUnitType = SaveLoad_Integer2Unit(udg_Save[udg_SaveCount])
- Unit - Create 1 TempUnitType for (Triggering player) at ((Triggering player) start location) facing Default building facing degrees
- -------- Set Experience --------
- Set SaveCount = (SaveCount + 1)
- Hero - Set (Last created unit) experience to Save[SaveCount], Hide level-up graphics
- -------- Position --------
- Set SaveCount = (SaveCount + 1)
- Unit - Move (Last created unit) instantly to (Point((Real(Save[SaveCount])), (Real(Save[(SaveCount + 1)]))))
- Player - Set (Triggering player) Current lumber to 0
- Wait 0.02 seconds
- Unit - Move (Last created unit) instantly to (Center of Region 140 <gen>)
- Camera - Pan camera for (Owner of (Last created unit)) to (Center of Region 140 <gen>) over 0.00 seconds
- Set SaveCount = (SaveCount + 1)
- -------- Restore Gold --------
- Set SaveCount = (SaveCount + 1)
- Player - Set (Triggering player) Current gold to Save[SaveCount]
- Set SaveCount = (SaveCount + 1)
- -------- Restore Professions --------
- Set Fishing_Level[(Player number of (Triggering player))] = Save[SaveCount]
- Set SaveCount = (SaveCount + 1)
- -------- Set stats STR/AGI/INT --------
- Hero - Modify Strength of (Last created unit): Set to Save[SaveCount]
- Set SaveCount = (SaveCount + 1)
- Hero - Modify Agility of (Last created unit): Set to Save[SaveCount]
- Set SaveCount = (SaveCount + 1)
- Hero - Modify Intelligence of (Last created unit): Set to Save[SaveCount]
- Set SaveCount = (SaveCount + 1)
- -------- Recreate all items --------
- Set SaveCount = (SaveCount + 1)
- Custom script: set udg_TempItemType = SaveLoad_Integer2Item(udg_Save[udg_SaveCount])
- Hero - Create TempItemType and give it to (Last created unit)
- Set SaveCount = (SaveCount + 1)
- Custom script: set udg_TempItemType = SaveLoad_Integer2Item(udg_Save[udg_SaveCount])
- Hero - Create TempItemType and give it to (Last created unit)
- Set SaveCount = (SaveCount + 1)
- Custom script: set udg_TempItemType = SaveLoad_Integer2Item(udg_Save[udg_SaveCount])
- Hero - Create TempItemType and give it to (Last created unit)
- Set SaveCount = (SaveCount + 1)
- Custom script: set udg_TempItemType = SaveLoad_Integer2Item(udg_Save[udg_SaveCount])
- Hero - Create TempItemType and give it to (Last created unit)
- Set SaveCount = (SaveCount + 1)
- Custom script: set udg_TempItemType = SaveLoad_Integer2Item(udg_Save[udg_SaveCount])
- Hero - Create TempItemType and give it to (Last created unit)
- Set SaveCount = (SaveCount + 1)
- Custom script: set udg_TempItemType = SaveLoad_Integer2Item(udg_Save[udg_SaveCount])
- Hero - Create TempItemType and give it to (Last created unit)
- Events