I'm having trouble with a trigger checking if there are any enemies near a particular region. This action is one iteration of a loop.
region array is an array of regions
region owner is an array containing the owner of a region
i is the loop iterator
fortress is a structure that exists exactly once in each region, near the center.
No matter how small the radius, or what alliance setting I use, the statement never returns true, i.e., the set is never empty. I'm stumped here. Anyone have any ideas?
Comparison
Value 1: Units In Region With Alliance To Player
Region: Convert Circle To Region
Center: Center Of Region
Region: region array
Index 1: i
Radius: 1.0 --25.0 in live code
Alliance: Any Exclude Self
Player: Owner Of Unit
Unit: Closest Unit To Point
Point: Center Of Region
Region: region array
Index 1: i
Group: Units In Region Matching Condition
Unit Type: Fortress
Region: region array
Index 1: i
Player: region owner --added as a test, should be redundant
Index 1: i
Unit Filter: Excluded: Missile, Dead, Hidden
Count: Any Amount
Unit Filter: Excluded: Missile, Dead, Hidden
Count: Any Amount
Operator: ==
Value 2: Empty Unit Group
I'm not at home to check, but this might work (please excuse the pseudo code):
local variable: fortress_group (empty unit group)
Pick each unit in unit group (in region matching conditions, entire map, any player), unit type: fortress unit
- Add unit to "fortress_group"
For each integer i, 1 to (number of units in unit group, "fortress_group")
-Pick each unit in unit group (in region matching conditions (convert circle to region, centred on (unit from unit group "fortress_group", index i), radius 25.0)
-If owner of picked unit != owner of unit from unit group "fortress_group", index i
-Then "Enemies near our Fortress"! / Else "No enemies nearby"
I'm having trouble with a trigger checking if there are any enemies near a particular region. This action is one iteration of a loop.
region array is an array of regions
region owner is an array containing the owner of a region
i is the loop iterator
fortress is a structure that exists exactly once in each region, near the center.
No matter how small the radius, or what alliance setting I use, the statement never returns true, i.e., the set is never empty. I'm stumped here. Anyone have any ideas?
Comparison
Value 1: Units In Region With Alliance To Player
Region: Convert Circle To Region
Center: Center Of Region
Region: region array
Index 1: i
Radius: 1.0 --25.0 in live code
Alliance: Any Exclude Self
Player: Owner Of Unit
Unit: Closest Unit To Point
Point: Center Of Region
Region: region array
Index 1: i
Group: Units In Region Matching Condition
Unit Type: Fortress
Region: region array
Index 1: i
Player: region owner --added as a test, should be redundant
Index 1: i
Unit Filter: Excluded: Missile, Dead, Hidden
Count: Any Amount
Unit Filter: Excluded: Missile, Dead, Hidden
Count: Any Amount
Operator: ==
Value 2: Empty Unit Group
@qerodar: Go
Quick question, are the regions pre-placed, or are you making them dynamically? You seem to creating a region that is centred on a pre-placed region
@ChromiumBoy:
its pre-placed
the regions are static as well, no motion through triggers.
@qerodar: Go
I'm not at home to check, but this might work (please excuse the pseudo code):
local variable: fortress_group (empty unit group)
Pick each unit in unit group (in region matching conditions, entire map, any player), unit type: fortress unit
- Add unit to "fortress_group"
For each integer i, 1 to (number of units in unit group, "fortress_group")
-Pick each unit in unit group (in region matching conditions (convert circle to region, centred on (unit from unit group "fortress_group", index i), radius 25.0)
-If owner of picked unit != owner of unit from unit group "fortress_group", index i
-Then "Enemies near our Fortress"! / Else "No enemies nearby"
@ChromiumBoy:
huh, yeah, that should work. I could probably work in a unit counter to the enemy unit group as a threat level indicator too. Thanks for your help.
@qerodar: Go
Np, let me know how it goes ;)
@ChromiumBoy:
it worked, I was able to run a few layers of it to give a quantitative threat level assessment as well.