making a RPG type map, but saving my hero.. is a issue.

Status
Not open for further replies.
Level 1
Joined
Jun 26, 2021
Messages
2
So me and my friends regularly play RPG type maps, but I decided that it would be cool to actually make 1. Unfortunately while i was making it, i realized that to move this project further i need to implement a save/load system into my map. However, since im no good at writing scripts, i decided to look online and see if i can find any scripts that are of use to me. However, all the codes I found thus far were not what i was looking for, since the map already makes the unit for you. So basically what im looking for, is to spawn in a area with like wisps and pick a hero ourselves, after we level the hero up, i want there to be a code to type -save and save the hero that im playing with and the abilities the hero has acquired. Items are not important since this is a pure ability usage spam type map. so, in short, pick hero as the player, and ability to save and load the hero. here is the map that i currently have.
 

Attachments

  • arbigi.w3m
    295.9 KB · Views: 12

Uncle

Warcraft Moderator
Level 73
Joined
Aug 10, 2018
Messages
7,866
Most of these save/load systems are customizable so there shouldn't be a problem like "the map already makes the unit for you". It's just a matter of adapting the system to your needs.

Here's the system I always use:

The demo map that TriggerHappy provided is exactly that, a demo. Your map doesn't need to follow it to a tee.

That being said it can be very confusing at first, so I attached my own map that provides an example of saving/loading a Hero with this system. I also removed all of the extra features (like the Dialog menu) from the system since those are often unwanted.

How to test my map:
Use the Wisp's "Select Hero" ability on a Hero and then type -save. This will save the Hero, Hero Level, Hero Items, and Hero Skill Levels. Restart the map and type -load to load your saved Hero. Note that you can only -load if you haven't already selected a Hero, and you can only -save after selecting a Hero.

How to import this into your map:
  • Open my map and open the Trigger Editor.
  • Copy and paste the "Codeless Save and Load Triggers" folder into your map. (The folder will remain copied even if you switch maps as long as you don't close the editor completely)
  • Copy and paste the "Uncle Save and Load Triggers" folder into your map.
  • Customize the "Setup Save Variables" trigger that I provided. This is where you'll setup everything that you want to be saved. This includes Items, Heroes, Hero Skills, etc. Follow the patterns that I have provided in my examples, if you have any questions feel free to ask me!
  • You can change the filename of your Save File in the "Save Init" trigger using the variable MapName:
  • Set VariableSet MapName = SaveLoadHeroExample


Important requirements:
  • The Aerial Shackles ability must have 2 levels and a changed level 2 Tooltip in order for this system to work (see the system requirement picture I attached).
  • You must load your data in the REVERSE order of how you saved it. So if you saved Gold first and Lumber second then you must load Lumber first and Gold second.
  • You're only able to save Integers but you can make an Integer represent any kind of data through clever use of Variables/Arrays.
 

Attachments

  • system requirement.png
    system requirement.png
    850 KB · Views: 21
  • Save and Load Hero Example.w3x
    154 KB · Views: 15
Last edited:
Level 1
Joined
Jun 26, 2021
Messages
2
Most of these save/load systems are customizable so there shouldn't be a problem like "the map already makes the unit for you". It's just a matter of adapting the system to your needs.

Here's the system I always use:

The demo map that TriggerHappy provided is exactly that, a demo. Your map doesn't need to follow it to a tee.

That being said it can be very confusing at first, so I attached my own map that provides an example of saving/loading a Hero with this system. I also removed all of the extra features from the system since those are often unwanted.

How to test my map:
Use the Wisp's "Select Hero" ability on a Hero and type -save, then restart the map and type -load. This will load the Hero, Hero Level, and Hero Skill Levels. Saving Items can be done as well but I left that out, maybe I'll add an example of this sometime later today/tomorrow. Note that you can only -load if you haven't selected a Hero and you can only -save if you have a Hero.

Important requirements:
1) The Aerial Shackles ability must have 2 levels and a changed level 2 Tooltip in order for this system to work (see the system requirement picture I attached).

2) You must load your data in the REVERSE order of how you saved it. So if you saved Gold first then Lumber second you must load Lumber first and Gold second.

3) You're only able to save Integers but you can make an Integer represent any kind of data through clever use of Variables/Arrays.
hey, thanks a lot for helping me, as a novice world edit guy, i have almost no idea what im doing, but your code was simple and neat to understand.
 

Uncle

Warcraft Moderator
Level 73
Joined
Aug 10, 2018
Messages
7,866
No problem, I hope you can get it to work in your map. Note that I updated the map to save/load Items as well, so make sure you downloaded the map since my last edit (it has some other minor changes as well).

I know you said you don't care about saving Items but it was a rather simple addition to implement so I figured why not. You can always delete everything related to it.
 
Status
Not open for further replies.
Top