• 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.

Switching between maps

Status
Not open for further replies.
Level 5
Joined
Nov 7, 2007
Messages
134
I am making a game in which you start in one "main" map, and through this map you can access other maps, and in each of those maps you need to complete quests and once you have finished all of the quests in the small maps you win (or something). It is basically the same concept as the Super Mario games where you collect stars.

Anyway, I'm having trouble with the whole "switching maps" process. When you go from the main map to a small map, I am using the trigger "Game - Save Game as <something> and change level to <small map>", with the idea that once you're done with the small map I will use the trigger "Game - Load <something>" in order to return to the main map.

Now, going from the main map to the small map works fine already, but when I try to go back something goes wrong. Usually, the game refuses to even respond to my trigger (in the testing phase I'm using "Player types a chat message" as the event for the trigger), which is very strange, and I haven't been able to figure out why it acts this way.
Sometimes though, the trigger does run, but then it doesn't load the saved game as it is supposed to, it just returns to the Warcraft menu.

If anyone has any idea as to why these things happen, I would greatly appreciate your assistance. Or, if you know of any other way to switch between maps, I'd also be listening.
 
Level 11
Joined
Feb 14, 2009
Messages
884
Why don't you use Game Caches instead? Anyway, I'd suggest looking at your triggers again and see if you've made any silly mistake or typo (like I do ^^).
 
Level 5
Joined
Nov 7, 2007
Messages
134
Hm, Game Caches, I haven't considered those, I suppose I could give that I try. And yes, I have double-checked the triggers and my typing countless times, I still can't find any problems.
 
Level 5
Joined
Nov 7, 2007
Messages
134
Alright, so, I'm using Game Caches now. But problems have emerged with these as well.

I stored a hero and an integer from one map in a Game Cache, following the directions given in the Game Cache-tutorial, and then I try to restore the hero and the integer in another map. The integer is restored as it is supposed to, but the hero is not. It appears as if the author of the Game Cache-tutorial forgot to include how to restore a hero, so it's not much help to me there. I used the "Restore Unit Facing Angle"-action to create the hero in the new map, but it isn't created. Can anyone help me out here?
 
Level 7
Joined
Mar 26, 2009
Messages
345
I used to document all my triggers in handy dandy text files (I was such a dork). Anyway, here's the hero cache triggers I used.

Oh and you might want to look at this if you seem to be missing some options in your trigger editor.


  • HOWTO: Make a Cache
  • //Basic example from a campaign
  • TRIGGERS:
    • SETUP:
      • Variables:
        • FallofStormwind - Game Cache - None
      • Cache (Run at Map Init)
        • Events
        • Conditions
        • Actions
          • Game Cache - Create a game cache from FallofStormwind.w3v
          • Set FallofStormwind = (Last created game cache)
        • Game Cache - Save FallofStormwind
      • StoreIntoCache (Run at Victory)
        • Events
        • Conditions
        • Actions
          • Game Cache - Store Clan Warlord (RPG) 0275 <gen> as Korgorash of Hero in FallofStormwind
        • Game Cache - Save FallofStormwind
  • RESTORE:
    • Variables:
      • Hero - Unit - None
    • Cache
      • Events
        • Map initialization
      • Conditions
      • Actions
        • Game Cache - Create a game cache from FallofStormwind.w3v
        • Set FallofStormwind = (Last created game cache)
        • Game Cache - Save FallofStormwind
    • KorgorashRestoral
      • Events
      • Conditions
      • Actions
        • Game Cache - Create a game cache from FallofStormwind.w3v
        • Set FallofStormwind = (Last created game cache)
        • Game Cache - Save FallofStormwind
        • Set HeroStart = (Center of HeroStart <gen>)
        • Game Cache - Restore Korgorash of Hero from FallofStormwind for Player 1 (Red) at HeroStart facing 322.00
        • Set Hero = (Last restored unit)
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • Hero Equal to No unit
          • Then - Actions
            • Skip remaining actions
            • Unit - Create 1 Clan Warlord (RPG) for Player 1 (Red) at HeroStart facing 322.00 degrees
            • Set Hero = (Last created unit)
            • Hero - Set Hero Hero-level to 2, Hide level-up graphics
            • Hero - Learn skill for Hero: Shockwave (Cairne)
            • Hero - Learn skill for Hero: Feral Spirit (orc)
          • Else - Actions
            • Do nothing
 
Level 5
Joined
Nov 7, 2007
Messages
134
So basically, you have to create the game cache again in the same trigger as the one you restore the hero with? That seems to be what you've done here and that's also the only difference I can find between your demonstration and what I did myself.

EDIT: Or maybe the location where the hero shall be restored has to be a variable?
 
Level 7
Joined
Mar 26, 2009
Messages
345
Yes, you need to recreate the game cache.

The location for the restoral should be set as a variable but that's just proper wc3 triggering to prevent craziness.
 
Level 5
Joined
Nov 7, 2007
Messages
134
That's weird though, since you've already created the Cache in another trigger. Isn't it redundant to create the cache in the first trigger then?

I have now altered my trigger to re-create the cache before attempting to restore the hero, and I also made the location a variable (since I wouldn't want any unexpected craziness in my map after all), but it still doesn't work.
 
Level 7
Joined
Mar 26, 2009
Messages
345
Well first understand that the "if then" statement is just in case the restore fails.

Second, it's a pain, but check that your spelling is consistent. The first trigger is for the map you're leaving and the second is for the map you're entering.
 
Level 5
Joined
Nov 7, 2007
Messages
134
and note that game cache can only work with multiple maps if you make them have the same name and if and only if you're playing in single player mode or in a campaign...

Hold on a second, the maps need to have the same name? That seems like a pretty important detail, yet I have never encountered it before. Or maybe you meant the Game Cache needs to have the same name in all maps?

Oh well, I'll just go over my spelling anyway, even though it feels like I've done it multiple times already.
 
Hold on a second, the maps need to have the same name? That seems like a pretty important detail, yet I have never encountered it before. Or maybe you meant the Game Cache needs to have the same name in all maps?

Oh well, I'll just go over my spelling anyway, even though it feels like I've done it multiple times already.

the game cache needs to have the same name on the creation trigger...

also, if you're doing a single player game that can change maps (not in campaign), be sure to tell your players where to save all of the maps, because the save and start next level action uses a definite path for the map to be loaded, so placing the maps in the wrong folder/path would destroy the system....
 
Level 5
Joined
Nov 7, 2007
Messages
134
Alright, it works now! Not sure what I did though, just moved around some triggers, added "Create Game Cache" a little here and there, and I made some more variables. Anyway, I'm giving +rep to everyone who tried to help me.
 
Status
Not open for further replies.
Top