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

[Trigger] Autosave function?

Status
Not open for further replies.
Level 25
Joined
May 11, 2007
Messages
4,651
Just saw that in the trigger editor there is a "Game - Save Game and Load Game" action, is there any function for just saving the game, say using CustomScript to call a function or Jass.

I know that save games do break timers, but this is for the end part of a map, I don't have any timers and it would be nice to have an autosave, as it takes the player quite some time to get there.
 
These are the natives:
JASS:
native          LoadGame            takes string saveFileName, boolean doScoreScreen returns nothing
native          SaveGame            takes string saveFileName returns nothing
native          RenameSaveDirectory takes string sourceDirName, string destDirName returns boolean
native          RemoveSaveDirectory takes string sourceDirName returns boolean
native          CopySaveGame        takes string sourceSaveName, string destSaveName returns boolean
native          SaveGameExists      takes string saveName returns boolean

Try:
JASS:
call SaveGame("YourMapName.w3z")
You'll need to run tests to see exactly where it saves, how to load it manually, dealing with name conflicts, etc.
 
Level 12
Joined
Feb 22, 2010
Messages
1,115
I am hearing this "save/load break timers" thing very often and I ask proof.I used save/load a lot in campaigns, warchasers, some dota games and other custom maps without a problem.
 
The most important problem is that saving and loading will turn periodic timers into one-shot timers.
If you design your map specifically around this glitch (not using periodic timers and instead manually restarting them as one-shot timers), you can make your map mostly compatible to the default saving and loading.

There also is a problem that timers can expire much earlier after loading than they should.

I think someone could easily create a timer system that catches all these glitches with timers for saving and loading by simulating periodic timers with one-shot timers and manually counting the timeout in steps of 32.

This is highly recommended for singleplayer maps. For multiplayer, you mostly don't care, as it's better to use a codebased save/load there to allow sessions with other players.
 
Status
Not open for further replies.
Top