Trying to get a trigger where an enemy is facing you and is in a certain range that it will attack your units. But if the enemy back is turned, it won't attack. Anyone has this figured out yet? Thanks.
funkit850Trying to get a trigger where an enemy is facing you and is in a certain range that it will attack your units. But if the enemy back is turned, it won't attack. Anyone has this figured out yet? Thanks.
You'll have to find the position of the 'sneaking' unit relative to the position of the 'guard' unit, and determine whether or not the guard is facing the sneaking unit depending on his facing angle. This requires math I am too tired/drunk to do, but if you want to take a stab at it go for it. I'm sure low-life will be on this, though.
loc = position of (enemy) loc2 = position of (you) Angle Between (loc) and (loc2) equal to facing of (enemy) - x and/or + x Custom Script: call RemoveLocation( udg_loc ) Custom Script: call RemoveLocation( udg_loc2 )
You could just do it with every unit within [aquisition range] of the target. And since you can recycle the veriables, you wouldnt need any more, you would just need to bump in a Unit Group.
You can set those. Pretty much, say you want your angle of view of the foe to be 180° (he can see anything to his front or sides) do loc = position of (enemy) loc2 = position of (you) Angle Between (loc) and (loc2) equal to facing of (enemy) Greater than or equal to - 90 Custom Script: call RemoveLocation( udg_loc ) Custom Script: call RemoveLocation( udg_loc2 ) loc = position of (enemy) loc2 = position of (you) Angle Between (loc) and (loc2) equal to facing of (enemy) Less than or equal to +90 Custom Script: call RemoveLocation( udg_loc ) Custom Script: call RemoveLocation( udg_loc2 ) +/- 90 because 2 90s make up 180. You can increae or decrease his field of view this way. NOTE: DO NOT DO THESE IN CONDITIONS. The removing of leaks with Custom Script: call RemoveLocation( udg_loc ) and loc = position of (enemy) Is vital, unless you want your map to end up like this: L.... A... G...... G.... Y........................... Therefore, use a if then else multiple conditions in the actions, and put the anti leaking triggers AROUND it. --donut3.5--