HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Game Caches

03-18-2006, 01:40 PM#1
Bob27
Introduction
This tutorial will tell you how to move units and other things from map to map. Remember that Game Caches can not be used on Battle Net, and are almost only ever used for campaigns.

Creating the Game Cache

The first thing you want to do is to create a variable for the Game Cache, go into the Variale editor and create a new Game Cache, like in the pictures bellow.





Then when the Game Caches variable has been created use this trigger to create the Game Cache.

Trigger:
Create Cache
Collapse Events
Map initialization
Conditions
Collapse Actions
Game Cache - Create a game cache from TutorialCache.w3v
Set TutorialCache = (Last created game cache)
Game Cache - Save TutorialCache

Storing Heros and Other Things

Now i'll show you how to store things using a Game Cache. The following trigger can be used to store a hero.

Trigger:
Store Hero
Events
Conditions
Collapse Actions
Game Cache - Store Paladin 0032 <gen> as Paladin of Heros in TutorialCache
Game Cache - Save TutorialCache
Trigger - Run Store Gold <gen> (ignoring conditions)

Remember that you will have to create all the nesecary variables in order for the triggers to work. This next trigger will show you how to store a players gold or lumber. This will require a variable, unlike storing a hero.

Trigger:
Store Gold
Events
Conditions
Collapse Actions
Set Gold = (Player 1 (Red) Current gold)
Game Cache - Store Gold as Gold of Recources in TutorialCache
Game Cache - Save TutorialCache
Trigger - Run Store Hero Name <gen> (ignoring conditions)

This next trigger will show you how to store a heros proper name, and one of the ways it can be used in a different map.

Trigger:
Store Hero Name
Events
Conditions
Collapse Actions
Set HeroName = (Proper name of Paladin 0032 <gen>)
Game Cache - Store HeroName as HeroName of Heros in TutorialCache
Game Cache - Save (Last created game cache)
Trigger - Run End Game <gen> (ignoring conditions)

This will also require a variable.

Restoring things from the Game Cache

I am now going to show you how to restore all these things in a different map. The first thing we need to do is the re-create all the variables. It makes it alot easier if the new variables in the new map are the same as in the old map. After all the required variables have been made make this trigger.

Trigger:
Load Game Cache
Collapse Events
Map initialization
Conditions
Collapse Actions
Game Cache - Create a game cache from TutorialCache.w3v
Set TutorialCache = (Last created game cache)

Now that the Game Cache has been re-created we can restore our heros, gold and hero names. This next trigger is used to restore the hero.

Trigger:
Restore Gold
Collapse Events
Time - Elapsed game time is 0.00 seconds
Conditions
Collapse Actions
Set Gold = (Load Gold of Recources from TutorialCache)
Player - Set Player 1 (Red) Current gold to Gold

Now that our gold has been restored we can make a text message appear on the screen saying Your heros proper name is the last game was: and have the heros proper name appear. You can do this with almost anything. Heres the trigger for it.

Trigger:
Restore Hero Name
Collapse Events
Time - Elapsed game time is 0.00 seconds
Conditions
Collapse Actions
Set HeroName = (Load HeroName of Heros from TutorialCache)
Game - Display to (All players) for 20.00 seconds the text: (Your heros proper name is the last game was: + (Load HeroName of Heros from TutorialCache))

Conclusion

I hope you now find Game Caches alot easier, if you would like to ask me anything just private message me or email me at [email protected]. If you need it you maybe download the demo Here.
03-20-2006, 03:04 AM#2
jigrael
Nice. I got a question, can I use game cache for a spell and the play that map(with the spell in) in bnet? and what about lan multiplayer?
03-20-2006, 05:15 AM#3
Bob27
No you can't use Game Caches for multiplayer or b.net, just singleplayer.
03-21-2006, 05:21 PM#4
phyrex1an
You can use game caches in multiplayer games, what you not can do is save them to a different game.
Your spell should work as good in multiplayer as in single player.
03-21-2006, 05:27 PM#5
Blade.dk
phyrex1an is right.

Game caches works perfectly in multiplayer games, as long as you only want to use their contents in that game.
04-16-2006, 08:11 PM#6
moonliterhythm
do game caches have any advantages over using global variables?
10-25-2006, 05:37 AM#7
Leopard
i have a question, now a have two map and how to link them?, for example, when the hero go to a region, he will be moved to the second map and the game reload??
12-17-2008, 09:20 AM#8
hillbillyboi
heya :) umm ive made multiple game caches but i can never seem to get past the loading stage, when i load the next made it always says the message "Waiting for host" and it has the disconnect button available, but never loads..

any idea what could be wrong?