I am looking to detect the event "Unit from Unit Group Enters Region."
Problems I'm confronted with:
1) You cannot enter variable regions into this event, and I need to enter multiple regions to trigger the same event.
2) You can not automatically decide which Units trigger this event, because there's no Unit Group filter.
I must either set it to "Any Unit" and then check the condition "Triggering Unit is from Unit Group," which will lag like hell with lots of units for just one region, never mind the fact I need to create this event again within the same trigger for every other region.
Or I can create an event for each unit in the unit group, for each regions. So if I have have a unit group of size 6 and 8 different regions, I need 48 events for one trigger. WAIT WHAT!
This is what my events look like right now (I only did it for 3 regions instead of 8)
As far as tainted's comment, i disgress that there is always a way to do something. I'm afraid we need more specific info on what your trying to accomplish and what the end result is. I would actually stray way from preplaced regions. If your using a lot of regions you should be looking into a multli threaded loop that will cut down the work a ton (simply a threaded action definition that loops through each base unit and the area around it to check and then routes it to another definition for the actual actions.) Im an advanced triggerer and i'd be happy to help; just be specific on what you want to do.
That's the easy solution, but horribly laggy 200+ units on the map. When you use "Any Unit" the starcraft 2 engine will check Every Unit on the entire map 16 times per second to see whether or not it is in the region.
By setting it to a specific unit, the starcraft 2 engine will only check to see if that unit is within the region instead of every single unit.
As far as tainted's comment, i disgress that there is always a way to do something. I'm afraid we need more specific info on what your trying to accomplish and what the end result is. I would actually stray way from preplaced regions. If your using a lot of regions you should be looking into a multli threaded loop that will cut down the work a ton (simply a threaded action definition that loops through each base unit and the area around it to check and then routes it to another definition for the actual actions.) Im an advanced triggerer and i'd be happy to help; just be specific on what you want to do.
In a nutshell, I want a dialog box to open when a player's FPS unit (Avatar) enters the region. Since I have 6 players, I need to create an event for each of their units.
I was able to solve the problem of the multiple regions, by creating one pre-placed mega region. That being said, there seems to be no way of creating a single event for all of the players. I must must create 6 different events:
Player1 Enters MegaRegion, PLayer 2 Enters MegaRegion...Player6 Enters MegaRegion
Best thing to do would be add a threaded action definition to the map init trigger. Run a forever loop (or whatever fits your map) with a small wait at the end like .1 sec, then within it check the region or each region from an array and if the number of units is greater than 0; if it is pick each unit and show dialog based on owner of the picked unit or pick each player and check if unit with picked owner is in picked region .
If you need to specify which units based on type, owner, array, or whatever just add that if then after the pick loop or add it into the conditions of the picked each player loop.
The biggest problem is blizzard doesn't support using presets for regions, which would make this whole problem non-existent. Your best bet is to array the regions at the start of the game into a static array formation (I.E. region 1 = Regions[1], etc, etc) and call the regions that way in your code with some kind of tracked variable (in this case, player number seems adequate.)
Units are easy because you can just validate the triggering unit = to the correct player's unit through conditions, as shown here.
Rollback Post to RevisionRollBack
I am largely inactive, but I am still around. Feel free to poke me if you need some help, just be warned that I only really come back if I need help and/or if I'm posting a new map/library.
This is the worst possible solution to my problem, this is the one I'm trying to avoid. When you use "Any Unit, " each game loop (16 times per second), starcraft 2 engine will cycle through every unit on your map to check if it is within that region, until the trigger is disabled/turned off. It will do this even if no valid units are in the region.
Now, I if I have 200+ units on my map, and 30-40 different triggering regions, that would get quite messy. However, that all being said, I made a workaround using entirely different events, dummy units and custom values.
Basically - Event - Player clicks bunker gun -
Conditions: Player is in region,
BunkerGun is not Occupied
Get custom value of sentry gun for variable/record index.
Show dialog
I am largely inactive, but I am still around. Feel free to poke me if you need some help, just be warned that I only really come back if I need help and/or if I'm posting a new map/library.
oh whoops, didn't read carefully enough. You said you solved it, so no need for my solution.
I only solved it for my special case. Each time I run into this problem, I have to come up with crazy type of workaround, and that workaround is never the same. It's very frustrating, thus I'm hoping to see if anyone has a solution or custom event that takes care of this.
Unfortunately this is all I can recommend, this way it will only run when a specific unit enters the region, then you can validate which actions to run based on which event ran.
It's pretty much the same as the system I recommended but it should stop it checking each unit and instead will check the unit for a few seconds and realize it isn't the correct unit and will stop.
Really the only way to solve this without it firing for every unit and only one specific unit is next to impossible, because it will always check which unit enters to validate the conditions. Or so I think, I really haven't read up too much on the mechanics, but I do know that this way should produce next to no lag.
Rollback Post to RevisionRollBack
I am largely inactive, but I am still around. Feel free to poke me if you need some help, just be warned that I only really come back if I need help and/or if I'm posting a new map/library.
I just noticed, even using array variables with this event still counts as any unit and triggers every time if the variable is empty on map init. initializing it in a map init trigger doesn't help
or if I don't use a specific, existing unit from the start in the event, I may also use "any unit".
normal variables do work, but they are very inconvenient.
I've one bit don't leave this area and several small, enter this with a unit area. But I will probably leave it for now.
putting all units in unitgrps and have the event check unit 1, unit 2 etc from uniitgrp enters might also work. but thats shitty too.
A simple: any unit from unit group enters region would be great.
I am looking to detect the event "Unit from Unit Group Enters Region."
Problems I'm confronted with:
1) You cannot enter variable regions into this event, and I need to enter multiple regions to trigger the same event.
2) You can not automatically decide which Units trigger this event, because there's no Unit Group filter.
I must either set it to "Any Unit" and then check the condition "Triggering Unit is from Unit Group," which will lag like hell with lots of units for just one region, never mind the fact I need to create this event again within the same trigger for every other region.
Or I can create an event for each unit in the unit group, for each regions. So if I have have a unit group of size 6 and 8 different regions, I need 48 events for one trigger. WAIT WHAT!
This is what my events look like right now (I only did it for 3 regions instead of 8)
@EdwardSolomon: Go
I was able to combine all of these regions into one region at map initialization; however, I must still create one event per unit in the unit group.
-----Then the desired trigger:
lol, that region adding crashes the game at map initialization or time elasped.
I will have to manually create this monster region!
@EdwardSolomon: Go
Can 1 player enter more then just 1 bunker?
If not, im not a triggerer, but it may be possible to do.
Any unit enters any unit
Conditions Unit == Avatar
LIke I said Im no triggerer so that might not even be possible.
As far as tainted's comment, i disgress that there is always a way to do something. I'm afraid we need more specific info on what your trying to accomplish and what the end result is. I would actually stray way from preplaced regions. If your using a lot of regions you should be looking into a multli threaded loop that will cut down the work a ton (simply a threaded action definition that loops through each base unit and the area around it to check and then routes it to another definition for the actual actions.) Im an advanced triggerer and i'd be happy to help; just be specific on what you want to do.
@Taintedwisp: Go
That's the easy solution, but horribly laggy 200+ units on the map. When you use "Any Unit" the starcraft 2 engine will check Every Unit on the entire map 16 times per second to see whether or not it is in the region.
By setting it to a specific unit, the starcraft 2 engine will only check to see if that unit is within the region instead of every single unit.
In a nutshell, I want a dialog box to open when a player's FPS unit (Avatar) enters the region. Since I have 6 players, I need to create an event for each of their units.
I was able to solve the problem of the multiple regions, by creating one pre-placed mega region. That being said, there seems to be no way of creating a single event for all of the players. I must must create 6 different events:
Player1 Enters MegaRegion, PLayer 2 Enters MegaRegion...Player6 Enters MegaRegion
@EdwardSolomon: Go
To make things worse, we can't even use Variables for the Unit either.
I had to specifically set the unit to War Pig.
Event:
War Pig [X1, Y1] Enters MegaRegion
Hammer Securites [X2, Y2] Enters MegaRegion
.................
Spectre [X6, Y6] enters MegaRetion
-------------I'll have to obtain the triggering player by unit custom value.
I can't recall any other Event that is this buggy
Are the region(s) based off of area around a unit or just random spots in the map?
Best thing to do would be add a threaded action definition to the map init trigger. Run a forever loop (or whatever fits your map) with a small wait at the end like .1 sec, then within it check the region or each region from an array and if the number of units is greater than 0; if it is pick each unit and show dialog based on owner of the picked unit or pick each player and check if unit with picked owner is in picked region .
If you need to specify which units based on type, owner, array, or whatever just add that if then after the pick loop or add it into the conditions of the picked each player loop.
I suggest something like this:
The biggest problem is blizzard doesn't support using presets for regions, which would make this whole problem non-existent. Your best bet is to array the regions at the start of the game into a static array formation (I.E. region 1 = Regions[1], etc, etc) and call the regions that way in your code with some kind of tracked variable (in this case, player number seems adequate.)
Units are easy because you can just validate the triggering unit = to the correct player's unit through conditions, as shown here.
<<quote 1102176>>
I suggest something like this:This is the worst possible solution to my problem, this is the one I'm trying to avoid. When you use "Any Unit, " each game loop (16 times per second), starcraft 2 engine will cycle through every unit on your map to check if it is within that region, until the trigger is disabled/turned off. It will do this even if no valid units are in the region.
Now, I if I have 200+ units on my map, and 30-40 different triggering regions, that would get quite messy. However, that all being said, I made a workaround using entirely different events, dummy units and custom values.
Basically - Event - Player clicks bunker gun -
Conditions: Player is in region, BunkerGun is not Occupied
Get custom value of sentry gun for variable/record index. Show dialog
oh whoops, didn't read carefully enough. You said you solved it, so no need for my solution.
I only solved it for my special case. Each time I run into this problem, I have to come up with crazy type of workaround, and that workaround is never the same. It's very frustrating, thus I'm hoping to see if anyone has a solution or custom event that takes care of this.
@EdwardSolomon: Go
Well I think your solution works rather well, as it will only run when the player clicks on it, is in the region and has the bunker unoccupied.
That being said, here's what I had proposed:
Unfortunately this is all I can recommend, this way it will only run when a specific unit enters the region, then you can validate which actions to run based on which event ran.
It's pretty much the same as the system I recommended but it should stop it checking each unit and instead will check the unit for a few seconds and realize it isn't the correct unit and will stop.
Really the only way to solve this without it firing for every unit and only one specific unit is next to impossible, because it will always check which unit enters to validate the conditions. Or so I think, I really haven't read up too much on the mechanics, but I do know that this way should produce next to no lag.
I just noticed, even using array variables with this event still counts as any unit and triggers every time if the variable is empty on map init. initializing it in a map init trigger doesn't help
or if I don't use a specific, existing unit from the start in the event, I may also use "any unit".
@b0ne123: Go
I had noticed that too, so I made a neat workaround.
Event: Periodic - Every 0.0625 seconds
Action: If [Your Unit] is in region, then perform actions.
------normal variables do work, but they are very inconvenient.
I've one bit don't leave this area and several small, enter this with a unit area. But I will probably leave it for now.
putting all units in unitgrps and have the event check unit 1, unit 2 etc from uniitgrp enters might also work. but thats shitty too.
A simple: any unit from unit group enters region would be great.
fixed it:
leave the trigger without event
after mapInit, when the arrays are initialized, add custom code and use the code line:
the trigger does now work only with this specific unit and no longer with any
Oh nice bro.