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

[General] Save/Load boolean array variable

Status
Not open for further replies.
Level 10
Joined
Mar 17, 2012
Messages
579
Hello there!
There is a feature I have no idea how to implement. I'mnot familiar with save/load systems and actually would really appreciate if it was possible to do with GUI.

So my map is supposed to have 3 additional sub-races for every race you pick in the lobby, but they are open if you win and write -save after that. And when you start a new game and write -load, you get a dialogue window with more than one race available:

The races availability is stored in Boolean variables for every player.

upload_2020-8-19_1-40-8.png


So all I need is to load some kind of a file in the beginning and rewrite it afterwards and be learn how to work with its data. Is there a quick way to do so?
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,534
Codeless Save and Load (Multiplayer) - v3.0.1
You can use this system ^
IMPORTANT: If you do use it, go into the Object Editor and set Aether Shackle's "Levels" field to 2. It's required for the system to work.

This system allows you to easily save/load Integers, which can be used to represent anything.

In this case you should only need 1 Integer (Array), let's call it Wins.

At the start of the map you load this value, which will default to 0 if the player hasn't created a save yet.

When a player wins, you increase this value by 1, like: Set Wins[Player number] = Wins[Player number] + 1.

From there you will have access to how many Wins a player has, which can then be referenced in your race selection triggers:

If Wins[Player number] >= 10 then: Unlock sub-race 1
If Wins[Player number] >= 25 then: Unlock sub-race 2
etc...

I attached a map with a slightly modified version of the original system. I removed some of the features that I know most people don't really want.

If you can open my map you'll see an example on how to autosave/autoload to one file slot which is pretty useful. By default I'm saving each player's Gold every 10 seconds, but you can easily modify the triggers to 1) Not use a Periodic Event, 2) Save any Integer value you want like the Wins variable.

You won't be able to open the map if you're not on the latest patch.
 

Attachments

  • Save and Load Example 3.w3x
    148.2 KB · Views: 20
Last edited:
Status
Not open for further replies.
Top