I'm trying to see if a unit, in this case sandbags, is within .9 distance of 1 between two other units. This is what I have and for some reason its not working.
Event: Unit - Any Unit acquires a target
What I want is if a unit is about to attack another unit then execute this. I'm worried that if I do unit is attack it will be too late to add a behavior to the unit that reduces damage
Conditions: ((Acquired Target) has Cover Unit) == True
If the unit has the behavior "Cover Unit" then execute the rest
Actions: General - If (Conditions) then do (Actions) else do (Actions)
Conditions - (Sandbags Unit Type units within 0.9 of ((Position of (Acquired Target)) offset by 1.0 towards (Position of (Triggering unit))) where player Any Player matches filter No Unit Filter, with at most Any Amount) == (Units in Sandbags owned by player (Interger(Any Player)), with at most Any Amount
What this does (theoretically) detect all sandbags within .9 range of 1.0 range between the unit being attacked and the attacker. The other side of the equal sign is what gets me. I tried just doing a unit group and then i tried this which takes the units in the group from any player and any amount. In the Initialization trigger I pick each unit of the entire map that is destructible and add it to the Sandbags unit group.
Then - Unit - Add 1 Reduce Damage to (Acquired Target) from (Triggering Unit)
Then this applies a behavior to the unit that will reduce incoming damage
If you haven't noticed yet I am trying to make a directional cover system where it reduces damage when there is sandbags between the attacker and unit being attacked. If you have a better way to do it please tell me. This was just an idea I had. Thanks for the help.
the sand bags are all in a unit group right. then try this for your check of if there is a sand bag there.: ((position of ( closest unit to (position of (Acquired target)) in (sandbags)) is in region ((x of (position of (Acquired target))), ((y of (position of (Acquired target))), (x of (position of (triggering unit))), ((y of (position of (triggering unit))) == true
I'm trying to see if a unit, in this case sandbags, is within .9 distance of 1 between two other units. This is what I have and for some reason its not working.
Event: Unit - Any Unit acquires a target
What I want is if a unit is about to attack another unit then execute this. I'm worried that if I do unit is attack it will be too late to add a behavior to the unit that reduces damage
Conditions: ((Acquired Target) has Cover Unit) == True
If the unit has the behavior "Cover Unit" then execute the rest
Actions: General - If (Conditions) then do (Actions) else do (Actions) Conditions - (Sandbags Unit Type units within 0.9 of ((Position of (Acquired Target)) offset by 1.0 towards (Position of (Triggering unit))) where player Any Player matches filter No Unit Filter, with at most Any Amount) == (Units in Sandbags owned by player (Interger(Any Player)), with at most Any Amount
What this does (theoretically) detect all sandbags within .9 range of 1.0 range between the unit being attacked and the attacker. The other side of the equal sign is what gets me. I tried just doing a unit group and then i tried this which takes the units in the group from any player and any amount. In the Initialization trigger I pick each unit of the entire map that is destructible and add it to the Sandbags unit group.
Then - Unit - Add 1 Reduce Damage to (Acquired Target) from (Triggering Unit)
Then this applies a behavior to the unit that will reduce incoming damage
If you haven't noticed yet I am trying to make a directional cover system where it reduces damage when there is sandbags between the attacker and unit being attacked. If you have a better way to do it please tell me. This was just an idea I had. Thanks for the help.
Thanks, Cowdog13
the sand bags are all in a unit group right. then try this for your check of if there is a sand bag there.:
((position of ( closest unit to (position of (Acquired target)) in (sandbags)) is in region ((x of (position of (Acquired target))), ((y of (position of (Acquired target))), (x of (position of (triggering unit))), ((y of (position of (triggering unit))) == true
Still alive and kicking, just busy.
My guide to the trigger editor (still a work in progress)