Save/Load Code, Yet Another

tigerija

New Member
Reaction score
0
Btw Johnson:

-------- List of Items --------
Set Save_ItemNum = 1
Set SaveLoad_Items[Save_ItemNum] = Alleria's Flute of Accuracy
Set Save_ItemNum = (Save_ItemNum + 1)
Set SaveLoad_Items[Save_ItemNum] = Amulet of Spell Shield
...

Makes things little easier.
 

tigerija

New Member
Reaction score
0
Y it is...

Then you can pick all items in rect and for each picked item:
Set SaveLoad_Items[Save_ItemNum+1] = Picked item

Thats about 6 lines but I think its unstable when you update items, anyway i prefer mine way when i do stufs like this, i always store stufs in variables then a do things with them.

Anyway this code is very good :D.

Chocobo just add lower case letters inside... or add your specific color.
"
loop
set i = i - 1
set c = SubString(s,i,i + 1)
if c == "0" or c == "1" or c == "2" or c == "3" or c == "4" or c == "5" or c == "6" or c == "7" or c == "8" or c == "9" or c =q= "" or c == "w" or c == "e" then
set r = "|cffffcc00" + c + "|r" + r
elseif c == "-" then
set r = "|cffdddddd-|r" + r
else
set r = c + r
endif
exitwhen i <= 0
endloop
"
 

AriesX_420

Active Member
Reaction score
1
Hey Nice Load/Save Trigger. Works good...

Im making a map Called the Daemonic Sword... Its nearing Completion within the year probably... lol However...

One Problem i have for my map, is that there is atleast 4 characters to choose from..

But only one player can be that Characters during a Session.

Im working on the trigger but the events and conditions are the hard part..

I want it so...

Events
A player types load - (code)



effect:
If that unit is already taken by another character.
Then remove that character
tell the player you cannot load this charcter because this character type is already in play...

I have a slight idea but its hard to make it so the computer knows which character type it is....


It could be vise versa too.. as the player has already loaded the character... and the player chooses that character with their wisp.. and it tell them you cant choose Hero because someone has load it...
Any Suggestions or Hints would be nice, thnks
:banghead:
 

AriesX_420

Active Member
Reaction score
1
One more thing..

It could also work like... Whichever players wisp goes to that unit.. It asks the player if they want to start a new character of that type... or load it...

If they choose load... They must load that unit type..
or it removes that loaded unit.. and restarts the trigger...

asking them if they want a new character of that type.. or load it.
 

FarAwaY

TH.net Regular
Reaction score
9
Pretty solid saving/load system....saves everything...However, I think I got messed up here...

So far everything is working I nvr changed any values...but after I added right at the btm of the trigger code just right above (set udg code saveload_encode) "SaveCount = Savecount + 1" and "Set Save[SaveCount] = Triggering Player CUrrent Lumber".... and proceeded to add the very same thing in LOADING, it doesnt work.

No matter what I do, it gives me weird values like 2 all the way, no matter how much lumber I saved. Sometimes when I changed the spot its in it gives me 101 lumber...and edits my abilities so my abilities dont save...

I cant figure out whats wrong so does any1 know how to make it so that it could save lumber?
 

Zwiebelchen

You can change this now in User CP.
Reaction score
60
This system looks awesome.
But one question (Not sure if it was asked already):
Whats the maximum number of integer values you can store?

For example, I want to save the quest progression of the player into the code.
I could save one Integer for any quest chain, needing 6 integer values, one for each quest chain.
Or could I also use one integer like for example 103067 to store the progression of all quests in one int?
If yes, which one will create a shorter code?
 

Zwiebelchen

