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

save/load issue

Status
Not open for further replies.
Level 10
Joined
Feb 27, 2016
Messages
617
oh dude thanks it really helps with some random crates and barrels that drop loot
i will tell you this so there are common rare and epic barrels that all drop better gear random around the map seems fun?
 
Last edited:
Level 3
Joined
Apr 17, 2008
Messages
41
no reason he can't set up the skeleton and add data to it as it becomes available. I've done that before -.-.

Imma just call you guys out as being wrong. You can even start with save/load if you want. It doesn't make much of a difference.

^This. Personally, a save/load code is one of the first things I would add to a map that needs one. It's an essential system to the map, and I like to have all of that stuff added and working before I start creating most of the content.

2. As you probably know, a loooot of things change during the development of a map. What he has now might end up being completely replaced/reworked, especially considering that he is still fairly new - i.e. might not necessarily have everything figured out from the start and has the potential to discover a lot of stuff he'd want to use. And if the save/load system utilizes the data that he would change, the system itself might need editing as well. Sure, this is not a problem for someone with experience, but having to go back to it every now and then could be really confusing for a person who is relatively new.

Most users wouldn't ever need to touch the actual system. The system itself is just taking values and converting them into a much shorter string for the player(s) to load. If the user updates his/her map, then he/she may also need to edit what gets saved and loaded which means there needs to be some sort of understanding from the user. If I were to set this process up in GUI, then you would only need to edit a minimum of 3 triggers for most maps. It's also not that hard to understand, so I'll give an example of how this process could look like.

The initialization trigger:

  • SaveLoad Heroes
    • Events
      • Map initialization
    • Conditions
    • Actions
      • -------- Add each hero in your map to a unit type array. --------
      • -------- This array will be looped through during saving and loading to find which hero is being saved and loaded. --------
      • -------- Save/load systems generally take integer values and makes them smaller by converting them into strings. --------
      • -------- This initialization trigger essentially numbers your heroes which allows you to give the save/load system a number that represents a hero. --------
      • -------- You can use this method to number item types and ability types as well. --------
      • -------- Using a TempInteger variable can save some time during a copy/paste and prevents any user errors from entering a wrong array index. --------
      • Set TempInteger = 0
      • Set SaveLoad_Heroes[TempInteger] = Paladin
      • Set TempInteger = (TempInteger + 1)
      • Set SaveLoad_Heroes[TempInteger] = Archmage
      • Set TempInteger = (TempInteger + 1)
      • Set SaveLoad_Heroes[TempInteger] = Mountain King
      • Set TempInteger = (TempInteger + 1)
      • Set SaveLoad_Heroes[TempInteger] = Blood Mage
      • Set SaveLoad_Heroes_LastIndex = TempInteger

