Warcraft III resources & community, 2003–2006 · archived

Enemy vision

11 posts
#1

Enemy vision

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.
#2

Re: Enemy vision

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.
#3
Aye, bets he will

Anyways,

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 )
#4
Wow, you're the man. Thanks! I'll get to it.
#5
But what if I had mutiple enemies? I'd have to make a lot of regions... is there a way to get around that?
#6
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.
#8
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--
#9
Sweet, thanks for the help!
#11
the > 90 and < 90 have to be in the same condition (or the one will fire alot of the time, only BOTH wont fire very often)

Also, make sure that those numbers will work out right.