• 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.
  • It's time for the first HD Modeling Contest of 2025. Join the theme discussion for Hive's HD Modeling Contest #7! Click here to post your idea!

[Trigger] Detecting a specific Save file

Status
Not open for further replies.
Level 8
Joined
Jan 22, 2010
Messages
115
I have created a series of linked maps with transitions. When loading a new map the game will make a specific save file: "Saves\Map1.w3z" and load the file for the next map. The problem is that a player can make a normal save ingame. When this file "(Custom Save).w3z" is loaded it reloads data from the gamecache that is already in the game.

The simple solution is to detect the name/path of the save, and either run the load trigger or do nothing. But in GUI I can only compare the "string of saved game" and not of the "loaded game".

So how do I detect which file is loaded?

  • Events
    • Game - A saved game is loaded
  • Actions
    • Game Cache - Create a game cache from CommonCache.w3v
    • Set CommonCache = (Last created game cache)
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • (Saved-game filename) Equal to Map1.w3z
      • Then - Actions
        • Trigger - Run Load <gen> (ignoring conditions)
      • Else - Actions
 
Level 8
Joined
Jan 22, 2010
Messages
115
Well, it could be a partial solution to the problem.. But the dungeon is quite long so I think that not being able to save won't be appreciated by all players ;)

I could still try to detect the save-game event instead and set a boolean. But it will be a messy/laggy trigger.
 
Level 8
Joined
Jan 22, 2010
Messages
115
Solution

Yay! Found something that works! For those that might encounter the same problem:
The save file (Saves\Map1.w3z) is recognized as such, the boolean will automatically reset when you move between maps, but loading a game will always return true.

The only problem now is that the other maps will not be saved yet.. I'm choosing the easy way out by making one extra save per map (effectively allowing one custom save only) instead of messing with substrings.

  • Save
    • Events
      • Game - The game is about to be saved
    • Conditions
      • (Saved-game filename) Not equal to Saves\Map1.w3z
    • Actions
      • Set CustomSaveBoolean = True
      • Game - Create a copy of the Saves\Map2.w3z saved-game and name it Saves\Map2Custom.w3z
      • Game - Create a copy of the Saves\Map3.w3z saved-game and name it Saves\Map3Custom.w3z
      • Game - Display to (All players) the text: Saved in Map 1: Bac...
And then the load trigger will reset the back-up files:
  • Subsequent Starts
    • Events
      • Game - A saved game is loaded
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • CustomSaveBoolean Equal to False
        • Then - Actions
          • Trigger - Run Load <gen> (ignoring conditions)
        • Else - Actions
          • Game - Create a copy of the Saves\Map2Custom.w3z saved-game and name it Saves\Map2.w3z
          • Game - Create a copy of the Saves\Map3Custom.w3z saved-game and name it Saves\Map3.w3z
 
Last edited:
Status
Not open for further replies.
Top