I'm not sure why. I really am banging my head against a wall on this one.
So, here's what I'm trying to do- I'm trying to create a unit at point A (var), order it to move to point B (a predefined point on the map), and then a second set of actions take place when it reaches this point. I have this set up in 2 triggers, where the first one creates and orders the unit to move, which I've confirmed that it does move to the right place. Once it gets to point B, the second trigger is supposed to run on an event "[any unit] Enters [1.0] of [point B]". To test if it's entering trigger 2's action list, the first thing I have listed is a text message display just saying "trigger 2 entered".
Events are only registered once. Updating the variable you used in an event definition will not change the event as it's only reading its value at the start of the map and never again.
Better solution:
Use a circular region and move the region around. Place the region on the map and reference it in the event and in your triggers.
Thanks for the reply- I don't quite understand what you mean though. Are you saying that it's reading the original location of my predefined point, not the location of it after it's been moved?
EDIT: your suggestion worked, although I don't know exactly why. could you elaborate?
Basically using variables in events never works out. For instance, if you have a periodic event that happens every x seconds, if you change x it won't change how often it occurs.
Instead you would use a variable wait in the actions.
It's just the way it is :/
OK. I've usually used a general 'such and such was clicked/selected/etc' and then define the player, unit, or whatnot that triggered the event as a variable, which works out OK. Are conditions good places to use variables or should I be wary there too? I have a lot of repeatedly used triggers that use this format as I mentioned. Also, you can't use the 'wait' command for events, only for conditions (unfortunately). I tried to do what you suggested using only conditions and found it more or less impossible.
Also, for my general knowledge: does a trigger get 'checked' by event first and then the conditions are checked, or are they checked at the same time? What I'm getting at is does it generate b.net traffic when the event(s) are satisfied, or does it have to meet both the event and the conditions are?
Events are loaded on map initialization, which means they can only operate on predefined parameters like preplaced units/regions/cameras/etc, constants, or presets (Any Player, for example.)
Conditions are checked every time a trigger is run, so they can operate using variables which may or may not have changed over the course of the game, as well as some of the aforementioned predefined parameters.
I'm not sure what you mean by Wait commands in conditions or events. These are action functions. You can use timer expiration as an event and then check which specific timer expired in conditions. This is typically the format: events register some general occurrence, such as a unit dying or a timer expiring, and conditions are used to narrow things down to a specific occurrence. You want to be as specific as possible with events because, when an event fires, it consumes a considerable amount of system memory which can be a cause of lag in your game - which is why I recommend the use of loops instead of many periodic events. This, however, is usually only necessary for advanced functions within a map.
So to answer your last question, an event firing will use system memory regardless of whether conditions pass or fail. This is why certain events such as "unit uses weapon" are discouraged for maps which typically have lots of units with weapons shooting at each other. If you find that a trigger is causing a lot of lag in your map because of a rapidly-firing event, try using a loop in actions instead (loops are things like Repeat Forever or While functions).
I'm not sure why. I really am banging my head against a wall on this one.
So, here's what I'm trying to do- I'm trying to create a unit at point A (var), order it to move to point B (a predefined point on the map), and then a second set of actions take place when it reaches this point. I have this set up in 2 triggers, where the first one creates and orders the unit to move, which I've confirmed that it does move to the right place. Once it gets to point B, the second trigger is supposed to run on an event "[any unit] Enters [1.0] of [point B]". To test if it's entering trigger 2's action list, the first thing I have listed is a text message display just saying "trigger 2 entered".
No dice though. Any insight?
Here's my 2 triggers.
Events are only registered once. Updating the variable you used in an event definition will not change the event as it's only reading its value at the start of the map and never again.
Better solution:
Use a circular region and move the region around. Place the region on the map and reference it in the event and in your triggers.
Thanks for the reply- I don't quite understand what you mean though. Are you saying that it's reading the original location of my predefined point, not the location of it after it's been moved?
EDIT: your suggestion worked, although I don't know exactly why. could you elaborate?
Basically using variables in events never works out. For instance, if you have a periodic event that happens every x seconds, if you change x it won't change how often it occurs. Instead you would use a variable wait in the actions. It's just the way it is :/
@AstralCV: Go
OK. I've usually used a general 'such and such was clicked/selected/etc' and then define the player, unit, or whatnot that triggered the event as a variable, which works out OK. Are conditions good places to use variables or should I be wary there too? I have a lot of repeatedly used triggers that use this format as I mentioned. Also, you can't use the 'wait' command for events, only for conditions (unfortunately). I tried to do what you suggested using only conditions and found it more or less impossible.
Also, for my general knowledge: does a trigger get 'checked' by event first and then the conditions are checked, or are they checked at the same time? What I'm getting at is does it generate b.net traffic when the event(s) are satisfied, or does it have to meet both the event and the conditions are?
@En7ropi: Go
Events are loaded on map initialization, which means they can only operate on predefined parameters like preplaced units/regions/cameras/etc, constants, or presets (Any Player, for example.)
Conditions are checked every time a trigger is run, so they can operate using variables which may or may not have changed over the course of the game, as well as some of the aforementioned predefined parameters.
I'm not sure what you mean by Wait commands in conditions or events. These are action functions. You can use timer expiration as an event and then check which specific timer expired in conditions. This is typically the format: events register some general occurrence, such as a unit dying or a timer expiring, and conditions are used to narrow things down to a specific occurrence. You want to be as specific as possible with events because, when an event fires, it consumes a considerable amount of system memory which can be a cause of lag in your game - which is why I recommend the use of loops instead of many periodic events. This, however, is usually only necessary for advanced functions within a map.
So to answer your last question, an event firing will use system memory regardless of whether conditions pass or fail. This is why certain events such as "unit uses weapon" are discouraged for maps which typically have lots of units with weapons shooting at each other. If you find that a trigger is causing a lot of lag in your map because of a rapidly-firing event, try using a loop in actions instead (loops are things like Repeat Forever or While functions).