Okay, to do this, we need to know how the Xel'Naga Tower controlling works...which is an ability called Tower Capture. The ability automatically casts itself whenever a non-buried, non-dead, non-hidden, non-missile, non-structure, non-uncommandable...*whew*...and non-under-construction ground unit is nearby. Set an event to trigger when the ability Tower Capture is used, and use the Triggering Ability Unit Target to get the player in control of the tower.
If you don't want to use an event for it, you'll need to use Unit Ability Command State (returns a boolean) to determine if the Tower Capture ability is being used, then Target Unit for Order to get the unit. Here's an example for this:
(Xel'Naga Tower [7.00, 16.00] ability command ((Tower Capture, 0)) is in state Executing) == True
(Target unit for (Xel'Naga Tower [7.00, 16.00] order at index 0)) == Value 2
To determine if the tower is being controlled at all:
Value 1: Unit Ability Command State
Unit: Xel'Naga Tower [7.00, 16.00]
Ability Command: Ability Command
Ability: Tower Capture
Command: 0
State: Executing
Operator: ==
Value 2: True
And to get the player in control of the tower:
Value 1: Target Unit For Order
Order: Unit Order
Unit: Xel'Naga Tower [7.00, 16.00]
Index: 0
I'm also interested in doing this, but not even this simple trigger works. Note that Tower Capture is named "Designate (Unnamed)".
Xel Naga Test 1
Events
Unit - Any Unit uses Designate (Unnamed) at Generic1 - Any stage (Ignore shared abilities)
Local Variables
Conditions
Actions
UI - Display "xelnaga" for (All players) to Subtitle area
This doesn't work either
Xel Naga Test 2
Events
Timer - Every 5.0 seconds of Game Time
Local Variables
Conditions
(Xel'Naga Tower [39.00, 61.00] ability command ((Tower Capture, 0)) is in state Executing) == True
Actions
UI - Display "xelnaga" for (All players) to Subtitle area
Like the topic says, I'm trying to find a way to check which player is in control of a xel naga tower then do actions.
Okay, to do this, we need to know how the Xel'Naga Tower controlling works...which is an ability called Tower Capture. The ability automatically casts itself whenever a non-buried, non-dead, non-hidden, non-missile, non-structure, non-uncommandable...*whew*...and non-under-construction ground unit is nearby. Set an event to trigger when the ability Tower Capture is used, and use the Triggering Ability Unit Target to get the player in control of the tower.
If you don't want to use an event for it, you'll need to use Unit Ability Command State (returns a boolean) to determine if the Tower Capture ability is being used, then Target Unit for Order to get the unit. Here's an example for this:
(Xel'Naga Tower [7.00, 16.00] ability command ((Tower Capture, 0)) is in state Executing) == True
(Target unit for (Xel'Naga Tower [7.00, 16.00] order at index 0)) == Value 2
To determine if the tower is being controlled at all:
Value 1: Unit Ability Command State
Unit: Xel'Naga Tower [7.00, 16.00]
Ability Command: Ability Command
Ability: Tower Capture
Command: 0
State: Executing
Operator: ==
Value 2: True
And to get the player in control of the tower:
Value 1: Target Unit For Order
Order: Unit Order
Unit: Xel'Naga Tower [7.00, 16.00]
Index: 0
I'm also interested in doing this, but not even this simple trigger works. Note that Tower Capture is named "Designate (Unnamed)".
Xel Naga Test 1
Events
Unit - Any Unit uses Designate (Unnamed) at Generic1 - Any stage (Ignore shared abilities)
Local Variables
Conditions
Actions
UI - Display "xelnaga" for (All players) to Subtitle area
This doesn't work either
Xel Naga Test 2
Events
Timer - Every 5.0 seconds of Game Time
Local Variables
Conditions
(Xel'Naga Tower [39.00, 61.00] ability command ((Tower Capture, 0)) is in state Executing) == True
Actions
UI - Display "xelnaga" for (All players) to Subtitle area
For some reason, Capture abilities don't trigger script events. You will have to remake the capture ability as a target effect ability.
Check this post: http://www.sc2mapster.com/forums/development/data/31861-solved-channeled-behaviours/ Note that you will need to fix the validator. Read the answers below.