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

Acehart's Save/Load need help

Status
Not open for further replies.

Vunjo

Hosted Project: SC
Level 14
Joined
Jul 1, 2010
Messages
1,340
I have used Acehart's Save/Load system. Everything works when I test my map, save then load. But when I test map, save the hero, then close it, open test map again and try to load, it saved only Hero, Level, Gold and Items. You should know, that I added variables to save Stats, and Level of Abilities. Cannot find the answer, I think that i should add something in Jass "code".
Again, without closing Wc3, every single thing works...
For Stats and Ability Levels, I made variable for each of that. I noticed that it uses other variables, but I tried a lot of things and it didn't work...

Please help me +REP to 1 who helps.

Here is the Trigger:
[trigger=My Trigger]SAVE
Events
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 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

Conditions
Actions
Actions
-------- Prepare the save array with this player's Hero --------
Set SaveCount = 0
-------- Player's Gold --------
Set SaveCount = (SaveCount + 1)
Set Save[SaveCount] = ((Triggering player) Current gold)
-------- Take all Heroes --------
Set UnitGroup = (Units owned by (Triggering player) matching (((Matching unit) is A Hero) Equal to True))
Set SaveCount = (SaveCount + 1)
Set Save[SaveCount] = (Number of units in UnitGroup)
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 )
-------- Hero Experience --------
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)))))
-------- Attributes --------
Set SaveCount = (SaveCount + 1)
Set Save[SaveCount] = (Strength of (Picked unit) (Exclude bonuses))
Set SaveCount = (SaveCount + 1)
Set Save[SaveCount] = (Agility of (Picked unit) (Exclude bonuses))
Set SaveCount = (SaveCount + 1)
Set Save[SaveCount] = (Intelligence of (Picked unit) (Exclude bonuses))
-------- Ability Level --------
Set SaveCount = (SaveCount + 1)
Set Save[SaveCount] = (Level of Expertise for (Picked unit))
Set SaveCount = (SaveCount + 1)
Set Save[SaveCount] = (Level of Perception for (Picked unit))
Set SaveCount = (SaveCount + 1)
Set Save[SaveCount] = (Level of Strenght Bonus for (Picked unit))
Set SaveCount = (SaveCount + 1)
Set Save[SaveCount] = (Level of Agility Bonus for (Picked unit))
Set SaveCount = (SaveCount + 1)
Set Save[SaveCount] = (Level of Intellligence Bonus for (Picked unit))
-------- 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 )
-------- The number of charges it has --------
Set SaveCount = (SaveCount + 1)
Set Save[SaveCount] = (Charges remaining in (Item carried by (Picked unit) in slot (Integer A)))
Else - 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 60.00 seconds the text: Code
[/trigger]


[trigger=My Trigger]Load
Events
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 7 (Green) types a chat message containing -load as A substring
Player - Player 8 (Pink) types a chat message containing -load as A substring
Player - Player 9 (Gray) types a chat message containing -load as A substring
Player - Player 10 (Light Blue) types a chat message containing -load as A substring

Conditions
Conditions
(Substring((Entered chat string), 1, 6)) Equal to (Matched chat string)
(Length of (Entered chat string)) Greater than 6

Actions
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
-------- 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
Set SaveCount = 1
-------- Restore Gold --------
Player - Set (Triggering player) Current gold to Save[SaveCount]
-------- For "number of Heroes", do --------
Trigger - Turn off The Orb of Light <gen>
Set SaveCount = (SaveCount + 1)
For each (Integer B) from 1 to Save[SaveCount], do (Actions)
Loop - Actions
-------- Restore Hero --------
Set SaveCount = (SaveCount + 1)
Custom script: set udg_TempUnitType = SaveLoad_Integer2Unit(udg_Save[udg_SaveCount])
Unit - Create 1 TempUnitType for (Triggering player) at (Center of Start of the Game <gen>) facing Default building facing degrees
-------- Set Experience --------
Set SaveCount = (SaveCount + 1)
Hero - Set (Last created unit) experience to Save[SaveCount], Hide level-up graphics
-------- Move to saved position --------
Set SaveCount = (SaveCount + 1)
Unit - Move (Last created unit) instantly to (Center of Start of the Game <gen>)
Set SaveCount = (SaveCount + 1)
-------- Attributes --------
Set SaveCount = (SaveCount + 1)
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)
Hero - Modify unspent skill points of (Last created unit): Set to 0 points
Unit - Add Critical to (Last created unit)
Unit - Add Evasion to (Last created unit)
-------- Abilities --------
Unit - Add Perception to (Last created unit)
Unit - Add Expertise to (Last created unit)
Unit - Add Strenght Bonus to (Last created unit)
Unit - Add Agility Bonus to (Last created unit)
Unit - Add Intellligence Bonus to (Last created unit)
-------- Ability Level --------
Unit - Set level of Expertise for (Last created unit) to Save[SaveCount]
Set SaveCount = (SaveCount + 1)
Unit - Set level of Perception for (Last created unit) to Save[SaveCount]
Set SaveCount = (SaveCount + 1)
Unit - Set level of Strenght Bonus for (Last created unit) to Save[SaveCount]
Set SaveCount = (SaveCount + 1)
Unit - Set level of Agility Bonus for (Last created unit) to Save[SaveCount]
Set SaveCount = (SaveCount + 1)
Unit - Set level of Intellligence Bonus for (Last created unit) to Save[SaveCount]
-------- Recreate all items --------
Set SaveCount = (SaveCount + 1)
For each (Integer A) from 1 to Save[SaveCount], do (Actions)
Loop - Actions
-------- The actual item --------
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)
-------- Number of charges --------
Set SaveCount = (SaveCount + 1)
Item - Set charges remaining in (Last created item) to Save[SaveCount]
Item - Remove (Item carried by (Last created unit) of type |cffffff66Orb of Light)
Camera - Pan camera for (Triggering player) to (Center of Start of the Game <gen>) over 0.00 seconds
Wait 2.00 seconds
Trigger - Turn on The Orb of Light <gen>
[/trigger]

