jonadrian619
-___-
- Reaction score
- 242
Game Cache Tutorial
Tutorial by jonadrian619
Note: Although information about the Game Cache is shown in the Campaign Basics section, more useful information and support about Game Caches are shown and displayed here.
Table of Contents:
1) Operating Game Caches
2) Game Cache Actions
3) Saving heroes using Game Caches
4) Advanced Game Cache Techniques
FAQ about Game Caches
1) What is a Game Cache?
A cache is a file created from a map that is saved on your computer thats stores information. The game cache can store information from one level, and load it when you play the next level. It can save objects like a hero, Integer value, Real value or character, and load them again after the level is finished.
2) What is the purpose in creating Game Caches?
The purpose is usual, to save objects or values in a particular level, and load these objects, values again in the next or higher levels. There are other advanced purposes in creating one. They will be discussed later.
Operating Game Caches:
Now, here's where we are standing. Before you create a Game Cache, you should create a Variable first. Go to Variables (With the X icon in it, or hotkey Ctrl+B). Click New Variable and then type the name of your variable. Then set it's type to 'Game Cache'. If you have multiple game caches, check the 'Array' checkbox and set the size (If you have multiple game caches) Then click OK.
Now you have a Game Cache variable which can be used to associate game caches.
Game Cache Actions
Here are the actions of the Game Cache category which are shown in the trigger editor. To create a Game Cache action, click the New Action (Hotkey Ctrl+R) button and click a 'Game Cache - ' Action. Each action has useful details and examples.
Game Cache - Create Game Cache
- Creates a new Game Cache from a map. The Game Cache should be created from your map. Type the map filename in the 'MapName.w3v' field value and change it to your map's filename. The game cache should be from your map so that it's functions will work properly. If the map filename you have typed does not exist, the cache will be created.
Game Cache - Save Game Cache
- Saves the game cache, using the same filename from which it was created. If you use the Actions; Store Integer,Boolean, Unit, etc., then using the Save Game Cache action will save those objects and are available for restoration.
Game Cache - Store Unit
- Stores unit as a Label in a Category in an existing Game Cache. 2 ways to select a unit. First select a function like last created unit, picked unit, etc. Or to store a particular unit, select a unit in the map then use the unit's variable in the field (ex. Peon 0015 <gen>).
"Store Unit" Field Values
- Store Unit (The field wherein your selected unit will be stored) as Label (The unit's label in a category. You can type any) of Category (The category wherein the label will be saved) in (Last Created Game Cache). You can also change it's value like a Game Cache variable or simply last created game cache.
Game Cache - Store Real
- Same as 'Store Unit' but more different. You'll have to store a Real number this time. A Real number is a decimal (ex. 1.00, 1.25, 2.79, etc.).
"Store Unit" Field Values
- Same as the 'Store Unit' fields, but the object stored is a Real number this time. Also create individual categories for the values.
Game Cache - Store Integer
- Same as 'Store Unit' but much more different. You'll have to store an Integer this time. An Integer is a non-decimal or plain number. (ex. 1, 2, 3, 4, 5, etc.).
"Store Unit" Field Values
- Same as the 'Store Unit' fields, but the object stored is an Integer this time. Also create individual categories for the values.
Game Cache - Store Boolean
- Same as 'Store Unit' but much more different. You'll have to store a Boolean value this time. A Boolean value is a value that associates with events and conditions. (ex. 'A unit enters Region 001' then follows the condition 'Triggering unit is a Hero equal to True'. The Boolean value is set to true, so the unit that enters Region 001 should be a hero. If the condition is met, then the actions will be initiated).
"Store Unit" Field Values
- Same as the 'Store Unit' fields, but the object stored is an Integer this time. Also create individual categories for the values.
Game Cache - Restore Unit Facing Angle
- Restores a unit 'Label' from a created Category in a game cache. This action restores or loads a stored unit for a player in a region facing a particular facing angle. The angle is shown in degrees.
Game Cache - Restore Unit Facing Point
- Same as the 'Restore Unit Facing Angle' action. But the unit loaded this time faces a region, not the facing angle itself.
Game Cache - Reload All
- Reloads all game cache from the computer's disk.
Game Cache - Clear Game Cache
- Clears all labels of all categories in a game cache.
Game Cache - Clear Category
- Clears all labels of a specific category in a game cache.
Saving heroes using Game Caches
If you are making an RPG map, then this tutorial will definitely be the best support. If you create an RPG game most likely selecting a hero or a builder or anything, you should create a trigger that saves objects, yet it is not initially on,
with the 'initially on' checkbox unchecked. Once your hero is selected, the trigger will be turned on using 'Trigger - Turn On (The name of the trigger). You can make many events. Here are 2 examples of triggers that can be used in saving objects.
Here are Game Caches for the impatient mappers. Try this in an empty map:
In the second trigger you'll have to place a Circle of Power of any size and then create a region in the circle, particularly named
'Save Hero Circle' in my demo map.
NOTE: After saving a hero, you'll have to create a trigger that turns on the load hero trigger when the hero dies. It isn't
applied in this area of the tutorial. It'll be discussed later
You can also create an enabled but not intitially on trigger that loads the unit in a game cache. Here's an example.
You'll see your newly loaded hero with the same hp, mana and attributes unlike before!! That's only for beginners. More types
will be discussed later.
Advanced Game Cache Techniques:
Highly advanced game cache techniques are shown here. Those who want to save more than units and other techniques, are here. Two
detailed techniques are shown.
1) Saving an Army then Loading it again.
It works the same way as of saving a single hero, but much more special and tougher. You'll need to create an army and then
create triggers the same way you create a trigger to save a hero. You'll need a bunch of these triggers if you have a bigger
army. To make things quicker, try using the action "Unit Group - Pick every unit in (Function) and do Action".
Create a trigger that loads units similar to above, still not initially on. Create a large region for the army to be restored
and make sure nothing is in it. You can then make events to load the army. You can then see your army with the same units and
attributes as of before you stored them.
2) Saving a Whole Town
The most difficult technique where you'll have to create a town that contains lots of units, buildings and heroes.
This is totally difficult and takes minutes to do it, but it gives a great impact to your map. You'll save your whole
town with all the units and buildings. You'll have to load those units just like above. But this you'll need to restore
each unit exactly to it's position after the objects have been saved. If your town is large, you'll have to create a dozen
triggers to complete the job. After these things, put creeps near your town and test it. Save your town and, watch the creeps
crush your town. Once nothing is left, do something to load the town like typing -load. You'll see the town back again.
ADDITIONAL TUTORIALS
1) How to save heroes and load them to another map
This is a trigger where in you will save the used hero in the currently played map. I use the hero thrall. You also need a variable.
You can use any event..
Then you'll make another trigger in another map to load the hero in the previous map. Always save a game cache before loading it. You need another variable in the other map. In this trigger there are also additional actions like learning skills. I've got it in a campaign map using WinMPQ, opened the map and saw the triggers
-------------------------------------------------------------------------
Tutorial Summary
I hope these things have polished some of your triggering skills especially in creating Game Caches.
You can download my demo map about game caches by going to the URL:
http://www.epicwar.com/maps/7611/
I was kind of rushing to make the map so the author names are not made properly.
Now i added a free download for my demo map:
Download Now!
Written by jonadrian619
Tutorial by jonadrian619
Note: Although information about the Game Cache is shown in the Campaign Basics section, more useful information and support about Game Caches are shown and displayed here.
Table of Contents:
1) Operating Game Caches
2) Game Cache Actions
3) Saving heroes using Game Caches
4) Advanced Game Cache Techniques
FAQ about Game Caches
1) What is a Game Cache?
A cache is a file created from a map that is saved on your computer thats stores information. The game cache can store information from one level, and load it when you play the next level. It can save objects like a hero, Integer value, Real value or character, and load them again after the level is finished.
2) What is the purpose in creating Game Caches?
The purpose is usual, to save objects or values in a particular level, and load these objects, values again in the next or higher levels. There are other advanced purposes in creating one. They will be discussed later.
Operating Game Caches:
Now, here's where we are standing. Before you create a Game Cache, you should create a Variable first. Go to Variables (With the X icon in it, or hotkey Ctrl+B). Click New Variable and then type the name of your variable. Then set it's type to 'Game Cache'. If you have multiple game caches, check the 'Array' checkbox and set the size (If you have multiple game caches) Then click OK.
Now you have a Game Cache variable which can be used to associate game caches.
Game Cache Actions
Here are the actions of the Game Cache category which are shown in the trigger editor. To create a Game Cache action, click the New Action (Hotkey Ctrl+R) button and click a 'Game Cache - ' Action. Each action has useful details and examples.
Game Cache - Create Game Cache
- Creates a new Game Cache from a map. The Game Cache should be created from your map. Type the map filename in the 'MapName.w3v' field value and change it to your map's filename. The game cache should be from your map so that it's functions will work properly. If the map filename you have typed does not exist, the cache will be created.
Game Cache - Save Game Cache
- Saves the game cache, using the same filename from which it was created. If you use the Actions; Store Integer,Boolean, Unit, etc., then using the Save Game Cache action will save those objects and are available for restoration.
Game Cache - Store Unit
- Stores unit as a Label in a Category in an existing Game Cache. 2 ways to select a unit. First select a function like last created unit, picked unit, etc. Or to store a particular unit, select a unit in the map then use the unit's variable in the field (ex. Peon 0015 <gen>).
"Store Unit" Field Values
- Store Unit (The field wherein your selected unit will be stored) as Label (The unit's label in a category. You can type any) of Category (The category wherein the label will be saved) in (Last Created Game Cache). You can also change it's value like a Game Cache variable or simply last created game cache.
Game Cache - Store Real
- Same as 'Store Unit' but more different. You'll have to store a Real number this time. A Real number is a decimal (ex. 1.00, 1.25, 2.79, etc.).
"Store Unit" Field Values
- Same as the 'Store Unit' fields, but the object stored is a Real number this time. Also create individual categories for the values.
Game Cache - Store Integer
- Same as 'Store Unit' but much more different. You'll have to store an Integer this time. An Integer is a non-decimal or plain number. (ex. 1, 2, 3, 4, 5, etc.).
"Store Unit" Field Values
- Same as the 'Store Unit' fields, but the object stored is an Integer this time. Also create individual categories for the values.
Game Cache - Store Boolean
- Same as 'Store Unit' but much more different. You'll have to store a Boolean value this time. A Boolean value is a value that associates with events and conditions. (ex. 'A unit enters Region 001' then follows the condition 'Triggering unit is a Hero equal to True'. The Boolean value is set to true, so the unit that enters Region 001 should be a hero. If the condition is met, then the actions will be initiated).
"Store Unit" Field Values
- Same as the 'Store Unit' fields, but the object stored is an Integer this time. Also create individual categories for the values.
Game Cache - Restore Unit Facing Angle
- Restores a unit 'Label' from a created Category in a game cache. This action restores or loads a stored unit for a player in a region facing a particular facing angle. The angle is shown in degrees.
Game Cache - Restore Unit Facing Point
- Same as the 'Restore Unit Facing Angle' action. But the unit loaded this time faces a region, not the facing angle itself.
Game Cache - Reload All
- Reloads all game cache from the computer's disk.
Game Cache - Clear Game Cache
- Clears all labels of all categories in a game cache.
Game Cache - Clear Category
- Clears all labels of a specific category in a game cache.
Saving heroes using Game Caches
If you are making an RPG map, then this tutorial will definitely be the best support. If you create an RPG game most likely selecting a hero or a builder or anything, you should create a trigger that saves objects, yet it is not initially on,
with the 'initially on' checkbox unchecked. Once your hero is selected, the trigger will be turned on using 'Trigger - Turn On (The name of the trigger). You can make many events. Here are 2 examples of triggers that can be used in saving objects.
Here are Game Caches for the impatient mappers. Try this in an empty map:
Code:
Examples:
Save Hero Typing save
[COLOR=Gray] Events
Player - Player 1 (Red) types a chat message containing -save as An exact match
Conditions
((Triggering player) controller) Equal to User
Actions
Game Cache - Create a game cache from Game Cache Demo.w3v
Set GameCache = (Last created game cache)
Unit Group - Pick every unit in (Units owned by (Triggering player)) and do (Actions)
Loop - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
((Picked unit) is A Hero) Equal to True
Then - Actions
Game Cache - Store (Picked unit) as Heroes of SavedHeroes in GameCache
Trigger - Turn on Load Hero <gen>
Unit - Remove (Picked Unit) from the game
Else - Actions
Do nothing[/COLOR]
In the second trigger you'll have to place a Circle of Power of any size and then create a region in the circle, particularly named
'Save Hero Circle' in my demo map.
Code:
Save Hero Enter Region
[COLOR=Gray]Events
Unit - A unit enters Save Hero Circle <gen>
Conditions
((Triggering unit) is A Hero) Equal to True
Actions
Game Cache - Create a game cache from Game Cache Demo.w3v
Set GameCache = (Last created game cache)
Game Cache - Store (Triggering unit) as Heroes of SavedHeroes in GameCache
Unit - Remove (Triggering Unit) from the game
Trigger - Turn on Load Hero <gen>[/COLOR]
applied in this area of the tutorial. It'll be discussed later
You can also create an enabled but not intitially on trigger that loads the unit in a game cache. Here's an example.
Code:
Load Hero
=Events
Player - Player 1 (Red) types a chat message containing -load as An exact match
=Conditions
((Triggering player) controller) Equal to User
=Actions
Game Cache - Restore Heroes of SavedHeroes from GameCache for Player 1 (Red) at (Center of Load Game <gen>) facing Default building facing
Game - Display to (All players) the text: It works!!
You'll see your newly loaded hero with the same hp, mana and attributes unlike before!! That's only for beginners. More types
will be discussed later.
Advanced Game Cache Techniques:
Highly advanced game cache techniques are shown here. Those who want to save more than units and other techniques, are here. Two
detailed techniques are shown.
1) Saving an Army then Loading it again.
It works the same way as of saving a single hero, but much more special and tougher. You'll need to create an army and then
create triggers the same way you create a trigger to save a hero. You'll need a bunch of these triggers if you have a bigger
army. To make things quicker, try using the action "Unit Group - Pick every unit in (Function) and do Action".
Create a trigger that loads units similar to above, still not initially on. Create a large region for the army to be restored
and make sure nothing is in it. You can then make events to load the army. You can then see your army with the same units and
attributes as of before you stored them.
2) Saving a Whole Town
The most difficult technique where you'll have to create a town that contains lots of units, buildings and heroes.
This is totally difficult and takes minutes to do it, but it gives a great impact to your map. You'll save your whole
town with all the units and buildings. You'll have to load those units just like above. But this you'll need to restore
each unit exactly to it's position after the objects have been saved. If your town is large, you'll have to create a dozen
triggers to complete the job. After these things, put creeps near your town and test it. Save your town and, watch the creeps
crush your town. Once nothing is left, do something to load the town like typing -load. You'll see the town back again.
ADDITIONAL TUTORIALS
1) How to save heroes and load them to another map
This is a trigger where in you will save the used hero in the currently played map. I use the hero thrall. You also need a variable.
You can use any event..
Code:
Save Thrall
Events
Magtheridon 0019 <gen> Dies
Conditions
Actions
Game Cache - Create a game cache from Lvl1Game.w3v
Set HeroCache - (Last Created Game Cache)
Game Cache - Store Thrall 0001 <gen> as Thrall of Lvl1 in HeroCache
Game Cache - Save HeroCache
Then you'll make another trigger in another map to load the hero in the previous map. Always save a game cache before loading it. You need another variable in the other map. In this trigger there are also additional actions like learning skills. I've got it in a campaign map using WinMPQ, opened the map and saw the triggers
Code:
Load Thrall in Lvl2Game
Events
Elapsed game time is 5.00 seconds
Conditions
Actions
Game Cache - Restore Thrall of Lvl1 from (Last created game cache) for Player 1 (Red) at (Center of ThrallLoad <gen>) facing 360.00
Set Thrall = (Last restored unit)
If (Thrall Not equal to No unit) then do (Skip remaining actions) else do (Do nothing)
-------- Create Default Hero --------
Unit - Create 1 Thrall for Playa1 at (Center of ThrallLoad <gen>) facing 350.00 degrees
Hero - Set (Last created unit) Hero-level to 4, Hide level-up graphics
Hero - Learn skill for (Last created unit): Orc Far Seer - Far Sight
Hero - Learn skill for (Last created unit): Orc Far Seer - Chain Lightning
Hero - Learn skill for (Last created unit): Orc Far Seer - Chain Lightning
Hero - Learn skill for (Last created unit): Orc Far Seer - Feral Spirit
Set Thrall = (Last created unit)
Tutorial Summary
I hope these things have polished some of your triggering skills especially in creating Game Caches.
You can download my demo map about game caches by going to the URL:
http://www.epicwar.com/maps/7611/
I was kind of rushing to make the map so the author names are not made properly.
Now i added a free download for my demo map:
Download Now!
Written by jonadrian619