• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

Enemy vision

Status
Not open for further replies.
Level 2
Joined
Nov 10, 2006
Messages
8
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.
 
Level 4
Joined
Oct 23, 2006
Messages
65
funkit850 said:
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.

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.
 
Level 2
Joined
Nov 10, 2006
Messages
8
This is what I have so far. The "facing of (enemy) - x and/or + x " is what I don't get. :(

screeeny.jpg
 
Level 27
Joined
Feb 22, 2006
Messages
3,052
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--
 
Level 2
Joined
Nov 10, 2006
Messages
8
Problemo!

Ok, ran into a snag. Here is my code I've done up.

screeeny1.jpg


and when I tested this, it comes out like this.

screeeny2.jpg


So, for some reason, the undead unit is still detecting the Tourist unit in all degrees.

It works perfect with the undead unit facing 90 degrees but any other degrees the vision is messed up. Why is this?
 
Status
Not open for further replies.
Top