SORRY I FAILED TO MAKE IT ALL IN 1 BOX. THE TRIGGER ORB OF LIGHT IS TURNED OFF AT START, CAUSE THAT TRIGGER ACTIVATES A CINEMATIC WHEN UNIT RECEIVES THAT ITEM, AND THAT ITEM IS NOT IN INITIALIZATION TRIGGER, SO I DON'T KNOW WHY DOES IT SAVE THAT ITEM. THAT WAS THE ONLY WAY TO MAKE CINEMATIC NOT WORK XD

THIS WAY, IT SAYS THAT THE CODE IS WRONG. I HAVE OTHER TRIGGER (IN OTHER VERSION OFC XD) THAT DOESN'T USE SAVE [SAVE COUNT] FOR STATS AND ATTRIBUTES. ALL OTHER THINGS ARE THE SAME.
 
Last edited:
Level 8
Joined
Apr 8, 2009
Messages
499
meh, i use the Same save/load system, works fine for me. only problem i have, is that if your hero has 6 items, only the first 2 will get loaded, you have the same?

also you should post your triggers here if you want help on the variable load/save stuff.
--> rightclick the the trigger icon in your trigger list, choose "Copy as text", paste in here in trigger taggz. we (THW) can help you better that way.
 

Vunjo

Hosted Project: SC
Level 14
Joined
Jul 1, 2010
Messages
1,340
Yeah I know what BB code list is :D
And no, I don't have same problem. I don't have much time now to write, but I will post here triggers. Also, my Team is trying to help me too =D
 
it works fine for me... It even works with an equipment system... for the 2 items bug, it may be because of the loop (on the item saving part that you used), try changing the loop variable, a similar thing happened to me when I used integer A loop, I can use save if I have up to 4 items but more than that, the code does not show...


make sure that you add everything that you want to save/load in both the save and the load trigger... and save everything in the variable Save[Save_Count] or whatever it is... and please add the triggers so we can check whats wrong... ^^
 

Vunjo

Hosted Project: SC
Level 14
Joined
Jul 1, 2010
Messages
1,340
it works fine for me... It even works with an equipment system... for the 2 items bug, it may be because of the loop (on the item saving part that you used), try changing the loop variable, a similar thing happened to me when I used integer A loop, I can use save if I have up to 4 items but more than that, the code does not show...


make sure that you add everything that you want to save/load in both the save and the load trigger... and save everything in the variable Save[Save_Count] or whatever it is... and please add the triggers so we can check whats wrong... ^^

Hmm, I should write down all 3 triggers all just Save and Load??
EDIT: I wrote it down xD
 
Hmm, I should write down all 3 triggers all just Save and Load??
EDIT: I wrote it down xD

the actions are out of the trigger tag? its kinda hard to read...

EDIT:

Set SaveCount = (SaveCount + 1)
Unit - Move (Last created unit) instantly to (Center of Start of the Game <gen>)
Set SaveCount = (SaveCount + 1)

you dont load the saved x and y of position...
 
Level 8
Joined
Apr 8, 2009
Messages
499
it works fine for me... It even works with an equipment system... for the 2 items bug, it may be because of the loop (on the item saving part that you used), try changing the loop variable, a similar thing happened to me when I used integer A loop, I can use save if I have up to 4 items but more than that, the code does not show...


