• 🏆 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 System For Interger Resource.

Status
Not open for further replies.
Level 7
Joined
Nov 6, 2019
Messages
186
Basically, i wanna add a resource to a map, using multiboard, i know hwo to set up MB and the Interger and that perfectly, however i dunnow how to create a Save/Load for it.

So You Get 50 Diamonds per 50 minutes, of game play, and want it to save to a Interger, so you get 300 total and then type -SUDA, so -save, but ima use -SUDA and it saves it to your CustomMap Data, then when u in another game u type -load, i be using -LUDA CODE and it add them points to Player Number Interger, so you start with 300 points, dont want it to save anything else, not hero, not items, not gold, not stone, just your Diamonds.

so DiamondsInt [0] 0, and when u got 300 points it changes int to DiamondInt [0] 300 and displays it on the multiboard.

using -SUDA to save the Code to CustomMapData

so if u die on game and save start new game it starts with DiamondInt [0] 0
and u load -LUDA (CODE) and it sets the DiamondInt [0] 0 to DiamondInt [0] 100

and obviously [0] is playerID
 
Level 7
Joined
Nov 6, 2019
Messages
186
So, How do i edit that to what am seeking, or is anyone else got a better trigger i can easily do with
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,539
Here's an edited version of that Save system. Type -LUDA to save your Gold, type -Load to load it.

I know you don't want to save Gold but a custom Integer instead so here's what you do:

In the "Type Save" trigger change the value of this from Gold to your Diamonds Variable:
  • Set Variable SaveValue[SaveCount] = (SaveLoadEvent_Player Current gold)
So it would look like:
  • Set Variable SaveValue[SaveCount] = Diamonds[Player Number of SaveLoadEvent_Player]
Then in the "Load Event" trigger replace this so it uses your Diamonds Variable instead:
  • Player - Set SaveLoadEvent_Player Current gold to SaveValue[SaveCount]
So it would look like:
  • Set Variable Diamonds[Player Number of SaveLoadEvent_Player] = SaveValue[SaveCount]
Also, make sure to add each Player to the Events for the "Type Save/Load" triggers. Like "Player 2 types -LUDA", "Player 3 types -LUDA", etc... because I made it work for only Player 1.
 

Attachments

  • Save and Load Example.w3x
    148.1 KB · Views: 97
Last edited:
Level 7
Joined
Nov 6, 2019
Messages
186
Here's an edited version of that Save system. Type -LUDA to save your Gold, type -Load to load it. It's case sensitive so make sure LUDA is in all capital letters.

I know you don't want to save Gold but a custom Integer instead so here's what you do:

In the "Type Save" trigger change the value of this from Gold to your Diamonds Variable:
  • Set Variable SaveValue[SaveCount] = (SaveLoadEvent_Player Current gold)
So it would look like:
  • Set Variable SaveValue[SaveCount] = Diamonds[Player Number of SaveLoadEvent_Player]
Then in the "Load Event" trigger replace this so it uses your Diamonds Variable instead:
  • Player - Set SaveLoadEvent_Player Current gold to SaveValue[SaveCount]
So it would look like:
  • Set Variable Diamonds[Player Number of SaveLoadEvent_Player] = SaveValue[SaveCount]
Also, make sure to add each Player to the Events for the "Type Save/Load" triggers. Like "Player 2 types -LUDA", "Player 3 types -LUDA", etc... because I made it work for only Player 1.

ah ok done that, but when i save for some reason it gets error

Line 1086: Undefined Type VarAsString_Real

VarAsString_Real udg_SaveLoadEvent= null

EDIT: NVM it saved now, just to test it.

EDIT2: Tested, it doesnt save, for some reason.

THis my save trigger, is how you put in the test map.

  • Type Save
    • Events
      • Player - Player 1 (Red) types a chat message containing -SUDA as An exact match
      • Player - Player 2 (Blue) types a chat message containing -SUDA as An exact match
      • Player - Player 3 (Teal) types a chat message containing -SUDA as An exact match
      • Player - Player 4 (Purple) types a chat message containing -SUDA as An exact match
      • Player - Player 5 (Yellow) types a chat message containing -SUDA as An exact match
      • Player - Player 6 (Orange) types a chat message containing -SUDA as An exact match
      • Player - Player 7 (Green) types a chat message containing -SUDA as An exact match
    • Conditions
    • Actions
      • Set VariableSet SaveLoadEvent_Player = (Triggering player)
      • -------- ------------------- --------
      • Set VariableSet SaveCount = 0
      • -------- ------------------- --------
      • -------- ------------------- --------
      • -------- ------------------- --------
      • -------- PUT YOUR SAVE ACTIONS HERE: --------
      • Set VariableSet SaveCount = (SaveCount + 1)
      • Set VariableSet SaveValue[SaveCount] = LoyaltyPoints[(Player number of SaveLoadEvent_Player)]
      • Set VariableSet SaveMaxValue[SaveCount] = 1000
      • -------- 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)
 
Last edited:

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,539
Edit:
Delete the ORIGINAL Codeless Save and Load folder and then copy and paste the one from my map. I think I tweaked a few things to make it work.

