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

[solved] Effane tutorial / automatic save load text file

Status
Not open for further replies.
Level 4
Joined
May 15, 2022
Messages
10
Hi all, I clicked through around 30 threads before posting and wasn't able to find a link that didn't 404 or answered the question. If i missed something - please let me know! was trying to avoid posting...

Anyways, I'm using the Effane tutorial for save/load. It works great - but unfortunately part 2,3, & 4 all 404 when I click on the links.
Effanes tutorial

What I'd like to do is write a text file, storing the final number from the save (var SaveLoadFinalString) , and then check for that file at the beginning of the game and automatically load it in for that player so that you don't need to type it in or worry about taking a screenshot.

I found one answer in a few threads from ap0calypse, showing how to save/write the file (link at the bottom)

however, unless I'm mistaken, it doesn't show how to read this file at the start of the game, and enter the code automatically for that specific player.

It just needs to save that single string, SaveLoadFinalString.

tl;dr Wondering how to make a read/load function for the save file that will write the code in for the player with the system posted in the hiveworkshop link

Hive Link
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,534
I'm assuming you're on an older version which is why you don't want to use this system: Codeless Save and Load (Multiplayer) - v3.0.1

But just in case I attached a map with a working example of the above system with autoloading/autosaving and some other changes that I found preferable.

Anyway, there's no way to "write the code in for the player" but you can read the code and decrypt it to figure out what's been saved and then use that information to create your units/items/add resources/etc. You use the Preload natives to do this.

Note that most of the older threads on this topic will suggest things that may be outdated. It depends on which version of wc3 you're using.
 

Attachments

  • Save and Load Heroes.w3x
    154.4 KB · Views: 11
Level 4
Joined
May 15, 2022
Messages
10
I'm assuming you're on an older version which is why you don't want to use this system: Codeless Save and Load (Multiplayer) - v3.0.1

But just in case I attached a map with a working example of the above system with autoloading/autosaving and some other changes that I found preferable.

Anyway, there's no way to "write the code in for the player" but you can read the code and decrypt it to figure out what's been saved and then use that information to create your units/items/add resources/etc. You use the Preload natives to do this.

Note that most of the older threads on this topic will suggest things that may be outdated. It depends on which version of wc3 you're using.
I'm on the newest version, made the map about a year ago and that save/load is just what I stumbled upon and it worked. Was hoping to just save/read the text file so i wouldn't have to alter it at all, and just add triggers/jass in on top of it.

I'll take a look at the codeless save load system, but the thread says you need local files enabled and such - does this mean there will be players it won't work for?

Was just thinking about this after playing LTW and HO G TD, which both have excellent systems that don't require any user input.

Thank you for your time and the reply!
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,534
I'm on the newest version, made the map about a year ago and that save/load is just what I stumbled upon and it worked. Was hoping to just save/read the text file so i wouldn't have to alter it at all, and just add triggers/jass in on top of it.

I'll take a look at the codeless save load system, but the thread says you need local files enabled and such - does this mean there will be players it won't work for?

Was just thinking about this after playing LTW and HO G TD, which both have excellent systems that don't require any user input.

Thank you for your time and the reply!
Local files are no longer needed and the map is designed to detect and adapt to the player's game version so you shouldn't have to worry about that. This is the best save/load system we have available for GUI users.
 
Level 4
Joined
May 15, 2022
Messages
10
Local files are no longer needed and the map is designed to detect and adapt to the player's game version so you shouldn't have to worry about that. This is the best save/load system we have available for GUI users.
Good to know, thank you! I'm going to attempt to replace the effane save/load with the one you linked.

the readme in the file says it's for pre-reforged, assuming that doesn't matter, I'm curious what the changes you made in the map were?
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,534
Good to know, thank you! I'm going to attempt to replace the effane save/load with the one you linked.

the readme in the file says it's for pre-reforged, assuming that doesn't matter, I'm curious what the changes you made in the map were?
There were a lot of issues when Reforged first came out so that readme could be outdated information. Also, the system was 100% working prior to Reforged so I imagine that's sort of like a disclaimer for Reforged users. That being said, I've tested the system on the latest version and it works fine.

What I did was remove some of the helper functions and the Dialog menu that came with the original system. I found that most users including myself didn't want that extra stuff and simply wanted the option to save/load Integers, whether that be in the form of a Hero, Items, Wins, MMR, etc. I also show examples of how to setup Autosaving/Autoloading.

A very important note: Make sure your Aerial Shackles ability is setup to be the same as the one in my demo map. If you're using that ability in your map for anything then copy and paste it and use that copy instead. The original ability must be the same as the one in the demo map.
 
Level 4
Joined
May 15, 2022
Messages
10
There were a lot of issues when Reforged first came out so that readme could be outdated information. Also, the system was 100% working prior to Reforged so I imagine that's sort of like a disclaimer for Reforged users. That being said, I've tested the system on the latest version and it works fine.

What I did was remove some of the helper functions and the Dialog menu that came with the original system. I found that most users including myself didn't want that extra stuff and simply wanted the option to save/load Integers, whether that be in the form of a Hero, Items, Wins, MMR, etc. I also show examples of how to setup Autosaving/Autoloading.