You can change this now in User CP.
Reaction score
60
The more info, the more code.
As such, 103067 (whatever that's supposed to mean :p) is clearly superior.
Sounds good. Currently, Thythoid is creating my save/load system, however, if he doesn't reply, I will stick to your system.

Actually it's not that hard to understand what I meant with the int ;)
The first digit is the status of the first quest chain, the second of the second, etc ...
So basicly the code adjusts the maximum value depending on your input? That's neat. Great work.

Another question: Is there a cheat-protection on the code? Like a checksum or something? If not, it would be easy to implement, because you can store the checksum in an int and then compare when loading, but I am just asking for the case that you already implemented it.
 

Dregonx

TH.net Regular
Reaction score
21
Just tried this out, it's pretty awesome.

I got 3 questions for this.

Question 1 Is this version friendly? If I were to make several versions of the same map with relatively few new items/heroes etc. would the code still load from older versions? If not/if so, how can it be added in?

Question 2 Is it anti-item duplicate? Like you wouldn't be able to -load your character, drop all your items, -load again and then you could pick up whatever over and over? If not/if so, how can it be added in?

Question 3 Can you point out all the leaks, so I can go in and remove them? (In case I miss some, it's kinda hard to tell with all the variable settings and such.)
 

tigerija

New Member
Reaction score
0
I'm saving quest progrst with it works good, btw ace can you add color for lower letters ? i'm not very well with jass, and the way i did it it doesnt works anymore with new jass newgen. So can you add this to you system ?
 

tigerija

New Member
Reaction score
0
Just tried this out, it's pretty awesome.

I got 3 questions for this.

Question 1 Is this version friendly? If I were to make several versions of the same map with relatively few new items/heroes etc. would the code still load from older versions? If not/if so, how can it be added in?

Question 2 Is it anti-item duplicate? Like you wouldn't be able to -load your character, drop all your items, -load again and then you could pick up whatever over and over? If not/if so, how can it be added in?

Question 3 Can you point out all the leaks, so I can go in and remove them? (In case I miss some, it's kinda hard to tell with all the variable settings and such.)

I solved problem on your question 2 , but seems like when i put more than 145 items or somtn like that, it loads wrong items, so it seems it has small limit of items...
 
Reaction score
341
Just tried this out, it's pretty awesome.

I got 3 questions for this.

Question 1 Is this version friendly? If I were to make several versions of the same map with relatively few new items/heroes etc. would the code still load from older versions? If not/if so, how can it be added in?

Question 2 Is it anti-item duplicate? Like you wouldn't be able to -load your character, drop all your items, -load again and then you could pick up whatever over and over? If not/if so, how can it be added in?

Question 3 Can you point out all the leaks, so I can go in and remove them? (In case I miss some, it's kinda hard to tell with all the variable settings and such.)

1) Save the integer of what version you are using

2) With some basic GUI knowledge.

3) The Unit Groups.
 

Bloodcount

Starcraft II Moderator
Reaction score
297
Ok, let's asume for a second that the hero I am trying to save, uses 2 inventorys. Will both get saved or will only the current one get saved ?
 

SumQuestions

New Member
Reaction score
0
Only One item is restored..

as the title says it,

I have a hero, pick up 3 items, save, load, but only the first inventory item gets restored.

I looked through the thread and saw that someone else had the same problem as me, and tried to do what he did to solve it but it still doesnt work.

Triggers:
Trigger:
  • SaveLoad Initialization All
    • Events
      • Map initialization
    • Conditions
    • Actions
      • -------- List of Heroes --------
      • Set SaveLoad_Heroes[1] = Assault Man
      • -------- Number of Heroes --------
      • Set SaveLoad_Heroes_LastIndex = 1
      • -------- List of Items --------
      • Set SaveLoad_Items[1] = Plate Armor
      • Set SaveLoad_Items[2] = Mercenary Leather
      • Set SaveLoad_Items[3] = Magister&#039;s Plate
      • Set SaveLoad_Items[4] = Golden Plate Armor
      • Set SaveLoad_Items[5] = Blademail Armor
      • Set SaveLoad_Items[6] = Helmet
      • Set SaveLoad_Items[7] = Full Helm
      • Set SaveLoad_Items[8] = Skull Mask
      • Set SaveLoad_Items[9] = Siege Helm
      • Set SaveLoad_Items[10] = Samurai Helm
      • Set SaveLoad_Items[11] = Golden Full Helm
      • Set SaveLoad_Items[12] = Terminator Helm
      • Set SaveLoad_Items[13] = Assault Elite Helmet
      • Set SaveLoad_Items[14] = MP5
      • Set SaveLoad_Items[15] = SPAS-12
      • Set SaveLoad_Items[16] = AK-47
      • -------- Number of Items --------
      • Set SaveLoad_Items_LastIndex = 16
      • -------- List of Abilities --------
      • Set SaveLoad_Abilities[1] = Shoot (W) MP5
      • Set SaveLoad_Abilities[2] = Shoot (W) SPAS-12
      • Set SaveLoad_Abilities[3] = Shoot (W) AK-47
      • -------- Number of Abilities --------
      • Set SaveLoad_Abilities_LastIndex = 3
      • -------- These three lines may be changed if needed --------
      • Set SaveLoad_Alphabet = ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789
      • Set SaveLoad_CaseSensitive = True
      • Set SaveLoad_UsePlayername = True
      • -------- Required: false --------
      • Set SaveLoad_Initialized = False
      • -------- Leave as is. Used to autocreate variables when copy &amp; 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

Trigger:
  • SaveLoad Save All
    • 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
    • Conditions
    • Actions
      • -------- Prepare the save array with this player&#039;s Hero --------
      • Set SaveCount = 0
      • -------- Player&#039;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))
          • -------- How many items does he carry --------
          • Set SaveCount = (SaveCount + 1)
          • Set Save[SaveCount] = (Number of items carried by (Picked unit))
          • -------- Add all items --------
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Item carried by (Picked unit) in slot 1) is owned) Equal to True
            • Then - Actions
              • -------- The actual item --------
              • Set SaveCount = (SaveCount + 1)
              • Set TempItem = (Item carried by (Picked unit) in slot 1)
              • 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
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Item carried by (Picked unit) in slot 2) is owned) Equal to True
            • Then - Actions
              • -------- The actual item --------
              • Set SaveCount = (SaveCount + 1)
              • Set TempItem = (Item carried by (Picked unit) in slot 2)
              • 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
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Item carried by (Picked unit) in slot 3) is owned) Equal to True
            • Then - Actions
              • -------- The actual item --------
              • Set SaveCount = (SaveCount + 1)
              • Set TempItem = (Item carried by (Picked unit) in slot 3)
              • 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
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Item carried by (Picked unit) in slot 4) is owned) Equal to True
            • Then - Actions
              • -------- The actual item --------
              • Set SaveCount = (SaveCount + 1)
              • Set TempItem = (Item carried by (Picked unit) in slot 4)
              • 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
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Item carried by (Picked unit) in slot 5) is owned) Equal to True
            • Then - Actions
              • -------- The actual item --------
              • Set SaveCount = (SaveCount + 1)
              • Set TempItem = (Item carried by (Picked unit) in slot 5)
              • 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
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Item carried by (Picked unit) in slot 6) is owned) Equal to True
            • Then - Actions
              • -------- The actual item --------
              • Set SaveCount = (SaveCount + 1)
              • Set TempItem = (Item carried by (Picked unit) in slot 6)
              • 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 300.00 seconds the text: Code

Trigger:
  • SaveLoad Load All
    • 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
    • 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&#039;s some error ...
          • Skip remaining actions
        • Else - Actions
      • -------- It worked, let&#039;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 &quot;number of Heroes&quot;, do --------
      • 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 ((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
          • -------- Move to saved position --------
          • Set Start = (Random point in Start team 1 &lt;gen&gt;)
          • Unit - Move (Last created unit) instantly to Start
          • Custom script: call RemoveLocation(udg_Start)
          • Set SaveCount = (SaveCount + 1)
          • -------- Recreate all items --------
          • 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]


any ideas?
 

Tooblet

Active Member
Reaction score
6
> when I put more than 145 items

> For that you would need version 2.0 which has never been released.


My map has 175 Items that i've put in the init trigger. I haven't
seen any problems yet, but will I?
 

mightylink

New Member
Reaction score
1
Hello, I am trying to use this save/load system on my map. I tried all the triggers, save hero, save hero and items, save hero and abilities, but save all doesnt seem to save all...

I can get all the other triggers working but save all doesnt seem to save abilities, and when I look at the save all triggers, it doesnt seem to have the save abilities section like the save abilities trigger has, did I do something wrong or is there a mistake?

Id like to save both hero items and hero abilities, how do I get this to work?
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top