The save trigger:

  • Player Save
    • Events
      • Player - Player 1 (Red) types a chat message containing -save as An exact match
    • Conditions
    • Actions
      • -------- Reset the "SaveCount" variable to zero. --------
      • -------- The "SaveCount" variable is just a variable to make copy/paste easier. It could also be replaced by the "TempInteger" variable in the trigger above this one. --------
      • Set SaveCount = 0
      • -------- Save the player's gold into the "Save" integer variable of index "SaveCount". --------
      • Set Save[SaveCount] = ((Triggering player) Current gold)
      • -------- Now, save the player's lumber. --------
      • -------- Increase the "SaveCount" variable by 1 for each new value that you save. --------
      • Set SaveCount = (SaveCount + 1)
      • Set Save[SaveCount] = ((Triggering player) Current lumber)
      • -------- Now, save the player's hero. --------
      • -------- First, let's get the player's hero (or heroes). --------
      • 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
          • -------- Now, let's check to see if the picked hero(es) are saved in the SaveLoad_Heroes array. --------
          • For each (Integer A) from 0 to SaveLoad_Heroes_LastIndex, do (Actions)
            • Loop - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Unit-type of (Picked unit)) Equal to SaveLoad_Heroes[(Integer A)]
                • Then - Actions
                  • -------- This index matches the picked hero, so let's save this index. --------
                  • Set SaveCount = (SaveCount + 1)
                  • Set Save[SaveCount] = (Integer A)
                • Else - Actions
                  • -------- A match is not found for this index. --------
      • -------- The save/load system needs to know when to do something with the data you're saving. --------
      • -------- A save/load system could use something like this to do it: --------
      • Custom script: call Save()
      • -------- After that line, every index of the variable "Save" will be stored into a string variable (let's say this system stores it to a global variable called "Code". --------
      • -------- Now you just display that string variable to the user. --------
      • Game - Display to (Player group((Triggering player))) the text: Your code is:
      • -------- Remember, "Code" is a global string variable that all of your data is saved into. --------
      • Game - Display to (Player group((Triggering player))) the text: Code

The load trigger:

  • Player Load
    • 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
    • Actions
      • -------- You should probably remove the player's current hero(es) to prevent the player from have multiple heroes. --------
      • 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
      • -------- The save/load system needs to know which string it should be converting into integers. --------
      • -------- Set the "Code" variable to the code that the player types. --------
      • -------- SubString 1,6 is "-load ", so give it the rest of the entered chat string after that. --------
      • Set Code = (Substring((Entered chat string), 7, (Length of (Entered chat string))))
      • -------- Now the system needs to know when to do something to the code that the player gives. --------
      • -------- A save/load system could use something like this to do it: --------
      • Custom script: call Load()
      • -------- After this, the system may set a global boolean variable to true or false to detect whether the code was a valid code. --------
      • -------- This is why players can't typically type in any code and have it work. --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Validate Equal to False
        • Then - Actions
          • -------- The player tried to load some invalid data, so just stop this trigger from loading that invalid data for the player. --------
          • Game - Display to (Player group((Triggering player))) the text: Invalid code!
          • Skip remaining actions
        • Else - Actions
          • -------- No invalid data was trying to be loaded from the user. --------
      • -------- At this point, a valid code was given. --------
      • -------- The system has loaded the integers into the integer array "Save", so just load that data in the order you saved it. --------
      • -------- The system has also set the variable "SaveCount" to the amount of values that were saved to the code. --------
      • -------- You save gold first, so load gold first. --------
      • Set TempInteger = 0
      • Player - Set (Triggering player) Current gold to Save[TempInteger]
      • -------- Next, you load lumber. --------
      • Set TempInteger = (TempInteger + 1)
      • Player - Set (Triggering player) Current lumber to Save[TempInteger]
      • -------- Now, you load all the heroes that were saved. --------
      • Set TempInteger = (TempInteger + 1)
      • For each (Integer A) from TempInteger to SaveCount, do (Actions)
        • Loop - Actions
          • -------- "SomePosition" is just whatever location you want heroes to be loaded to. --------
          • Unit - Create 1 SaveLoad_Heroes[Save[(Integer A)]] for (Triggering player) at SomePosition facing 0.00 degrees
          • -------- Notice that you're just creating a hero from the "SaveLoad_Heroes" global unit type array. --------
      • Game - Display to (Player group((Triggering player))) the text: Loading successful!

As for the save/load system itself, you only need to understand that it converts integers into strings. You don't need to worry about how this is accomplished, and you definitely don't need to edit the system.

You may also want to consider saving the player's name to the code. When you check for the player name in the Load trigger, you can stop loading from happening if the loading player's name isn't the same as the name saved to the code. Some save/load systems may have this as a built in feature, but you should discover that upon reading the system's documentation (along with any other built in features). These three triggers would be the configuration that needs to happen with save/load systems and are the reason that you can't just copy and paste an entire system and expect it to work perfectly for your map. The system itself needs to know what needs to be saved. If your system is GUI friendly, then altering the save and load triggers should be really straight forward and easy.

I'm not familiar with any 3rd party save/load systems, so I can't comment on exactly how they work or how to implement them. Hopefully those systems have proper documentation for users.
 
Level 3
Joined
Apr 17, 2008
Messages
41
upload_2016-6-25_9-30-20.png
 
Level 3
Joined
Apr 17, 2008
Messages
41
Create a new action and find the Set Variable action. You'll be able to select which variable you want to alter after that.
upload_2016-6-25_9-51-32.png
 
Level 3
Joined
Apr 17, 2008
Messages
41
You're just setting TempInteger to itself plus one and using it as an index of an array variable. Doing this makes copy/paste easier. Otherwise you would have to specify each index (Save[0],Save[1],Save[2],...etc.).
 
Level 3
Joined
Apr 17, 2008
Messages
41
You may also want to consider saving the player's name to the code. When you check for the player name in the Load trigger, you can stop loading from happening if the loading player's name isn't the same as the name saved to the code. Some save/load systems may have this as a built in feature, but you should discover that upon reading the system's documentation (along with any other built in features).


Do you really want me to be more specific in all the possible ways you could do that? It doesn't matter where the name goes or how it's part of the code, but that needs to happen and it's only a waste of space depending on how you do it. I know you're not implying that it doesn't matter and you'll let players load codes from other players.
 
Level 3
Joined
Apr 17, 2008
Messages
41
sluk, read the documentation of whichever save/load system you've decided to use. There's probably a test map to go with it. The three triggers I posted were to explain and show how easy a GUI friendly save/load system could be to maintain. You shouldn't even be using them as a point of reference since the save/load system you're going to use will likely require a different setup than my examples.
 
Level 9
Joined
May 21, 2014
Messages
580
sluk, read the documentation of whichever save/load system you've decided to use. [...] You shouldn't even be using them as a point of reference since the save/load system you're going to use will likely require a different setup than my examples.

This was exactly my point. I wanted sluk to explore the vast world editor first.
Because I don't really want to explain every minor detail that can be learnt from basic exploration.
 
Level 10
Joined
Feb 27, 2016
Messages
617
sluk, read the documentation of whichever save/load system you've decided to use. There's probably a test map to go with it. The three triggers I posted were to explain and show how easy a GUI friendly save/load system could be to maintain. You shouldn't even be using them as a point of reference since the save/load system you're going to use will likely require a different setup than my examples.
but i use it for my real save/load
i use your save/load
 
Last edited:
Level 31
Joined
Jul 10, 2007
Messages
6,306
Do you really want me to be more specific in all the possible ways you could do that? It doesn't matter where the name goes or how it's part of the code, but that needs to happen and it's only a waste of space depending on how you do it. I know you're not implying that it doesn't matter and you'll let players load codes from other players.


The name should never ever be part of the code.


If you want player unique codes, you make the name a key for the encryption algorithm and or hashing algorithm.



You're also confusing Save/Load systems with Number Libs imo.

A number lib is just like multiplication, division, addition, and subtraction of numbers. These clearly don't have the settings you speak of : p.

I know in the thing I released, in fact in the several things I released, I did not have this "save/load" system you speak of. The most I had were a couple of templates so that someone could write their own save/load system. This was the case because save/load systems are map specific. Trying to release a one-size fits all solution ain't ganna work : ).
 
does somebody knows how to import CodeGen without the triggers being disabled?
and also can anybody make a video tutorial from save/load

Make sure the editor is copying the variables.

Like I told you before, it's under File -> Preferences.

codegen1-png.162138


Also make sure you copied the JASS header over to your map.

codegen2.jpg


This information is all clearly available in the system thread.
 
but is there any GUI save/load?

http://www.thehelper.net/threads/save-load-code.30028/ - This one is 100% in GUI. It is not very good but it has a demo map and an in-depth explanation on how to re-create it.

or how do i do JASS than?

You don't need to know JASS for any of the systems you are having trouble with.

You just need to follow instructions which you apparently can't do.

or why do the triggers disable?

Beause you can't follow instructions.

Like I already told you multiple times and I'm sure others have, you have to allow variable data to be copied automatically. My thread explains this with screenshots.

After that all you just need to copy the JASS script to your map. It requires no JASS knowledge to copy something, and that should be obvious.

Once that is done you copy the triggers over and save the map.

(I'm talking about CodeGen/Acehart's here)

pls help me

At this point, help yourself.


i tried 10 save/loads none of them worked always the triggers getting disabled
pls help me its with every save/load! :(


You really think the 10 save and load systems are the issue? You're the issue.

You can't follow the most basic instructions so someone should just close this thread.
 
Last edited:
Status
Not open for further replies.
Top