• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

Save Map Custom Script

Status
Not open for further replies.
Level 4
Joined
Aug 11, 2013
Messages
65
Hey guys.

  • Save
    • Events
      • Time - Every 5.00 seconds of game time
    • Conditions
    • Actions
      • Set Save_Count = (Save_Count + 1)
      • Custom script: call SaveGame("CoTs.w3z")
This is my trigger. As you can see im trying to "save" the game every 5 seconds. The problem is this only fires off once and never occurs again. Also is there a way to get my Save_Count variable in the saved name "CoTs.w3z" ??

Any help would be appreciated!
 
Level 4
Joined
Aug 11, 2013
Messages
65
Because when it triggers off the game pauses for half a second and i can see the saved file. After the first time it doesnt pause, doesnt create a new file and doesnt update the previosuly saved file.
 
Level 16
Joined
Dec 15, 2011
Messages
1,423
Hi.

So after some testing, I discovered an intriguing thing about how the SaveGame native works. To put it simply, it allows only one single save to a folder and to save more files, you have to create a new folder for it to save in. Here is the code that I used to successfully enable saving multiple times, or in your case, periodically.

  • Save
    • Events
      • Time - Every 5.00 seconds of game time
    • Conditions
    • Actions
      • Set SC = (SC + 1)
      • Custom script: call SaveGame("Autosave " + I2S(udg_SC) + "/CoTs " + I2S(udg_SC) + ".w3z")
However, to save disk space, you can easily remove the previous save folder by inserting the following trigger line before increasing the SC integer.

  • Custom script: call RemoveSaveDirectory("Autosave " + I2S(udg_SC)
how did you know that it doesn't update the file?

You can test it by using a 60 or 120s periodic trigger. The save file in the directory doesn't get updated.
 

Attachments

  • Save Test.w3x
    17.4 KB · Views: 46
Level 4
Joined
Aug 11, 2013
Messages
65
Hi.

So after some testing, I discovered an intriguing thing about how the SaveGame native works. To put it simply, it allows only one single save to a folder and to save more files, you have to create a new folder for it to save in. Here is the code that I used to successfully enable saving multiple times, or in your case, periodically.

  • Save
    • Events
      • Time - Every 5.00 seconds of game time
    • Conditions
    • Actions
      • Set SC = (SC + 1)
      • Custom script: call SaveGame("Autosave " + I2S(udg_SC) + "/CoTs " + I2S(udg_SC) + ".w3z")
However, to save disk space, you can easily remove the previous save folder by inserting the following trigger line before increasing the SC integer.

  • Custom script: call RemoveSaveDirectory("Autosave " + I2S(udg_SC)


You can test it by using a 60 or 120s periodic trigger. The save file in the directory doesn't get updated.

Thanks heaps man! Ill be testing that out shortly and ill get back to you.

Edit: It doesnt seem to be working? Its not creating any new folders. It fires off once, but never again??
 
Level 16
Joined
Dec 15, 2011
Messages
1,423
I never added the remove directory custom script, thats only if you want to save disk space?

That is pedicular because my test map works properly.

Did you check the CustomSaves folder? The Autosave folders will be created in CustomSaves/<Map name>/

On a side note, when you load the savefile, you have to use the same path as when you save it.
 
Level 4
Joined
Aug 11, 2013
Messages
65
Yes the customsaves folder is there. Under customsaves there is my map name as a folder and under that there is "Autosave 2". and under that there is my actual map save which is "CoTs 2.w3z".
 
Level 16
Joined
Dec 15, 2011
Messages
1,423
ok. tyvm.

Hi.

I have revised my testing attempts multiple times and realized that earlier I made a mistake causing me to misunderstand that the test map works. In fact, it doesn't. The native is hardcoded somehow to allow only one usage per map playthrough and I cannot do anything to change that.

I am awfully sorry for not being able to help.
 
Level 4
Joined
Aug 11, 2013
Messages
65
Hi.

I have revised my testing attempts multiple times and realized that earlier I made a mistake causing me to misunderstand that the test map works. In fact, it doesn't. The native is hardcoded somehow to allow only one usage per map playthrough and I cannot do anything to change that.

I am awfully sorry for not being able to help.

Oh!, well that sucks!. thanks for your help anyway, i appreciate it.
 
well, you can always just save things into game cache assuming that this is single player... or use Nestharus' code-less save-load scripts for multiplayer games

After all, the default save-game and load-game are pretty bad for maps that are going to be updated coz you can't load an old save file in a newer version of the map...
 
Status
Not open for further replies.
Top