This tutorial will teach you how to move from one level to the next, and will also teach you to take a unit with you (using Game Caches).
Right, this tutorial leads on from the ‘Quest’ tutorial. This is because we need to transfer a Hero unit in order to get the full effect of level transitions with game caches.
This means, if you have not completed the ‘Quest’ tutorial, go there now and save the map.
Now, I will begin.
First, add the following variable to the Quest map:
Variable Name – Variable Type – Initial Value
CacheTut1 – Game Cache – — None —
Now, we need to add a few actions to the quest tutorial. Go into the trigger editor, and open up the trigger titled: ‘Got There’.
Add the following actions BEFORE the Victory action, but AFTER the ‘Wait’ action:
Game Cache – Create a game cache from CacheTut1
– Creates a game cache called CacheTut1. If there was a map before this one with a game cache of the same name, it would load the information from that map. There is no previous map however, so it will create a new game cache.Set CacheTut11 = (Last created game cache)
– Sets the variable ‘CacheTut1’ as the last created game cache, this is so we can reference it later.Game Cache – Store Goldilocks 0000 [gen] as Goldilocks1 of Map1_2 in CacheTut1
– Stores the ‘Goldilocks’ unit in the game cache with the name ‘Goldilocks1’, and the category ‘Map1_2’.Game Cache – Save CacheTut1
– Saves the game cache with all of the information inside it.Game – Set the next level to Maps\Single\Tuts\(1)cache.w3m
– Sets the next level to go to. This is very delicate, as you have to input the path yourself. I could not tell you exactly where to point this value to on your computer, as you may have a different directory to which you save your maps. I have saved the maps to the directory:Maps\Single\Tuts\
It is easy enough to find out where your maps are saved, it should be written at the top of the screen in the World Editor:
All you have to put in as the value, is the directory structure after ‘Warcraft III’ for this map, it would be:
Maps\Single\Tuts\(1)quest.w3m
But we are pointing the value to the next map, which (in my case) is:
Maps\Single\Tuts\(1)cache.w3m
(–) MOVING ON (–)
The last thing to do in this map, it export the units, so ‘Goldilocks’ is available in the next map.
To do this, go to the unit editor, go to ‘File’, and click ‘Export Unit Settings’. You will then see the following window:
Type in ‘Goldilocks.w3u’ as shown above, and click save.
That’s it for that map! Now we will go on to the next map, first, create a new map, and once again, delete all of the triggers.
Now, first thing we have to do, is upload the Unit Data. To do this, go into the unit editor again, press ‘File’, and click ‘Import Unit Settings’. Select ‘Goldilocks.w3u’ from the menu, and click ‘Open’.
Now we have all the units we need, we will edit the map.
All you have to do for this map, is place a small region. After drawing out the region (no more than 1X1 big), name it ‘Goldilocks Start’.
We will now bring our hero ‘Goldilocks’ into this world.
Open up the ‘Trigger Editor’ again, and add the following variable:
First, add the following variable to the Quest map:
Variable Name – Variable Type – Initial Value
CacheTut1 – Game Cache – — None –
Now, create a new trigger as follows:
Name: ‘Game Start’
Events:
Map Initialization
– When the map starts upConditions
–Actions
Game Cache – Create a game cache from CacheTut1
– Creates a game cache, as before. This time however, it loads the game cache that we created last time.(–) IMPORTANT (–)
When linking two maps together with a game cache, the game cache MUST have EXACTLY the same name in BOTH maps.Set CacheTut1 = (Last created game cache)
– Sets the variable ‘CacheTut1’ as the last created game cache – again, so we can reference to it.Game Cache – Restore Goldilocks1 of Map1_2 for Player 1 (Red) at (Center of Region 000 [gen]) facing 180.00
– This creates the ‘Goldilocks’ unit at the center of the region we created before, facing 180 deg. The unit will have the same properties of the unit that was in the last map at the very end.
And that really is all there is to it. To test the map, run the quest map, complete it, and it should go straight to this map.
(–) PROBLEMS (–)
Q – The second map doesn’t load when I finish the first, what’s wrong?
A – This is probably because you have typed in the path for the second map wrong in the value of the following trigger in the first map:
Game – Set the next level to Maps\Single\Tuts\(1)cache.w3m
Make sure that the folder structure is correct, and the map name is also correct, with ‘.w3m’ at the end.
Q – My ‘Carry-Over’ unit is called ‘Default String’ in the second map, why?
A – This is because you did not load the units correctly from the first map. Scroll back up, and re-do that stage.
Q – Why won’t my unit load? I’ve loaded the unit data right.
A – Verify that in both maps, the game cache has the same title. I think it is case-sensitive as well.
There you go, in depth game caches! Thankyou to Psychosparrow from the Warcraft Forums, for pointing out a flaw in this tutorial concerning the variable names. His help was greatly appreciated.