Edit 2:
I attached a new version of the map with exactly what you want. Delete ALL of the old Codeless Save+Load triggers before importing this.
 

Attachments

  • Save and Load Example 2.w3x
    148.4 KB · Views: 80
Last edited:
Level 7
Joined
Nov 6, 2019
Messages
186
Edit:
Delete the ORIGINAL Codeless Save and Load folder and then copy and paste the one from my map. I think I tweaked a few things to make it work.

Edit 2:
I attached a new version of the map with exactly what you want. Delete ALL of the old Codeless Save+Load triggers before importing this.


ok did that, and it still doesnt save to file, or give a code to load.

After you type the save command, it says saved, and how much Points, but it doesnt give a code or create a file for me to get code from, and as it isnt saving when i try load, it says no save file found.

EDIT: ok i got it to save the file, but when trying to load says no save file found
 
Last edited:

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,539
The save file is stored in: Documents/Warcraft3/CustomMapData/CodelessDemo
It should have the name: SaveSlot_1

Are you using the latest version? Patches up to date?

This is a Codeless save and load system so you don't actually have to type the code. Typing -load is all that's needed.
 
Level 7
Joined
Nov 6, 2019
Messages
186
The save file is stored in: Documents/Warcraft3/CustomMapData/CodelessDemo
It should have the name: SaveSlot_1

Are you using the latest version? Patches up to date?

i set it to save in UDAJS and yes the SaveSlot_1.pld file there

and yes patch 1.32 as well i play reforged but even if i didnt classic was forced to 1.32
 
Level 7
Joined
Nov 6, 2019
Messages
186
You changed the save path? Maybe that's the issue.

I'm really not sure why it wouldn't work otherwise. That map works fine for me (in singleplayer at least never tested it on bnet).

nope changing it to original CodelessDemo, saves, but says no save file tyring to load
 
Level 7
Joined
Nov 6, 2019
Messages
186
To clarify are you getting this error in YOUR map after importing it or in the Example Map I uploaded.

ok i see it works in test map, so i deleted entire code and copied it over again, and still doesnt load in my map, so must be my map, however it is the exact same as it is on the test map so i dunno issue

EDIT: is there anything i may have to change/fix after copying code over to get it to work.
 
Last edited:
Level 7
Joined
Nov 6, 2019
Messages
186
As it don’t work in JS map I gonna tear in a fresh map tomorrow, it is possible in the HS map is something effecting the system

it already has a Save/Load System in it, but don’t wanna mess with that it is working

ok now question for new map it a original not edit/bug fix to keep it alive like JS is

how easy is it to add more Save Variables to it, as my original coded map uses 5 Minerals

Coal
Iron
Gold
Sapphire
Ruby

atm the mineral system is disabled as it isnt generating the minerals like it meant to, and when you manually give minerals it meant to cost to train and buy certain things, but it still lets you train without having materials.

However I do plan to get it sorted /help to fix before release

pyro has been helping me with that system, but doesn’t work on my map, and he said he don’t got Reforged to look at my map and code see what I got wrong.

But now classic was force to update to reforged, pyro now has reforged editor, so gonna ask him to help again now he can check code if he doesn’t mind, I changed things since I uploaded my map last time to get help from Pyro, so will ask tomorrow when am at pc to upload map ver
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,539
Just copy and paste those 3 Variables under "PUT YOUR SAVE ACTIONS HERE:" but change Loyalty to Coal. Then copy and paste again and do the same thing for Iron, Gold, Sapphire, Ruby, etc...

SaveCount = SaveCount + 1
SaveValue[SaveCount] = YOUR VARIABLE (Loyalty/Gold/Coal/etc...)
SaveMaxValue[SaveCount] = An Integer that is greater than SaveValue[SaveCount] <--- This is the maximum amount of that Variable that you can save

^Repeat this process for each Variable you want to save.

Then in the Load Trigger you do almost the exact same thing. Copy and paste the variables under "PUT YOUR LOAD ACTIONS HERE:" and edit them to load Loyalty/Gold/Coal/etc...

HOWEVER, and here's the part where people screw up. You have to Load in the reverse order of how you saved your Variables. Meaning that the FIRST thing you load should be the variable that you saved LAST.

So like this:
1. Save Iron
2. Save Gold
3. Save Sapphire
//////////////////////
1. Load Sapphire
2. Load Gold
3. Load Iron
 
Last edited:
Level 7
Joined
Nov 6, 2019
Messages
186
Just copy and paste those 3 Variables under "PUT YOUR SAVE ACTIONS HERE:" but change Loyalty to Coal. Then copy and paste again and do the same thing for Iron, Gold, Sapphire, Ruby, etc...

SaveCount = SaveCount + 1
SaveValue[SaveCount] = YOUR VARIABLE (Loyalty/Gold/Coal/etc...)
SaveMaxValue[SaveCount] = An Integer that is greater than SaveValue[SaveCount] <--- This is the maximum amount of that Variable that you can save

^Repeat this process for each Variable you want to save.

Then in the Load Trigger you do almost the exact same thing. Copy and paste the variables under "PUT YOUR LOAD ACTIONS HERE:" and edit them to load Loyalty/Gold/Coal/etc...