A very important note: Make sure your Aerial Shackles ability is setup to be the same as the one in my demo map. If you're using that ability in your map for anything then copy and paste it and use that copy instead. The original ability must be the same as the one in the demo map.
Makes sense - I'll use your map for implementation! Just before I start; I'll need both trigger folders (codeless save load + uncle save load) correct? Briefly reading over, will this also require some jass editing, or should I be able to figure it out via the GUI triggers? I haven't really used JASS before, I'm sure I can figure it out with enough time, just want to make sure I'm starting off on the right foot

Thanks for all the replies again, really excited to get this working.
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,534
Makes sense - I'll use your map for implementation! Just before I start; I'll need both trigger folders (codeless save load + uncle save load) correct? Briefly reading over, will this also require some jass editing, or should I be able to figure it out via the GUI triggers? I haven't really used JASS before, I'm sure I can figure it out with enough time, just want to make sure I'm starting off on the right foot

Thanks for all the replies again, really excited to get this working.
No Jass editing required, and yes you'll need both folders.

My folder will be your main focus outside of changing the name of the Save folder in the system's config trigger.

To give you an idea of what you'll be doing, let's say you want to strictly use the Autosaving/Autoloading triggers:

Step 1: Delete the Manual Save/Manual Load triggers.

Step 2: Edit the Autosave/Autoload triggers so that they happen when you want them to. By default I load the players at the 0.50 second mark and I'm saving the players every 10.00 seconds. It's probably better to save at larger intervals since it can be a somewhat taxing process. Also, sometimes it's useful to force a Save when certain things in the game happen (IE: players win the game, save before they quit).

Step 3: Edit the Save Data and Load Data triggers. This is where you'll spend most of your time. These triggers manage what data gets saved and what data gets loaded.

That's about it.

And these triggers are meant to be examples/demonstrations more than requirements:
Map Start
GetItemTypeIndex
GetHeroTypeIndex

In Map Start I'm defining a bunch of variables which I use in my Save Data/Load Data triggers. The Get triggers are simply there to help me determine which Hero/Item a player has.

So maybe in your case you only want to save/load a player's Gold, in which case these 3 triggers wouldn't be necessary at all.
 
Last edited:
Level 4
Joined
May 15, 2022
Messages
10
No Jass editing required, and yes you'll need both folders.

My folder will be your main focus outside of changing the name of the Save folder in the system's config trigger.

To give you an idea of what you'll be doing, let's say you want to strictly use the Autosaving/Autoloading triggers:

Step 1: Delete the Manual Save/Manual Load triggers.

Step 2: Edit the Autosave/Autoload triggers so that they happen when you want them to. By default I load the players at the 0.50 second mark and I'm saving the players every 10.00 seconds. It's probably better to save at larger intervals since it can be a somewhat taxing process. Also, sometimes it's useful to force a Save when certain things in the game happen (IE: players win the game, save before they quit).

Step 3: Edit the Save Data and Load Data triggers. This is where you'll spend most of your time. These triggers manage what data gets saved and what data gets loaded.

That's about it.

And these triggers are meant to be examples/demonstrations more than requirements:
Map Start
GetItemTypeIndex
GetHeroTypeIndex

In Map Start I'm defining a bunch of variables which I use in my Save Data/Load Data triggers. The Get triggers are simply there to help me determine which Hero/Item a player has.

So maybe in your case you only want to save/load a player's Gold, in which case these 3 triggers wouldn't be necessary at all.

EDIT I found the problem. It now loads. Only problem now are the numbers I'm loading back in aren't working, and everything is default (0) going to see if it's a problem with a trigger unrelated to this and try and figure it out. If i get stuck I'll post the triggers and see if I made a mistake somewhere.
Thank you!
 
Last edited:

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,534
EDIT I found the problem. It now loads. Only problem now are the numbers I'm loading back in aren't working, and everything is default (0) going to see if it's a problem with a trigger unrelated to this and try and figure it out. If i get stuck I'll post the triggers and see if I made a mistake somewhere.
Thank you!
Follow the pattern used in my examples.
Aerial Shackles must be setup properly.
SaveMaxValue must be setup correctly.
You must load in the reverse order of how you saved.
 
Level 4
Joined
May 15, 2022
Messages
10
I copy/pasted the folders and edited in my values, put the load reversed from the save, and triple checked the aerial shackles edited lines and made sure mine was the same (level 2, and description for the second level is !)

After re-reading your map, I figured it could be that the maxValue was how many times it ran (i,e you had 6 for the inventory because theres 6 inventory spaces) and I only needed it to run once, so I tried replacing the maxValues from 10,000/10mil whatever down to just 1, and that didn't work either. So I'm misunderstanding some part of how this works.


 
Last edited:

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,534
SaveMaxValue is how high the SaveValue can go. The lower the value the better (as far as I know).

For example, if you wanted to save a player's Hero and there's only 5 Heroes in the map to choose from then it'd make sense to make SaveMaxValue 5.
  • Set Variable SaveHero[1] = Paladin
  • Set Variable SaveHero[2] = Archmage
  • Set Variable SaveHero[3] = Mountain King
  • Set Variable SaveHero[4] = Bloodmage
  • Set Variable SaveHero[5] = Uncle is cool
If you can send me your map or maybe an edited demo version I can try to debug it.
 
Status
Not open for further replies.
Top