make sure that you add everything that you want to save/load in both the save and the load trigger... and save everything in the variable Save[Save_Count] or whatever it is... and please add the triggers so we can check whats wrong... ^^

Sooooo, you fixed it, and can now save AND load all 6 items? if so,

can you please post triggers in here to show what you changed in the loop :O? would be very awesome ;D
 
Level 8
Joined
Apr 8, 2009
Messages
499
  • 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 )
        • Else - Actions

  • For each (Integer A) from 1 to 6, do (Actions)
    • Loop - Actions
      • -------- The actual item --------
      • Set SaveCount = (SaveCount + 1)
      • Custom script: set udg_TempItemType = SaveLoad_Integer2Item(udg_Save[udg_SaveCount])
      • Item - Create TempItemType at (Center of Hero selection arrival <gen>)
      • Hero - Create TempItemType and give it to (Last created unit)

Like this ? becuz this is what i have, and its not really working.
 
  • 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 )
        • Else - Actions

  • For each (Integer A) from 1 to 6, do (Actions)
    • Loop - Actions
      • -------- The actual item --------
      • Set SaveCount = (SaveCount + 1)
      • Custom script: set udg_TempItemType = SaveLoad_Integer2Item(udg_Save[udg_SaveCount])
      • Item - Create TempItemType at (Center of Hero selection arrival <gen>)
      • Hero - Create TempItemType and give it to (Last created unit)

Like this ? becuz this is what i have, and its not really working.

don't use integer from 1 to 6 on the load trigger, use from 1 to SaveCount... and you dont need to create item at location and then give it to unit, use create item for hero...
 
Level 8
Joined
Apr 8, 2009
Messages
499
don't use integer from 1 to 6 on the load trigger, use from 1 to SaveCount... and you dont need to create item at location and then give it to unit, use create item for hero...

i had from 1 to savecount before, failed.

and the item thingy was for testing lulz x3, imma try that save count again. ty for your help anyways ^^

--------EDIT-------------:
  • For each (Integer A) from 1 to Save[SaveCount], 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 )
        • Else - Actions
  • For each (Integer A) from 1 to Save[SaveCount], do (Actions)
    • Loop - Actions
      • -------- The actual item --------
      • 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)

This is what i have now, only the first item will be loaded. >_<"
 
^ posted my new triggers above ^

also, waht should i use instead of Intger A? integer B ? :ogre_hurrhurr:

only use 1 to Save[SaveCount] on the load trigger... not on the save trigger...

not A or B use for Each integer Variable (make your own variable...)

  • For each (Integer Variable C) 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 )
            • Else - Actions
  • For each (Integer Variable C) from 1 to Save[SaveCount], do (Actions)
    • Loop - Actions
      • -------- The actual item --------
      • 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)
 
Level 8
Joined
Apr 8, 2009
Messages
499
only use 1 to Save[SaveCount] on the load trigger... not on the save trigger...

not A or B use for Each integer Variable (make your own variable...)

so, 1 to save[savecount] on load, 1 to 6 on save

and a own var instead of integer A.

variable type should be integer ofc, should it have an array of sorts?
 
