Im using the unit enters region trigger but it seems to be getting triggered by units that are not entering the region. The weird part is that as long as the units are totally still everything works as expected. however if units are in motion they will set off the trigger even though they are not near the region. Any ideas why this would happen?
I'm curious. Why does it say "RegionGetCenter"? For me, it says "Center of Region ()".
To answer your question, more information is needed. Have you tried running with the debugger? It should tell you when the event runs. Possibly, you have another trigger running.
RegionGetCenter is the actual function name. I did run it with the debugger. What I do is I set up a group of units patrolling between two points far away from the region. Then I have another group that just stands there, they will be the group the region passes over. It works for the stationary units as I would expect..but it starts to fire the trigger for the patrolling units then as well...its really weird. If instead of patrolling the units are stationary then they do not fire the trigger.
yes the region is moving..but I have reliably tracked its movement and it is where it is supposed to be. The event def fires when its supposed to. If all units on the map are stationary it works perfectly.
It seems that it happens everywhere..no matter how far they are. if they are moving they can fire the trigger. It happens one at a time..so I would expect that if for some reason the region was moving to this location(which im pretty sure its not) it would catch more than just one unit at a time. As I watch the debugger I can see the trigger fire for the moving units one at a time, and it moves them to the center of the region.
well the region does not always exist, The player causes the region to be created. I create it well out of the map bounds and then move it to where I need it to be. I was under the impression that this movement was instantaneous...and it doesn't seem to be the reason for error.
I think you might be better off drawing a region with the tool rather than coding it, then using another trigger to make the region itself move. You'll have to start the region on the map well out of the way instead of off the map I believe, but that might help.
What exactly is supposed to happen if it were working correctly?
I actually fixed it...I found a line of code that was creating the region when it shouldn't have been created..oops! I also completely unregistered the events for all the triggers involved and only create them when they are needed. This seems to have fixed it, no more random units setting off the trigger.
@knifesmile When they enter the region they get moved to the center of the region. I have to use code since I only want the region to exist when the conditions I set are met. I create each region at point 0, 0 as you can see above. Thanks for your help though. : )
Rollback Post to RevisionRollBack
To post a comment, please login or register a new account.
Im using the unit enters region trigger but it seems to be getting triggered by units that are not entering the region. The weird part is that as long as the units are totally still everything works as expected. however if units are in motion they will set off the trigger even though they are not near the region. Any ideas why this would happen?
So may be you post your trigger here? ;)
...Really...did ya put (Any Unit Enters Region)?
Hi, here is my trigger
no ideas?
I'm curious. Why does it say "RegionGetCenter"? For me, it says "Center of Region ()".
To answer your question, more information is needed. Have you tried running with the debugger? It should tell you when the event runs. Possibly, you have another trigger running.
RegionGetCenter is the actual function name. I did run it with the debugger. What I do is I set up a group of units patrolling between two points far away from the region. Then I have another group that just stands there, they will be the group the region passes over. It works for the stationary units as I would expect..but it starts to fire the trigger for the patrolling units then as well...its really weird. If instead of patrolling the units are stationary then they do not fire the trigger.
@starKidney: Go
Does it fire anywhere on the map, or just certain places? When you say "region passes over", are you implying that you are moving the region?
In Warcraft 3, you couldn't move regions and still depend on their events firing. I don't know if it's the same case here.
yes the region is moving..but I have reliably tracked its movement and it is where it is supposed to be. The event def fires when its supposed to. If all units on the map are stationary it works perfectly.
It seems that it happens everywhere..no matter how far they are. if they are moving they can fire the trigger. It happens one at a time..so I would expect that if for some reason the region was moving to this location(which im pretty sure its not) it would catch more than just one unit at a time. As I watch the debugger I can see the trigger fire for the moving units one at a time, and it moves them to the center of the region.
@starKidney: Go
Does it work correctly if the region is kept stationary (never moves at all, not once).
well the region does not always exist, The player causes the region to be created. I create it well out of the map bounds and then move it to where I need it to be. I was under the impression that this movement was instantaneous...and it doesn't seem to be the reason for error.
the region is created with:
gv_Region = RegionCircle( Point(0,0), (gv_RegionSize));
when it is no longer needed i use:
gv_Region = null;
@starKidney: Go
I think you might be better off drawing a region with the tool rather than coding it, then using another trigger to make the region itself move. You'll have to start the region on the map well out of the way instead of off the map I believe, but that might help.
What exactly is supposed to happen if it were working correctly?
I actually fixed it...I found a line of code that was creating the region when it shouldn't have been created..oops! I also completely unregistered the events for all the triggers involved and only create them when they are needed. This seems to have fixed it, no more random units setting off the trigger.
@knifesmile When they enter the region they get moved to the center of the region. I have to use code since I only want the region to exist when the conditions I set are met. I create each region at point 0, 0 as you can see above. Thanks for your help though. : )