- Joined
- Sep 29, 2006
- Messages
- 447
Basically, I want to make it so that so long as a hero remains within a certain distance from the "cage" in my map, the cage will be controlled by that team and will move toward the goal. The only problem with my trigger is that the cage will only move as long as ALL heroes of a team are near the cage. I just want to make it so that only ONE hero needs to be near the cage to make it move. Here's my trigger:
I'm aware that the problem is that I pick every unit in the unit group, but I don't know how to pick each unit individually and then check to see if any of them are the proper distance. I know I would need to use "Or" and "And" statements, but can't seem to figure out the right way to do it.
+rep for the help.
-
gain ownership
-
Events
- Time - CageMoverTimer expires
-
Conditions
- RedOwnsCage Equal to False
- GreenOwnsCage Equal to False
-
Actions
-
Unit Group - Pick every unit in RedHeroGroup and do (Actions)
-
Loop - Actions
- Set TempPoint = (Position of Cage)
- Set TempPoint2 = (Position of (Picked unit))
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- ((Picked unit) is alive) Equal to True
- (Distance between TempPoint and TempPoint2) Less than or equal to CageCapRadius
-
Then - Actions
- Set RedOwnsCage = True
- Unit - Change ownership of Cage to Player 1 (Red) and Change color
- Unit - Order Cage to Move To RedCircleOfPower
- Else - Actions
-
If - Conditions
- Custom script: call RemoveLocation(udg_TempPoint)
- Custom script: call RemoveLocation(udg_TempPoint2)
-
Loop - Actions
-
Unit Group - Pick every unit in GreenHeroGroup and do (Actions)
-
Loop - Actions
- Set TempPoint = (Position of Cage)
- Set TempPoint2 = (Position of (Picked unit))
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- ((Picked unit) is alive) Equal to True
- (Distance between TempPoint and TempPoint2) Less than or equal to CageCapRadius
-
Then - Actions
- Set GreenOwnsCage = True
- Unit - Change ownership of Cage to Player 7 (Green) and Change color
- Unit - Order Cage to Move To GreenCircleOfPower
- Else - Actions
-
If - Conditions
- Custom script: call RemoveLocation(udg_TempPoint)
- Custom script: call RemoveLocation(udg_TempPoint2)
-
Loop - Actions
-
Unit Group - Pick every unit in RedHeroGroup and do (Actions)
-
Events
I'm aware that the problem is that I pick every unit in the unit group, but I don't know how to pick each unit individually and then check to see if any of them are the proper distance. I know I would need to use "Or" and "And" statements, but can't seem to figure out the right way to do it.
+rep for the help.