Level 8
Joined
Apr 8, 2009
Messages
499
o.o. mkay i added plain integer, doesn't load any item now, -confused- ¬¬



  • SaveLoad Save Hero and Items
    • Events
      • Player - Player 1 (Red) types a chat message containing -save2 as An exact match
      • Player - Player 2 (Blue) types a chat message containing -save2 as An exact match
      • Player - Player 3 (Teal) types a chat message containing -save2 as An exact match
      • Player - Player 4 (Purple) types a chat message containing -save2 as An exact match
      • Player - Player 5 (Yellow) types a chat message containing -save2 as An exact match
      • Player - Player 6 (Orange) types a chat message containing -save2 as An exact match
      • Player - Player 7 (Green) types a chat message containing -save2 as An exact match
      • Player - Player 8 (Pink) types a chat message containing -save2 as An exact match
    • Conditions
    • Actions
      • -------- Prepare the save array with this player's Hero --------
      • Set SaveCount = 0
      • Unit Group - Pick every unit in (Units owned by (Triggering player) matching ((Matching unit) Equal to Player_Hero_Array[(Player number of (Triggering player))])) 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 )
          • -------- Hero Experience --------
          • Set SaveCount = (SaveCount + 1)
          • Set Save[SaveCount] = (Hero experience of (Picked unit))
          • -------- Add all items --------
          • Set SaveCount = (SaveCount + 1)
          • Set Save[SaveCount] = (Number of items carried by (Picked unit))
          • For each (Integer Integer_A_Replacement) 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 )
                • Else - 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 60.00 seconds the text: Code

  • SaveLoad Load Hero and Items
    • Events
      • Player - Player 1 (Red) types a chat message containing -load2 as A substring
      • Player - Player 2 (Blue) types a chat message containing -load2 as A substring
      • Player - Player 3 (Teal) types a chat message containing -load2 as A substring
      • Player - Player 4 (Purple) types a chat message containing -load2 as A substring
      • Player - Player 5 (Yellow) types a chat message containing -load2 as A substring
      • Player - Player 6 (Orange) types a chat message containing -load2 as A substring
      • Player - Player 7 (Green) types a chat message containing -load2 as A substring
      • Player - Player 8 (Pink) types a chat message containing -load2 as A substring
    • Conditions
      • (Substring((Entered chat string), 1, 7)) Equal to (Matched chat string)
      • (Length of (Entered chat string)) Greater than 7
    • Actions
      • -------- Try to decode what was typed --------
      • Set Code = (Substring((Entered chat string), 8, (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
      • -------- It worked, let's do something with it --------
      • Set SaveCount = 0
      • 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
      • For each (Integer B) from 1 to 1, do (Actions)
        • Loop - Actions
          • -------- Restore Hero --------
          • Set SaveCount = (SaveCount + 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
          • Set SaveCount = (SaveCount + 1)
          • For each (Integer Integer_A_Replacement) from 1 to Save[SaveCount], do (Actions)
            • Loop - Actions
              • -------- The actual item --------
              • 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)

can you please show the correct edits in trigger tags ._. ?
 
this line:

Set TempItem = (Item carried by (Picked unit) in slot (Integer A))

should be

Set TempItem = (Item carried by (Picked unit) in slot (Integer_A_Replacement))

and also your condition line...
((Item carried by (Picked unit) in slot (Integer A)) is owned) Equal to True

--> ((Item carried by (Picked unit) in slot (Integer_A_Replacement)) is owned) Equal to True
 
Level 8
Joined
Apr 8, 2009
Messages
499
ah, its working now ^^ Thank you ver much +rep



---EDIT---
hmm.... just wondering if you could help me on this one aswell, as i want it to save item charges now o.o any idea?
 
Level 8
Joined
Apr 8, 2009
Messages
499
this is what i thought would work for saving the charges;

  • SaveLoad Save Property
    • 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
    • Conditions
    • Actions
      • -------- Prepare the save array with this player's Hero --------
      • Set SaveCount = 0
      • -------- Player's Gold --------
      • Set SaveCount = (SaveCount + 1)
      • Set Save[SaveCount] = ((Triggering player) Current gold)
      • -------- Player's Lumber --------
      • Set SaveCount = (SaveCount + 1)
      • Set Save[SaveCount] = ((Triggering player) Current lumber)
      • Unit Group - Pick every unit in (Units owned by (Triggering player) matching ((Matching unit) Equal to Player_Hero_Array[(Player number of (Triggering player))])) 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 )
          • -------- Hero Experience --------
          • Set SaveCount = (SaveCount + 1)
          • Set Save[SaveCount] = (Hero experience of (Picked unit))
          • -------- Add all items --------
          • Set SaveCount = (SaveCount + 1)
          • Set Save[SaveCount] = (Number of items carried by (Picked unit))
          • For each (Integer Integer_A_Replacement) 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_Replacement) 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_Replacement)
                  • Custom script: set udg_Save[udg_SaveCount] = SaveLoad_Item2Integer( udg_TempItem )
                  • Set SaveCount = (SaveCount + 1)
                  • Set Save[SaveCount] = (Charges remaining in (Item carried by (Picked unit) in slot Integer_A_Replacement))
                • Else - 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 60.00 seconds the text: Code

  • SaveLoad Load Property
    • 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
      • Player - Player 8 (Pink) 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
    • 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
      • -------- It worked, let's do something with it --------
      • Set SaveCount = 1
      • -------- Restore Gold --------
      • Player - Set (Triggering player) Current gold to Save[SaveCount]
      • Set SaveCount = (SaveCount + 1)
      • -------- Restore Lumber --------
      • Player - Set (Triggering player) Current lumber to Save[SaveCount]
      • 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
      • For each (Integer B) from 1 to 1, do (Actions)
        • Loop - Actions
          • -------- Restore Hero --------
          • Set SaveCount = (SaveCount + 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
          • Set SaveCount = (SaveCount + 1)
          • For each (Integer Integer_A_Replacement) from 1 to Save[SaveCount], do (Actions)
            • Loop - Actions
              • -------- The actual item --------
              • 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)
              • Item - Set charges remaining in (Last created item) to Save[SaveCount]
unfortunately this breaks it and somehow you can only load 4 of the possible 6 items. got any clue as to what is going on?
 
Status
Not open for further replies.
Top