Example usage for Point 7 in the first post above :-
Create a trigger with the following and place a few Tempests in your map:-
Event : Any Unit Enters (Entire Map)
Condition : (Unit Type of (Triggering Unit)) == Tempest
Actions : Send message "SetTintColor 255,0,0" to actor (Return Actor Ref "StormSphereAttachment" from Triggering Unit Actor)
You will notice that the Tempest's blue sphere weapon now turns red.
Another Example Usage of Point 7 in the above:-
Create a trigger with the following and place a few Oracles as well as some enemy Siege Tanks in your map:-
Event : Any Unit has Revealed change Create
Actions : Send message "SetTintColor 255,0,0" to actor (Return Actor Ref "OracleRevelationBehaviorModel" from Triggering Unit Actor)
Next, go to your map and use the Oracle's Revelation ability to reveal the enemy Siege Tanks. You will notice that the blue reveal model above the tanks now becomes red.
Hope that these 2 examples as stated will be of great use to anyone who has troubles linking an attached actor to the triggering Unit Actor as shown. Thanks.
1. Only returns the owner of the first unit in a unit group
Hi, it works on my map as attached regardless of the unit index in the unit group. See the trigger -> Squadron Strike Cooldown Reset under the File Bomber Precision Strike in the map as attached. Also, use the Squadron Strike Ability from the Orbital Command and see that the strike platform group cooldown works as intended for player 1 (Owner of the Strike Platform Unit Group).
Did you save the Unit Group Variable (Global) as a string in the Save Unit Group in the Data Table action?, then use it as a parameter for the Function?.
Below are some of the custom functions which I think might be helpful. I do hope that others will also post in this thread if they do find any other useful functions.
1. Owner of Unit Group
Options : Functions
Return Type : Integer
Parameter : -> Unit Group = (Name from the Global data table)
Hint Text : Used in Conjunction with Save Unit Group in the data table. Returns the Owner of the Unit Group.
Action :
Unit Group - Pick Each Unit in Unit Group[Parameter] and do Actions
-> Actions
General - Return (Owner of (Picked Unit))
General - Return 0
2. Get Unit Closest to Unit Group with less than Distance
Options : Function
Return Type : Unit
Parameters : Unit = Triggering Unit
Unit Group = Empty Unit Group
Distance = 0.0
Hint : This function addresses the Unit from Unit Group that is closest to the triggering unit/main unit with distance of
less than.
Actions :-
If then Else Conditions
If
-> Distance between (Position of Unit [Parameter]) and Position of (Closest Unit to (Position of Unit [Parameter]) in
Unit Group [Parameter]))) <Distance [Parameter]
Then
-> Return (Closest Unit to (Position of Unit [Parameter]) in Unit Group [Parameter])
-> Return No Unit [Preset]
3. Get Created Unit/Magazine Unit from Arm Magazine Ability
Options : Function
Return Type : Unit
Parameters : Ability = No Game Link
Hint : This function addresses the created unit from the arm magazine ability.
Used in conjunction with Unit Is Created event.
Actions:-
If Then Else Conditions
If
-> (Ability that created unit) == Ability [Parameter]
Then
-> Return (Created unit)
-> Return No Unit [Preset]
4. Get Magazine Ammo Unit from Unit Effect
Options : Function
Return Type : Unit
Hint : This function addresses the magazine unit from unit.
Used in conjunction with Effect Used event.
Actions:-
Return (Triggering Effect Unit(Target))
5. Return Search Area Effect From Unit On Straight Line Points
Options : Action
Return Type : None
Parameters :
-> Effect = No Game Link
-> Unit = No Unit
-> Point = No Point
Grammar Text : Return Search Area Effect (Effect) From Unit (Unit) To Point (Point)
Local Variables :
-> Points Array = ((Position of Unit) offset by 500.0 towards (Angle from (Position of Unit) to Point) degrees) <Point[125]>
-> i = 0
Actions :
General - For Each Integer i from 1 to 125 with increment 1, do (Actions)
Actions
Variable - Set Points Array[i] = ((Position of Unit) offset by (i * 4.0) towards (Angle from (Position of Unit) to Point) degrees)
Environment - Execute Effect at Points Array[i] from Unit
6. Return Actor Ref from Unit Actor
Options : Function
Return Type : Actor
Parameters :
-> Actor ID = ""<string>
-> Unit Type = No Game Link <Game Link-Unit>
Grammar Text : Return Actor Ref Actor ID from Unit Actor Unit Type
Hint Text : Links the Actor Reference from the Unit Actor and used in conjunction with the Unit Enters Region event and the Send Actor Message action.
Actions :
If Then Else Conditions
If
-> (Unit Type of (Triggering Unit)) == Unit Type
Then
-> General - Return (Actor connected to (Actor for (Triggering Unit) via reference Actor ID)
-> Return No Actor
7. Return Actor Ref from Triggering Unit Actor
Options : Function
Return Type : Actor
Parameters :
-> Actor ID = ""<string>
Grammar Text : Return Actor Ref Actor ID from Triggering Unit Actor
Hint Text : Links the Actor Reference from the Triggering Unit Actor and used in conjunction with the Unit Enters Region event and the Send Actor Message action. Use this when you already have a condition Unit Type of (Triggering Unit) in the trigger.
Actions :
General - Return (Actor connected to (Actor for (Triggering Unit) via reference Actor ID)
Updated.
Example usage for Point 7 in the first post above :-
Create a trigger with the following and place a few Tempests in your map:-
Event : Any Unit Enters (Entire Map)
Condition : (Unit Type of (Triggering Unit)) == Tempest
Actions : Send message "SetTintColor 255,0,0" to actor (Return Actor Ref "StormSphereAttachment" from Triggering Unit Actor)
You will notice that the Tempest's blue sphere weapon now turns red.
Another Example Usage of Point 7 in the above:-
Create a trigger with the following and place a few Oracles as well as some enemy Siege Tanks in your map:-
Event : Any Unit has Revealed change Create
Actions : Send message "SetTintColor 255,0,0" to actor (Return Actor Ref "OracleRevelationBehaviorModel" from Triggering Unit Actor)
Next, go to your map and use the Oracle's Revelation ability to reveal the enemy Siege Tanks. You will notice that the blue reveal model above the tanks now becomes red.
Hope that these 2 examples as stated will be of great use to anyone who has troubles linking an attached actor to the triggering Unit Actor as shown. Thanks.
Hi, it works on my map as attached regardless of the unit index in the unit group. See the trigger -> Squadron Strike Cooldown Reset under the File Bomber Precision Strike in the map as attached. Also, use the Squadron Strike Ability from the Orbital Command and see that the strike platform group cooldown works as intended for player 1 (Owner of the Strike Platform Unit Group).
Did you save the Unit Group Variable (Global) as a string in the Save Unit Group in the Data Table action?, then use it as a parameter for the Function?.
Yes. That is working as intended.
Hi, guys,
Below are some of the custom functions which I think might be helpful. I do hope that others will also post in this thread if they do find any other useful functions.
1. Owner of Unit Group
Options : Functions
Return Type : Integer
Parameter : -> Unit Group = (Name from the Global data table)
Hint Text : Used in Conjunction with Save Unit Group in the data table. Returns the Owner of the Unit Group.
Action :
Unit Group - Pick Each Unit in Unit Group[Parameter] and do Actions
-> Actions
General - Return (Owner of (Picked Unit))
General - Return 0
2. Get Unit Closest to Unit Group with less than Distance
Options : Function
Return Type : Unit
Parameters : Unit = Triggering Unit
Unit Group = Empty Unit Group
Distance = 0.0
Hint : This function addresses the Unit from Unit Group that is closest to the triggering unit/main unit with distance of
less than.
Actions :-
If then Else Conditions
If
-> Distance between (Position of Unit [Parameter]) and Position of (Closest Unit to (Position of Unit [Parameter]) in
Unit Group [Parameter]))) < Distance [Parameter]
Then
-> Return (Closest Unit to (Position of Unit [Parameter]) in Unit Group [Parameter])
-> Return No Unit [Preset]
3. Get Created Unit/Magazine Unit from Arm Magazine Ability
Options : Function
Return Type : Unit
Parameters : Ability = No Game Link
Hint : This function addresses the created unit from the arm magazine ability.
Used in conjunction with Unit Is Created event.
Actions:-
If Then Else Conditions
If
-> (Ability that created unit) == Ability [Parameter]
Then
-> Return (Created unit)
-> Return No Unit [Preset]
4. Get Magazine Ammo Unit from Unit Effect
Options : Function
Return Type : Unit
Hint : This function addresses the magazine unit from unit.
Used in conjunction with Effect Used event.
Actions:-
Return (Triggering Effect Unit(Target))
5. Return Search Area Effect From Unit On Straight Line Points
Options : Action
Return Type : None
Parameters :
-> Effect = No Game Link
-> Unit = No Unit
-> Point = No Point
Grammar Text : Return Search Area Effect (Effect) From Unit (Unit) To Point (Point)
Local Variables :
-> Points Array = ((Position of Unit) offset by 500.0 towards (Angle from (Position of Unit) to Point) degrees) <Point[125]>
-> i = 0
Actions :
General - For Each Integer i from 1 to 125 with increment 1, do (Actions)
Actions
Variable - Set Points Array[i] = ((Position of Unit) offset by (i * 4.0) towards (Angle from (Position of Unit) to Point) degrees)
Environment - Execute Effect at Points Array[i] from Unit
6. Return Actor Ref from Unit Actor
Options : Function
Return Type : Actor
Parameters :
-> Actor ID = ""<string>
-> Unit Type = No Game Link <Game Link-Unit>
Grammar Text : Return Actor Ref Actor ID from Unit Actor Unit Type
Hint Text : Links the Actor Reference from the Unit Actor and used in conjunction with the Unit Enters Region event and the Send Actor Message action.
Actions :
If Then Else Conditions
If
-> (Unit Type of (Triggering Unit)) == Unit Type
Then
-> General - Return (Actor connected to (Actor for (Triggering Unit) via reference Actor ID)
-> Return No Actor
7. Return Actor Ref from Triggering Unit Actor
Options : Function
Return Type : Actor
Parameters :
-> Actor ID = ""<string>
Grammar Text : Return Actor Ref Actor ID from Triggering Unit Actor
Hint Text : Links the Actor Reference from the Triggering Unit Actor and used in conjunction with the Unit Enters Region event and the Send Actor Message action. Use this when you already have a condition Unit Type of (Triggering Unit) in the trigger.
Actions :
General - Return (Actor connected to (Actor for (Triggering Unit) via reference Actor ID)
Thanks.