HOWEVER, and here's the part where people screw up. You have to Load in the reverse order of how you saved your Variables. Meaning that the FIRST thing you load should be the variable that you saved LAST.

So like this:
1. Save Iron
2. Save Gold
3. Save Sapphire
//////////////////////
1. Load Sapphire
2. Load Gold
3. Load Iron


i am not sure what am doing wrong, again it saves, creates the file, but it doest load says file missing, also is this right i beleive so.

  • 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: --------
      • -------- Ruby --------
      • Set VariableSet SaveCount = (SaveCount + 1)
      • Set VariableSet SaveMaxValue[SaveCount] = 100000
      • Custom script: call SaveHelper.GUILoadNext()
      • Set VariableSet RubyMineral[(Player number of SaveLoadEvent_Player)] = SaveValue[SaveCount]
      • -------- Sapphire --------
      • Set VariableSet SaveCount = (SaveCount + 1)
      • Set VariableSet SaveMaxValue[SaveCount] = 100000
      • Custom script: call SaveHelper.GUILoadNext()
      • Set VariableSet SapphireMineral[(Player number of SaveLoadEvent_Player)] = SaveValue[SaveCount]
      • -------- Gold --------
      • Set VariableSet SaveCount = (SaveCount + 1)
      • Set VariableSet SaveMaxValue[SaveCount] = 100000
      • Custom script: call SaveHelper.GUILoadNext()
      • Set VariableSet GoldMineral[(Player number of SaveLoadEvent_Player)] = SaveValue[SaveCount]
      • -------- Iron --------
      • Set VariableSet SaveCount = (SaveCount + 1)
      • Set VariableSet SaveMaxValue[SaveCount] = 100000
      • Custom script: call SaveHelper.GUILoadNext()
      • Set VariableSet IronMineral[(Player number of SaveLoadEvent_Player)] = SaveValue[SaveCount]
      • -------- Coal --------
      • Set VariableSet SaveCount = (SaveCount + 1)
      • Set VariableSet SaveMaxValue[SaveCount] = 100000
      • Custom script: call SaveHelper.GUILoadNext()
      • Set VariableSet CoalMineral[(Player number of SaveLoadEvent_Player)] = SaveValue[SaveCount]
      • -------- Display --------
      • Game - Display to (Player group(SaveLoadEvent_Player)) for 30.00 seconds the text: (Loaded |cff000000Coal|r: + (String(CoalMineral[(Player number of SaveLoadEvent_Player)])))
      • Game - Display to (Player group(SaveLoadEvent_Player)) for 30.00 seconds the text: (Loaded |cffc0c0c0Iron|r: + (String(IronMineral[(Team number of SaveLoadEvent_Player)])))
      • Game - Display to (Player group(SaveLoadEvent_Player)) for 30.00 seconds the text: (Loaded |cff808000Gold|r: + (String(GoldMineral[(Player number of SaveLoadEvent_Player)])))
      • Game - Display to (Player group(SaveLoadEvent_Player)) for 30.00 seconds the text: (Loaded |cff0000ffSapphire|r: + (String(SapphireMineral[(Player number of SaveLoadEvent_Player)])))
      • Game - Display to (Player group(SaveLoadEvent_Player)) for 30.00 seconds the text: (Loaded |cffff0000Ruby|r: + (String(RubyMineral[(Player number of SaveLoadEvent_Player)])))
      • -------- STOP --------
      • -------- ------------------- --------
      • -------- ------------------- --------
      • -------- ------------------- --------
      • Custom script: call Savecode(udg_SaveTempInt).destroy()
  • Type Save
    • 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
      • Set VariableSet SaveLoadEvent_Player = (Triggering player)
      • -------- ------------------- --------
      • Set VariableSet SaveCount = 0
      • -------- ------------------- --------
      • Custom script: call DisplayTextToPlayer(GetTriggerPlayer(), 0, 0, "Saved " + User[udg_SaveLoadEvent_Player].nameColored)
      • -------- ------------------- --------
      • -------- ------------------- --------
      • -------- PUT YOUR SAVE ACTIONS HERE: --------
      • -------- Coal --------
      • Set VariableSet SaveCount = (SaveCount + 1)
      • Set VariableSet SaveValue[SaveCount] = CoalMineral[(Player number of SaveLoadEvent_Player)]
      • Set VariableSet SaveMaxValue[SaveCount] = 100000
      • -------- Iron --------
      • Set VariableSet SaveCount = (SaveCount + 1)
      • Set VariableSet SaveValue[SaveCount] = IronMineral[(Player number of SaveLoadEvent_Player)]
      • Set VariableSet SaveMaxValue[SaveCount] = 100000
      • -------- Gold --------
      • Set VariableSet SaveCount = (SaveCount + 1)
      • Set VariableSet SaveValue[SaveCount] = GoldMineral[(Player number of SaveLoadEvent_Player)]
      • Set VariableSet SaveMaxValue[SaveCount] = 100000
      • -------- Sapphire --------
      • Set VariableSet SaveCount = (SaveCount + 1)
      • Set VariableSet SaveValue[SaveCount] = SapphireMineral[(Player number of SaveLoadEvent_Player)]
      • Set VariableSet SaveMaxValue[SaveCount] = 100000
      • -------- Ruby --------
      • Set VariableSet SaveCount = (SaveCount + 1)
      • Set VariableSet SaveValue[SaveCount] = RubyMineral[(Player number of SaveLoadEvent_Player)]
      • Set VariableSet SaveMaxValue[SaveCount] = 100000
      • -------- Save Notice --------
      • Game - Display to (Player group(SaveLoadEvent_Player)) for 30.00 seconds the text: (Saved |cff000000Coal|r: + (String(CoalMineral[(Player number of SaveLoadEvent_Player)])))
      • Game - Display to (Player group(SaveLoadEvent_Player)) for 30.00 seconds the text: (Saved |cffc0c0c0Iron|r: + (String(IronMineral[(Team number of SaveLoadEvent_Player)])))
      • Game - Display to (Player group(SaveLoadEvent_Player)) for 30.00 seconds the text: (Saved |cff808000Gold|r: + (String(GoldMineral[(Player number of SaveLoadEvent_Player)])))
      • Game - Display to (Player group(SaveLoadEvent_Player)) for 30.00 seconds the text: (Saved |cff0000ffSapphire|r: + (String(SapphireMineral[(Player number of SaveLoadEvent_Player)])))
      • Game - Display to (Player group(SaveLoadEvent_Player)) for 30.00 seconds the text: (Saved |cffff0000Ruby|r: + (String(RubyMineral[(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)
  • Type Load
    • Events
      • Player - Player 1 (Red) types a chat message containing -load as An exact match
      • Player - Player 2 (Blue) types a chat message containing -load as An exact match
      • Player - Player 3 (Teal) types a chat message containing -load as An exact match
      • Player - Player 4 (Purple) types a chat message containing -load as An exact match
      • Player - Player 5 (Yellow) types a chat message containing -load as An exact match
      • Player - Player 6 (Orange) types a chat message containing -load as An exact match
      • Player - Player 7 (Green) types a chat message containing -load as An exact match
      • Player - Player 8 (Pink) types a chat message containing -load as An exact match
    • Conditions
    • Actions
      • Set VariableSet SaveLoadEvent_Player = (Triggering player)
      • -------- ------------------- --------
      • -------- This runs the Event used in Load Event and tells it to load Save Slot 1 --------
      • Custom script: call LoadSaveSlot(udg_SaveLoadEvent_Player, 1)

NOTE: if these don't look right let me know what looks wrong, and if it does look right i can uplaod map for u to look if u want.

This is when you save

Saved.png


This is when you load.

Loaded.png
 
Last edited:

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,539
You tried that in an entirely new map and it still didn't work?

I didn't make the system so I don't really know what's going on. I don't understand why it would work for me but not for you seeing as how we're on the same exact version.

And yeah, you did it correctly. Although, I would be careful with setting the Max Save Value to too high of a number, it can eventually cause the code to be too long. It might be fine if you're only saving 5 Integers.

Do you mind creating and uploading a new map with those triggers + the save system folder so I can test it myself?
 
Level 7
Joined
Nov 6, 2019
Messages
186
You tried that in an entirely new map and it still didn't work?

I didn't make the system so I don't really know what's going on. I don't understand why it would work for me but not for you seeing as how we're on the same exact version.

And yeah, you did it correctly. Although, I would be careful with setting the Max Save Value to too high of a number, it can eventually cause the code to be too long. It might be fine if you're only saving 5 Integers.

Do you mind creating and uploading a new map with those triggers + the save system folder so I can test it myself?

i can just upload my actual maps, for you to test yourself, as recreating the generator trigger would take along time i prob mess something up more than it alreayd is

but i will see may not be as hard as i think, ah nvm it didnt break transfering it over, and for the code too big, the save system doesnt give u a load code.
 
Last edited:

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,539
Why would recreating it take a long time? Just copy the Save+Load folder and paste it into a new map. You can even move those 3 Triggers (Type Save/Type Load/Load Event) into the same folder so you can copy everything in one go.

Hmm, maybe this is your problem. Do you have "Automatically create unknown variables while pasting trigger data" turned on? It's under File/Preferences in the Editor.

You shouldn't be getting any errors when importing the system.

Edit: I'm on my laptop which hasn't installed Reforged yet. I'll check it out as soon as it's done installing.
 
Level 7
Joined
Nov 6, 2019
Messages
186
Why would recreating it take a long time? Just copy the Save+Load folder and paste it into a new map. You can even move those 3 Triggers (Type Save/Type Load/Load Event) into the same folder so you can copy everything in one go.

Hmm, maybe this is your problem. Do you have "Automatically create unknown variables while pasting trigger data" turned on? It's under File/Preferences in the Editor.

You shouldn't be getting any errors when importing the system.

Because i always break something, but is all good i was wrong, it didnt break, but still doesnt save, i made test map and yes i have auto create variables on
 

Attachments

  • TestMap.w3m
    54.4 KB · Views: 25

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,539
Alright, so your map wouldn't work for me either. However, I imported your Mineral triggers into my map and it worked fine. So that means that something must be wrong with your Save/Load system.

I recommend deleting the "Codeless Save and Load" folder and the Type Save, Type Load, and Load Event triggers. So completely remove the Save/Load system from your map. Then open my map and copy and paste the "Codeless Save and Load" folder into your map. Then copy and paste the "Uncle Save and Load Triggers" folder into your map. Then test it to see if it works.

I added Coal to my save/load triggers so you can test it right away without having to add in your minerals. If that still doesn't work then I don't know.
 

Attachments

  • Save and Load Example 3.w3x
    161.3 KB · Views: 66
Level 7
Joined
Nov 6, 2019
Messages
186
Alright, so your map wouldn't work for me either. However, I imported your Mineral triggers into my map and it worked fine. So that means that something must be wrong with your Save/Load system.

I recommend deleting the "Codeless Save and Load" folder and the Type Save, Type Load, and Load Event triggers. So completely remove the Save/Load system from your map. Then open my map and copy and paste the "Codeless Save and Load" folder into your map. Then copy and paste the "Uncle Save and Load Triggers" folder into your map. Then test it to see if it works.

I added Coal to my save/load triggers so you can test it right away without having to add in your minerals. If that still doesn't work then I don't know.

Nope still didnt work, it says Save File not found still.
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,539
Okay, I found the problem. I created a new map on 1.32 and got the same error as you, "save file not found". I believe the reason my Example maps work is because they were made on 1.31.

The Codeless Save and Load system must be bugged on any map made using the current 1.32 version. I think you'll have to wait for some bug fixes/a new patch before we can use this system. Hopefully Blizzard doesn't take their sweet time.
 
Level 7
Joined
Nov 6, 2019
Messages
186
Okay, I found the problem. I created a new map on 1.32 and got the same error as you, "save file not found". I believe the reason my Example maps work is because they were made on 1.31.

The Codeless Save and Load system must be bugged on any map made using the current 1.32 version. I think you'll have to wait for some bug fixes/a new patch before we can use this system. Hopefully Blizzard doesn't take their sweet time.


ah fair enough, i didnt know u could use older Editor, thought it force updated everyone to 1.32, so i didnt even think that could be a issue
 
Level 7
Joined
Nov 6, 2019
Messages
186
The map was made months ago.


yes but u edited the map to make the uncle load save folder, past few days where everyone was on 1.32 and it still worked, so yes map made months ago, but ur example map was made past few days, Anywho i shall wait on a patch/update to 1.32 :) thanx for all your help so far.
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,539
yes but u edited the map to make the uncle load save folder, past few days where everyone was on 1.32 and it still worked, so yes map made months ago, but ur example map was made past few days, Anywho i shall wait on a patch/update to 1.32 :) thanx for all your help so far.
Yeah, but the map still works even after editing it, so I think it's still considered "1.31" version. It's a really weird problem... I guess when you create a new map on the current version Editor there's some kind of internal change that we can't see that screws everything up.

Anyway, you're welcome and hopefully it will all get sorted out soon.
 
Level 7
Joined
Nov 6, 2019
Messages
186
Yeah, but the map still works even after editing it, so I think it's still considered "1.31" version. It's a really weird problem... I guess when you create a new map on the current version Editor there's some kind of internal change that we can't see that screws everything up.

Anyway, you're welcome and hopefully it will all get sorted out soon.


my map was made on 1.31 originally, and not edited on 1.32 till u sent test map so i dunno
 
Level 7
Joined
Nov 6, 2019
Messages
186
I found a problem, guys. Everything turned out to be much simpler, the problem is not in the patch. You just need to create level 2 for "Amls", because your code is saved there in the tooltip of this ability.
'

i tried that, as you said, but again it doesnt load the code, says fiel not found still.
 
Level 18
Joined
Mar 16, 2008
Messages
721
This thread is very on point to my issue (Suggest How to Simplify This Save/Load System?) but I am still a bit confused.
...open my map and copy and paste the "Codeless Save and Load" folder into your map. Then copy and paste the "Uncle Save and Load Triggers" folder into your map...
1) Is the entire system necessary? It has a lot in there about hero level etc., which I do not want that data to be loaded.
2) Do the Events need to stay the same in the Uncle version? I was thinking change event to run at start and run save when victory runs.
3) the only integer that matters in my map is udg_difficulty_setting, where would I put this into trigger?

