Argentine
New Member
- Reaction score
- 2
Help with multi-map game cache triggering
The problem with the below trigger is it will not get you back to map 1 from map 2, i do not know what event and conditions to set for map 1 to justify loading the hero only if the hero came from map 2. If anyone knows how, please reply. thanks.
EDIT: Since the first time i posted asking for help with the below trigger, I have fixed parts of it, but I can not get the hero to come back into map 1 from map 2 without the original starting hero appearing still. How do i tell the game if i loaded a hero/then delete starting unit/else do nothing?
If it helps, this is how I got my trigger to work: Using the following triggers, all I had to do was:
A. Make sure all files of map 1 and map 2 were identical inside and outside of the campaign (sometimes when making campaign maps changes can get lost and it can get confusing if you saved the map in the campaign and out of it, or just one or the other. Make sure you check this.
and B. I made sure all of the names of the variables, categories, game cache references ect... all match perfectly (they are case sensitive) on both maps.
I will explain below how this trigger works but first you will need to make variables for your triggers to function properly. You need variables to refer to certain things which change as you play.
The variables you need are:
Variable name Variable Type Initial Value
gold - Integer (array not checked) 0 (default)
hero - Unit (array not check) -none-
heroname - String (array not checked) -none-
testcache - Game Cache (array not checked) -none-
---------------------------------------------------------------
These variables should be the same on all of your maps.
Now that you have your variables created. Here are all my new triggers:
From this trigger, the first action will create a "game cache" which is a temporary file on your computer to store the information about your game. It is not yet saved on your hard drive.
The second action set the cache you just created with the first trigger as the variable I made called "testcache" (you can name the variable whatever you want). This now allows for us to simply use our variable in other triggers to refer to "testcache" as the cache we created.
The third action will save the game cache on to your hard drive, making it possible to load the information stored in the game cache after this current map has been closed. This is so we can bring our hero across to another map (this only works in single player games).
The next trigger simply saves your game. There is no "event" or "condition" because this trigger was told to run by another trigger's action.
Next I store the hero inside the game cache.
The first action will refer to a variable called "hero" (you must create this as a variable and set your hero to equal this variable in another trigger, i explain further down).
This trigger uses "Game Cache - store unit as label of category in "last created game cache"
I then have to change all the above underlined words (will be underlined on the trigger editor). I set these parameters to what I will refer to them as in all other triggers.
All category, label and "from game cache" in all triggers must use the same names when referring to themselves. They are case sensitive and this is crucial. If you save a hero as "player" of "heroes" in "testcache" you must always resotore "player" of "heroes" in "testcache". Be consistent.
The third trigger I use in the above trigger will cause another trigger to run immediatly and without checking conditions.
The next trigger simply saves your game. There is no "event" or "condition" because this trigger was told to run by another trigger's action.
My trigger runs the next trigger:
Save resources:
Here we are saving player 1's gold amount.
The first trigger: That's pretty straight forward. It uses the variable we made called gold and sets that variable to whatever player 1's current gold is.
Second Trigger: This takes the variable we set player 1's gold to and saves it in our "game cache" temporary folder.
Third Trigger This saves the game cache file to the hard drive so we can later load it into another map.
Next we will save the name of our hero
The next trigger simply saves your game. There is no "event" or "condition" because this trigger was told to run by another trigger's action.
The first trigger sets the variable we made called "heroname" as whatever the name of the hero is, since we set whichever hero we wanted to set as the variable "hero" in another trigger.
The other triggers have been explained above
The next trigger simply saves your game. There is no "event" or "condition" because this trigger was told to run by another trigger's action.
This next trigger i made to be able to trigger leaving one map to goto another.
You can have the "event" and "conditions" be whatever you want them to be.
My trigger uses "entering a region" (this is a region set with the "region layer" screen on the terrain map.)
My condition is "the unit entering the region is a Hero AND is level 4 or higher AND is owned by player 1."
My first action then sets the entering unit as the unit that is stored as the variable "hero". This variable, as you know, is in other triggers and used to load this hero in the other maps.
The last trigger action:
"Trigger - Run store hero <gen>(ignoring conditions)" fires off the trigger sequence we programmed above.
And now here are my map 2 triggers
Before making the triggers, we have to remake all the exact same variables we made in the first map with the same names.
After the variables are made you have to actually create the game cache again, this time from the exact same file name as the first map, using the event "map initialization"
First we made the game cache again.
Second action we use sets the variable to the game cache we made (we did this in the first map)
The third action will restore the hero we saved in map 1 at the specified point.
Next we'll load our gold amount from the first map.
I used the "hashtable" trigger action to set the players "gold" variable to the same gold variable stored from the first map.
Second I used "player - set property" to set player 1's current gold to the amount from our variable.
Next we recall the hero's proper name:
The above trigger action is a hashtable trigger again.
And here's the trigger I made for when I got frustrated (i took out my frustration on my hero) Im not going to explain these triggers, they are too simple and off topic:
Thank you in advance for any and all insight!
The problem with the below trigger is it will not get you back to map 1 from map 2, i do not know what event and conditions to set for map 1 to justify loading the hero only if the hero came from map 2. If anyone knows how, please reply. thanks.
EDIT: Since the first time i posted asking for help with the below trigger, I have fixed parts of it, but I can not get the hero to come back into map 1 from map 2 without the original starting hero appearing still. How do i tell the game if i loaded a hero/then delete starting unit/else do nothing?
If it helps, this is how I got my trigger to work: Using the following triggers, all I had to do was:
A. Make sure all files of map 1 and map 2 were identical inside and outside of the campaign (sometimes when making campaign maps changes can get lost and it can get confusing if you saved the map in the campaign and out of it, or just one or the other. Make sure you check this.
and B. I made sure all of the names of the variables, categories, game cache references ect... all match perfectly (they are case sensitive) on both maps.
I will explain below how this trigger works but first you will need to make variables for your triggers to function properly. You need variables to refer to certain things which change as you play.
The variables you need are:
Variable name Variable Type Initial Value
gold - Integer (array not checked) 0 (default)
hero - Unit (array not check) -none-
heroname - String (array not checked) -none-
testcache - Game Cache (array not checked) -none-
---------------------------------------------------------------
These variables should be the same on all of your maps.
Now that you have your variables created. Here are all my new triggers:
Trigger:
- create cache
- Events
- Map initialization
- Conditions
- Actions
- Game Cache - Create a game cache from test1.w3v
- Set testcache = (Last created game cache)
- Game Cache - Save testcache
- Events
From this trigger, the first action will create a "game cache" which is a temporary file on your computer to store the information about your game. It is not yet saved on your hard drive.
The second action set the cache you just created with the first trigger as the variable I made called "testcache" (you can name the variable whatever you want). This now allows for us to simply use our variable in other triggers to refer to "testcache" as the cache we created.
The third action will save the game cache on to your hard drive, making it possible to load the information stored in the game cache after this current map has been closed. This is so we can bring our hero across to another map (this only works in single player games).
The next trigger simply saves your game. There is no "event" or "condition" because this trigger was told to run by another trigger's action.
Next I store the hero inside the game cache.
Trigger:
- store hero
- Events
- Conditions
- Actions
- Game Cache - Store hero as player of heros in testcache
- Game Cache - Save testcache
- Trigger - Run save resources <gen> (ignoring conditions)
The first action will refer to a variable called "hero" (you must create this as a variable and set your hero to equal this variable in another trigger, i explain further down).
This trigger uses "Game Cache - store unit as label of category in "last created game cache"
I then have to change all the above underlined words (will be underlined on the trigger editor). I set these parameters to what I will refer to them as in all other triggers.
All category, label and "from game cache" in all triggers must use the same names when referring to themselves. They are case sensitive and this is crucial. If you save a hero as "player" of "heroes" in "testcache" you must always resotore "player" of "heroes" in "testcache". Be consistent.
The third trigger I use in the above trigger will cause another trigger to run immediatly and without checking conditions.
The next trigger simply saves your game. There is no "event" or "condition" because this trigger was told to run by another trigger's action.
My trigger runs the next trigger:
Trigger:
- save resources
- Events
- Conditions
- Actions
- Set gold = (Player 1 (Red) Current gold)
- Game Cache - Store gold as gold of resources in testcache
- Game Cache - Save testcache
- Trigger - Run save hero name <gen> (ignoring conditions)
Save resources:
Here we are saving player 1's gold amount.
The first trigger: That's pretty straight forward. It uses the variable we made called gold and sets that variable to whatever player 1's current gold is.
Second Trigger: This takes the variable we set player 1's gold to and saves it in our "game cache" temporary folder.
Third Trigger This saves the game cache file to the hard drive so we can later load it into another map.
Next we will save the name of our hero
The next trigger simply saves your game. There is no "event" or "condition" because this trigger was told to run by another trigger's action.
Trigger:
- save hero name
- Events
- Conditions
- Actions
- Set heroname = (Proper name of (hero))
- Game Cache - Store heroname as heroname of heros in testcache
- Game Cache - Save (Last created game cache)
- Trigger - Run goto map 2 <gen> (ignoring conditions)
The first trigger sets the variable we made called "heroname" as whatever the name of the hero is, since we set whichever hero we wanted to set as the variable "hero" in another trigger.
The other triggers have been explained above
The next trigger simply saves your game. There is no "event" or "condition" because this trigger was told to run by another trigger's action.
Trigger:
- goto map 2
- Events
- Conditions
- Actions
- Game - Save game as testautosave.w3z and change level to Maps\test2.w3x (Skip scores)
This next trigger i made to be able to trigger leaving one map to goto another.
Trigger:
- Trigger map 2
- Events
- Unit - A unit enters goto map 2 <gen>
- Conditions
- (((Entering unit) is A Hero) Equal to True) and (((Hero level of (Entering unit)) Equal to 4) and ((Owner of (Entering unit)) Equal to Player 1 (Red)))
- Actions
- Set hero = (Entering unit)
- Trigger - Run store hero <gen> (ignoring conditions)
- Events
You can have the "event" and "conditions" be whatever you want them to be.
My trigger uses "entering a region" (this is a region set with the "region layer" screen on the terrain map.)
My condition is "the unit entering the region is a Hero AND is level 4 or higher AND is owned by player 1."
My first action then sets the entering unit as the unit that is stored as the variable "hero". This variable, as you know, is in other triggers and used to load this hero in the other maps.
The last trigger action:
"Trigger - Run store hero <gen>(ignoring conditions)" fires off the trigger sequence we programmed above.
And now here are my map 2 triggers
Before making the triggers, we have to remake all the exact same variables we made in the first map with the same names.
After the variables are made you have to actually create the game cache again, this time from the exact same file name as the first map, using the event "map initialization"
Trigger:
- load cache
- Events
- Map initialization
- Conditions
- Actions
- Game Cache - Create a game cache from test1.w3v
- Set testcache = (Last created game cache)
- Game Cache - Restore player of heros from testcache for Player 1 (Red) at (Center of come from map 1 <gen>) facing 0.00
- Events
First we made the game cache again.
Second action we use sets the variable to the game cache we made (we did this in the first map)
The third action will restore the hero we saved in map 1 at the specified point.
Next we'll load our gold amount from the first map.
Trigger:
- load gold
- Events
- Time - Elapsed game time is 0.00 seconds
- Conditions
- Actions
- Set gold = (Load gold of resources from testcache)
- Player - Set Player 1 (Red) Current gold to gold
- Events
I used the "hashtable" trigger action to set the players "gold" variable to the same gold variable stored from the first map.
Second I used "player - set property" to set player 1's current gold to the amount from our variable.
Next we recall the hero's proper name:
Trigger:
- heroname
- Events
- Time - Elapsed game time is 0.00 seconds
- Conditions
- Actions
- Set heroname = (Load heroname of heros from testcache)
- Events
The above trigger action is a hashtable trigger again.
And here's the trigger I made for when I got frustrated (i took out my frustration on my hero) Im not going to explain these triggers, they are too simple and off topic:
Trigger:
- nerd rage
- Events
- Player - Player 1 (Red) types a chat message containing WTFDIE as An exact match
- Conditions
- Actions
- Unit - Create 50 Green Dragon for Neutral Hostile at (Position of Paladin 0001 <gen>) facing (Random angle) degrees
- Events
Thank you in advance for any and all insight!