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

Suggest How to Simplify This Save/Load System?

Status
Not open for further replies.
Level 18
Joined
Mar 16, 2008
Messages
721
I just want to -load an integer variables 1 to 5 for players when they load. Not sure how to cut out all the stuff I don't need associated with heroes: Codeless Save and Load (Multiplayer) - v3.0.1

I need a save load system that tracks what difficulty players beat the map on, which are integer variables. I want to players to start out with basic heroes each time but unlock custom models of same hero if they -load, depending on their highest difficulty integer when they -load.

Thinking a techtree requirement would be created depending on the integer that is -load'ed, unlocking certain other hero options, which would be purely cosmetic.

Thanks for any input or suggestions on this topic.

EDIT UPDATE: I'm just not sure what the exact function is that saves to the folder.

EDIT UPDATE 2:
I'm simply trying to figure how what is the function that saves to a player's local folder. I don't need encryption, word scrambling. I'm simply trying to save and load 1 data point.
 
Last edited:
Level 24
Joined
Jun 26, 2020
Messages
1,852
Are you asking how to use it with less steps or just how to use it? If is the latter, I made a tutorial about how to use it: TriggerHappy's Codeless Save and Load tutorial

And I don't know what do you mean what do you mean with "I don't need encryption, word scrambling. I'm simply trying to save and load 1 data point." Because the save/load system saves and loads any integer value and also encrypt and decrypt it.

If you just wanna save and load without encryption, just use the FileIO system that is integrated in the save/load system, its more simple, but less automatic.
 
Level 18
Joined
Mar 16, 2008
Messages
721
Thanks for your attention and sorry my post isn't very clear.

I'm asking how to use it. I would like to isolate the function that saves/loads to/from a local folder then do away with all the unneeded stuff. But really just having a system that works would be nice.

Either way, It won't let me save map when I import:
1682473209721.png

EDIT:
My goal would be auto-load in map starting trigger, then run triggers based off the players loaded info, then auto-save if victory happens, compare the players highest difficulty integer to the current one and save whichever one is higher.
 
Level 24
Joined
Jun 26, 2020
Messages
1,852
I'm asking how to use it. I would like to isolate the function that saves/loads to/from a local folder then do away with all the unneeded stuff. But really just having a system that works would be nice.
I said that you can just use the FileIO system, it only has 2 important functions:
vJASS:
function FileIO_Write takes string filename, string contents returns nothing

function FileIO_Read takes string filename returns string

Either way, It won't let me save map when I import:
Do you have JASSHelper enabled?
 
Level 18
Joined
Mar 16, 2008
Messages
721
1) Yes it was JASS Helper.

2) I can't find those functions in the FileIO trigger, but maybe i'll just try to use the entire system.

3) Do you think attempting to modify this system to auto-load multiple players at once, do you think this would bug out the system?
  • Type Load
    • Events
    • Conditions
    • Actions
      • -------- AUTO LOAD PLAYER 1 (RED) --------
      • -------- AUTO LOAD PLAYER 1 (RED) --------
      • -------- AUTO LOAD PLAYER 1 (RED) --------
      • Set VariableSet SaveLoadEvent_Player = Player 1 (Red)
      • -------- ------------------- --------
      • -------- This runs the Event used in Load GUI and tells it to load Save Slot 1 --------
      • Custom script: call LoadSaveSlot(udg_SaveLoadEvent_Player, 1)
      • -------- AUTO LOAD PLAYER 2 (BLUE) --------
      • -------- AUTO LOAD PLAYER 2 (BLUE) --------
      • -------- AUTO LOAD PLAYER 2 (BLUE) --------
      • Set VariableSet SaveLoadEvent_Player = Player 2 (Blue)
      • -------- ------------------- --------
      • -------- This runs the Event used in Load GUI and tells it to load Save Slot 1 --------
      • Custom script: call LoadSaveSlot(udg_SaveLoadEvent_Player, 1)
EDIT UPDATE:
going to try something like this and use Uncle's suggestions from the other thread (Save/Load System For Interger Resource.)

  • auto load red
    • Events
      • Time - Elapsed game time is 1.00 seconds
    • Conditions
    • Actions
      • Set VariableSet SaveLoadEvent_Player = Player 1 (Red)
      • Custom script: call LoadSaveSlot(udg_SaveLoadEvent_Player, 1)
  • auto load blue
    • Events
      • Time - Elapsed game time is 2.00 seconds
    • Conditions
    • Actions
      • Set VariableSet SaveLoadEvent_Player = Player 2 (Blue)
      • Custom script: call LoadSaveSlot(udg_SaveLoadEvent_Player, 1)
 