EDIT:
1) is there just a simple function to save udg_integer to folder / simple function to load udg_integer? what is that function
 
Last edited:

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,539
This thread is very on point to my issue (Suggest How to Simplify This Save/Load System?) but I am still a bit confused.

1) Is the entire system necessary? It has a lot in there about hero level etc., which I do not want that data to be loaded.
2) Do the Events need to stay the same in the Uncle version? I was thinking change event to run at start and run save when victory runs.
3) the only integer that matters in my map is udg_difficulty_setting, where would I put this into trigger?

EDIT:
1) is there just a simple function to save udg_integer to folder / simple function to load udg_integer? what is that function
1) I deleted most of the fluff.
2) The Events don't need to stay the same. Just follow the pattern. You Set SaveLoadEvent_Player to your desired Player and then you run the Actions.
3) You can see where I'm saving and loading my variables, I put all caps comments that say PUT YOUR SAVE ACTIONS HERE / STOP.
 

Attachments

  • Save and Load Example One Int.w3x
    146.4 KB · Views: 12
Level 18
Joined
Mar 16, 2008
Messages
721
udg_SaveValue[SaveCount] is the integer data that will be loaded later?

this should compare the current difficulty vs the highest saved difficulty, and save the highest[???]:
  • Set VariableSet SaveValue[SaveCount] = (Max(difficulty_setting, SaveValue[SaveCount]))
Edit: How can I access the loaded data in a trigger?
 
Last edited:

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,539
udg_SaveValue[SaveCount] is the integer data that will be loaded later?

this should compare the current difficulty vs the highest saved difficulty, and save the highest[???]:
  • Set VariableSet SaveValue[SaveCount] = (Max(difficulty_setting, SaveValue[SaveCount]))
Edit: How can I access the loaded data in a trigger?
Yes. When you save the game you're filling an Integer array (SaveValue) with data to be saved. When you load the game you're rebuilding this Array but in reverse order. In your case you don't have to worry about the reverse order thing since you're only saving/loading one variable.
This is basically what's happening:
  • /// SAVE ///
  • Set Variable SaveValue[1] = MyGold
  • Set Variable SaveValue[2] = MyLumber
  • /// LOAD (order has to be reversed!) ///
  • Set Variable MyLumber = SaveValue[1]
  • Set Variable MyGold = SaveValue[2]
You would store the loaded data into one of your variables or simply reference it right then and there. For example, if you were loading the Hero Level you would probably want to apply it right away to your Hero rather than store it in a variable to use later.

In your case it looks like you need two Integer variables:
Difficulty_Setting
Loaded_Difficulty_Setting

When you choose a game difficulty you Set Difficulty_Setting to some value.