Last edited:
Level 24
Joined
Jun 26, 2020
Messages
1,852
I can't find those functions in the FileIO trigger, but maybe i'll just try to use the entire system.
Is because they are not really named like I said, in reality they are named like this:
vJASS:
library FileIO
    public function Write takes string filename, string contents returns nothing
    public function Read takes string filename returns string
Is just that they are called by using the names I showed.

EDIT UPDATE:
going to try something like this and use Uncle's suggestions from the other thread (Save/Load System For Interger Resource.)
You can try that, but maybe with a time lesser than 1 second, in fact, if you don't need to pass variables from the moment you load a saved slot to the moment the SaveLoadEvent is runned, you can load to all players in one take.
 
Level 18
Joined
Mar 16, 2008
Messages
721
How do I reference data from the local folder in World Editor?

EDIT/UPDATE:

i'm really struggling to understand this and i think i'm not doing a great job at communicating here. trying to consolidate my thoughts/wishes:
1) is udg_SaveCount is the first data piece saved, so in my case the only data piece?
2) Is it possible to reference the actual integer saved in the local folder in a WE trigger? for this map it will always be 1,2,3,4, or 5 only
1) udg_difficulty_setting is selected by player at start.
2) i want difficulty_setting to be compared to saved data, probably saved using the max(a,b) function - so let's say they beat difficulty 3 once but then they just beat difficulty 2 again, i want difficulty 3 to be saved.
3) when loading at the start, if the saved integer is 3 or higher, i want to be able to reference that and run triggers based on the saved variable.

  • auto load red
    • Events
      • Time - Elapsed game time is 1.00 seconds
    • Conditions
    • Actions
      • Set VariableSet SaveLoadEvent_Player = Player 1 (Red)
      • Custom script: call LoadSaveSlot(udg_SaveLoadEvent_Player, 1)
  • auto save red
    • Events
    • Conditions
    • Actions
      • Set VariableSet SaveLoadEvent_Player = Player 1 (Red)
      • -------- ------------------- --------
      • Set VariableSet SaveCount = 0
      • -------- ------------------- --------
      • Custom script: call DisplayTextToPlayer(GetTriggerPlayer(), 0, 0, "Saved " + User[udg_SaveLoadEvent_Player].nameColored)
      • -------- ------------------- --------
      • -------- ------------------- --------
      • -------- PUT YOUR SAVE ACTIONS HERE: --------
      • Set VariableSet SaveCount = (SaveCount + 1)
      • Set VariableSet SaveValue[SaveCount] = (Max(difficulty_setting, highest_difficulty_victory[(Player number of SaveLoadEvent_Player)]))
      • Set VariableSet SaveMaxValue[SaveCount] = 1000
      • Game - Display to (Player group(SaveLoadEvent_Player)) for 15.00 seconds the text: (Saved Loyalty: + (String(YourInteger[(Player number of SaveLoadEvent_Player)])))
      • -------- STOP --------
      • -------- ------------------- --------
      • -------- ------------------- --------
      • -------- ------------------- --------
      • -------- 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(udg_SaveLoadEvent_Player, 1)
      • Custom script: call SaveFile.create(udg_SaveLoadEvent_Player, "Save", 1, udg_SaveTempString)
  • Load Event
    • Events
      • Game - SaveLoadEvent becomes Equal to 1.00
    • Conditions
    • Actions
      • -------- ------------------- --------
      • -------- Validate --------
      • -------- ------------------- --------
      • Set VariableSet SaveCount = 0
      • 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)
      • -------- ------------------- --------
      • -------- ------------------- --------
      • -------- ------------------- --------
      • -------- PUT YOUR LOAD ACTIONS HERE: --------
      • Set VariableSet SaveCount = (SaveCount + 1)
      • Set VariableSet SaveMaxValue[SaveCount] = 1000
      • Custom script: call SaveHelper.GUILoadNext()
      • Set VariableSet highest_difficulty_victory[(Player number of SaveLoadEvent_Player)] = SaveValue[SaveCount]
      • Game - Display to (Player group(SaveLoadEvent_Player)) for 15.00 seconds the text: (Loaded Prestige: + (String(highest_difficulty_victory[(Player number of SaveLoadEvent_Player)])))
      • -------- STOP --------
      • -------- ------------------- --------
      • -------- ------------------- --------
      • -------- ------------------- --------
      • Custom script: call Savecode(udg_SaveTempInt).destroy()
 
Last edited:
Status
Not open for further replies.
Top