When you save the game you Set SaveValue[SaveCount] = Difficulty_Setting.

When you load the game you Set Loaded_Difficulty_Setting = SaveValue[SaveCount].

You now have the current difficulty setting that was chosen earlier in the match and the loaded difficulty setting which was taken from your save file.

If you only want to save Difficulty_Setting if it's > Loaded_Difficulty_Setting, add an If Then Else to your Save trigger that compares these two values before setting SaveValue:
  • If Difficulty_Setting Greater than Loaded_Difficulty_Setting then Set Variable SaveValue[SaveCount] = Difficulty_Setting
  • ELSE Set Variable SaveValue[SaveCount] = Loaded_Difficulty_Setting
This way the Player doesn't overwrite their save file with a lesser difficulty.

You would want to use an Array for Loaded_Difficulty_Setting if you want to be able save multiple players. Just throw in the SaveLoadEvent_Player's player number into the [index].
 
Last edited:
Level 18
Joined
Mar 16, 2008
Messages
721
Uncle - I can't sing enough praise for your generosity and knowledge. Two traits that aren't commonly paired.

Sorry to be a pest but I am really struggling in configuring this system. If you have a moment, could you look these over. They don't seem to be working D:

i'm calling loaded_difficulty, highest_difficulty_victory

I get a "save" message but doesn't seem to load the next game?

  • auto load red
    • Events
      • Time - Elapsed game time is 1.00 seconds
    • Conditions
    • Actions
      • Set VariableSet SaveLoadEvent_Player = Player 1 (Red)
      • Set VariableSet highest_difficulty_victory[1] = SaveValue[SaveCount]
      • 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
      • -------- ------------------- --------
      • -------- ------------------- --------
      • -------- ------------------- --------
      • -------- PUT YOUR SAVE ACTIONS HERE: --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • difficulty_setting Greater than highest_difficulty_victory[(Player number of SaveLoadEvent_Player)]
        • Then - Actions
          • Set VariableSet SaveCount = (SaveCount + 1)
          • Set VariableSet SaveValue[SaveCount] = difficulty_setting
          • Set VariableSet SaveMaxValue[SaveCount] = 1000
          • Game - Display to (Player group(SaveLoadEvent_Player)) for 30.00 seconds the text: (Saved Prestige: + difficulty_string[difficulty_setting])
        • Else - Actions
          • Set VariableSet SaveCount = (SaveCount + 1)
          • Set VariableSet SaveValue[SaveCount] = highest_difficulty_victory[(Player number of SaveLoadEvent_Player)]
          • Set VariableSet SaveMaxValue[SaveCount] = 1000
          • Game - Display to (Player group(SaveLoadEvent_Player)) for 30.00 seconds the text: (Saved Prestige: + difficulty_string[highest_difficulty_victory[(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)
  • victory 1
    • Events
    • Conditions
    • Actions
      • Trigger - Run auto save red <gen> (ignoring conditions)
  • Set VariableSet MapName = Defense of Felwood_test
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,539
Thank you for the kind words :D

I don't think you quite understood what I meant though as your triggers are incorrect.

Try this new map out, it should do exactly what you want and should be easier to understand.

Type 1, 2, or 3 to set the game difficulty. Do this fast because the map is setup to Autoload after 4.00 seconds and Autosave after 5.00 seconds.

You can delete the Set Difficulty triggers since your map already has triggers for this. Then you can customize the Events for Autosave and Autoload to happen when you want them to. Also, I currently save/load for ALL PLAYERS, you may want to modify that.
 

Attachments

  • Save and Load Example One Int.w3x
    149 KB · Views: 12
Last edited:
Level 18
Joined
Mar 16, 2008
Messages
721
EDIT: I think udg_SaveLoadEvent_Player isn't being set??????????????????????????!!!!!!!!!!!!!!!!!

It works on your example.

Sorry for my inability but it's not saving now D:

EDIT/UPDATE: still trouble shooting, perhaps because I'm doing local area network test it's not working? But that worked when I tested your example. Very puzzled why this isn't working at this point... D:

Thanks for your attention (or anyone else's who has any input on this topic!)

  • Autosave
    • Events
    • Conditions
    • Actions
      • Player Group - Pick every player in (All players) and do (Actions)
        • Loop - Actions
          • Set VariableSet SaveLoadEvent_Player = (Picked player)
          • Set VariableSet SaveLoadEvent_PN = (Player number of SaveLoadEvent_Player)
          • -------- --------
          • 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)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • difficulty_setting Greater than highest_difficulty_victory[(Player number of SaveLoadEvent_Player)]
            • Then - Actions
              • Set VariableSet SaveValue[SaveCount] = difficulty_setting
              • Game - Display to (Player group(SaveLoadEvent_Player)) for 15.00 seconds the text: (Prestige saved: + difficulty_string[difficulty_setting])
            • Else - Actions
              • Set VariableSet SaveValue[SaveCount] = highest_difficulty_victory[(Player number of SaveLoadEvent_Player)]
              • Game - Display to (Player group(SaveLoadEvent_Player)) for 15.00 seconds the text: (Prestige saved: + difficulty_string[highest_difficulty_victory[(Player number of SaveLoadEvent_Player)]])
          • Set VariableSet SaveMaxValue[SaveCount] = 1000
          • -------- 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)
  • main spawn 1
    • Events
      • Time - nextwave_timer expires
    • Conditions
    • Actions
      • ...
      • ...
      • -------- Check if Victory --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • spawn_counter Greater than or equal to 30
          • defeat_counter Less than 5
        • Then - Actions
          • ...
          • ...
          • Trigger - Run Autosave <gen> (ignoring conditions)
          • Trigger - Run victory 1 <gen> (ignoring conditions)
          • Skip remaining actions
        • Else - Actions
          • ...
  • difficulty click
    • Events
      • Dialog - A dialog button is clicked for difficulty_menu
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Clicked dialog button) Equal to exploration_button
        • Then - Actions
          • Set VariableSet difficulty_setting = 0
          • Set VariableSet explor_bool = True
          • Countdown Timer - Pause nextwave_timer
          • Countdown Timer - Start nextwave_timer as a One-shot timer that will expire in 750.00 seconds
          • Dialog - Clear difficulty_menu
          • Dialog - Change the title of difficulty_menu to Choose |cff808080Ex...
          • Dialog - Create a dialog button for difficulty_menu labelled Easy
          • Set VariableSet difficulty_button[0] = (Last created dialog Button)
          • Dialog - Create a dialog button for difficulty_menu labelled Normal
          • Set VariableSet difficulty_button[1] = (Last created dialog Button)
          • Dialog - Create a dialog button for difficulty_menu labelled |cffff0000Heroic|r
          • Set VariableSet difficulty_button[2] = (Last created dialog Button)
          • Dialog - Create a dialog button for difficulty_menu labelled |cff990000Mythic|r
          • Set VariableSet difficulty_button[3] = (Last created dialog Button)
          • Dialog - Create a dialog button for difficulty_menu labelled |cff660000Mythic+|r
          • Set VariableSet difficulty_button[4] = (Last created dialog Button)
          • Dialog - Create a dialog button for difficulty_menu labelled |cff220000Impossibl...
          • Set VariableSet difficulty_button[5] = (Last created dialog Button)
          • Dialog - Show difficulty_menu for Player 1 (Red)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Player 1 (Red) slot status) Equal to Is playing
            • Then - Actions
            • Else - Actions
              • Dialog - Show difficulty_menu for Player 2 (Blue)
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Player 2 (Blue) slot status) Equal to Is playing
                • Then - Actions
                • Else - Actions
                  • Dialog - Show difficulty_menu for Player 3 (Teal)
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Player 3 (Teal) slot status) Equal to Is playing
                    • Then - Actions
                    • Else - Actions
                      • Dialog - Show difficulty_menu for Player 4 (Purple)
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Clicked dialog button) Equal to difficulty_button[0]
        • Then - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • explor_bool Equal to False
            • Then - Actions
              • Set VariableSet difficulty_setting = 0
              • Quest - Display to (All players) the Simple Hint message: (Difficulty Selected: + Easy)
              • Hero - Set Magtheridon 0168 <gen> Hero-level to 10, Hide level-up graphics
              • Unit - Set Max HP of Magtheridon 0168 <gen> to 1500
              • For each (Integer B) from 1 to 60, do (Actions)
                • Loop - Actions
                  • Unit - Set Unit: Magtheridon 0168 <gen>'s Weapon Integer Field: Attack Damage Base ('ua1b')at Index:(Integer B) to Value: 1
              • For each (Integer B) from 1 to 6, do (Actions)
                • Loop - Actions
                  • Item - Remove (Item carried by Magtheridon 0168 <gen> in slot (Integer B))
              • Hero - Create Shadow Orb +3 and give it to Magtheridon 0168 <gen>
              • Item - Make (Last created item) Undroppable
              • Hero - Set Archimonde 0069 <gen> Hero-level to 12, Hide level-up graphics
              • Unit - For Archimonde 0069 <gen>, Ability Bash, Disable ability: True, Hide UI: True
              • Item - Remove (Item carried by Archimonde 0069 <gen> in slot 1)
              • Hero - Create Orb of Corruption and give it to Archimonde 0069 <gen>
              • Item - Make (Last created item) Undroppable
              • Trigger - Turn off (This trigger)
            • Else - Actions
              • Set VariableSet difficulty_setting = 0
              • Quest - Display to (All players) the Simple Hint message: (Difficulty Selected: + (Easy + |cff808080Exploration|r))
              • Hero - Set Magtheridon 0168 <gen> Hero-level to 10, Hide level-up graphics
              • Unit - Set Max HP of Magtheridon 0168 <gen> to 1500
              • For each (Integer B) from 1 to 60, do (Actions)
                • Loop - Actions
                  • Unit - Set Unit: Magtheridon 0168 <gen>'s Weapon Integer Field: Attack Damage Base ('ua1b')at Index:(Integer B) to Value: 1
              • For each (Integer B) from 1 to 6, do (Actions)
                • Loop - Actions
                  • Item - Remove (Item carried by Magtheridon 0168 <gen> in slot (Integer B))
              • Hero - Create Shadow Orb +3 and give it to Magtheridon 0168 <gen>
              • Item - Make (Last created item) Undroppable
              • Hero - Set Archimonde 0069 <gen> Hero-level to 12, Hide level-up graphics
              • Unit - For Archimonde 0069 <gen>, Ability Bash, Disable ability: True, Hide UI: True
              • Item - Remove (Item carried by Archimonde 0069 <gen> in slot 1)
              • Hero - Create Orb of Corruption and give it to Archimonde 0069 <gen>
              • Item - Make (Last created item) Undroppable
              • Trigger - Turn off (This trigger)
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Clicked dialog button) Equal to difficulty_button[1]
        • Then - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • explor_bool Equal to False
            • Then - Actions
              • Set VariableSet difficulty_setting = 1
              • Quest - Display to (All players) the Secret message: (Difficulty Selected: + Normal)
              • Trigger - Turn off (This trigger)
            • Else - Actions
              • Set VariableSet difficulty_setting = 1
              • Quest - Display to (All players) the Secret message: (Difficulty Selected: + (Normal + |cff808080Exploration|r))
              • Trigger - Turn off (This trigger)
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Clicked dialog button) Equal to difficulty_button[2]
        • Then - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • explor_bool Equal to False
            • Then - Actions
              • Set VariableSet difficulty_setting = 2
              • Quest - Display to (All players) the Secret message: (Difficulty Selected: + |cffff0000Heroic|r)
              • Trigger - Turn off (This trigger)
            • Else - Actions
              • Set VariableSet difficulty_setting = 2
              • Quest - Display to (All players) the Secret message: (Difficulty Selected: + (|cffff0000Heroic|r + |cff808080Exploration|r))
              • Trigger - Turn off (This trigger)
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Clicked dialog button) Equal to difficulty_button[3]
        • Then - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • explor_bool Equal to False
            • Then - Actions
              • Set VariableSet difficulty_setting = 3
              • Quest - Display to (All players) the Secret message: (Difficulty Selected: + |cff990000Mythic|r)
              • Trigger - Turn off (This trigger)
            • Else - Actions
              • Set VariableSet difficulty_setting = 3
              • Quest - Display to (All players) the Secret message: (Difficulty Selected: + (|cff990000Mythic|r + |cff808080Exploration|r))
              • Trigger - Turn off (This trigger)
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Clicked dialog button) Equal to difficulty_button[4]
        • Then - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • explor_bool Equal to False
            • Then - Actions
              • Set VariableSet difficulty_setting = 4
              • Quest - Display to (All players) the Secret message: (Difficulty Selected: + |cff660000Mythic+|r)
              • Trigger - Turn off (This trigger)
            • Else - Actions
              • Set VariableSet difficulty_setting = 4
              • Quest - Display to (All players) the Secret message: (Difficulty Selected: + (|cff660000Mythic+|r + |cff808080Exploration|r))
              • Trigger - Turn off (This trigger)
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Clicked dialog button) Equal to difficulty_button[5]
        • Then - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • explor_bool Equal to False
            • Then - Actions
              • Set VariableSet difficulty_setting = 5
              • Quest - Display to (All players) the Secret message: (Difficulty Selected: + |cff220000Impossible|r)
              • Trigger - Turn off (This trigger)
            • Else - Actions
              • Set VariableSet difficulty_setting = 5
              • Quest - Display to (All players) the Secret message: (Difficulty Selected: + (|cff220000Impossible|r + |cff808080Exploration|r))
              • Trigger - Turn off (This trigger)
        • Else - Actions
 
Last edited:
Status
Not open for further replies.
Top