Checking if the enemy can see the player?

Posted By: Mark430SR

Checking if the enemy can see the player? - 08/14/15 00:54

Hi,

I know c_trace instruction is used for that. The problem is that c_trace always returns positive number even if there are no obstacles between the player and the enemy, so how come I know if the enemy can see the player?
Posted By: DLively

Re: Checking if the enemy can see the player? - 08/14/15 03:55

code?
Posted By: Superku

Re: Checking if the enemy can see the player? - 08/14/15 06:58

Don't use the distance but the
if(trace_hit) ...
variable (or the hit macro, manual: hit and c_trace obviously).
Obviously you want to either c_ignore both player and enemy (or IGNORE_ME and IGNORE_PASSABLE and let's say set the player to passable immediately before the trace and reset the flag after).
© 2024 lite-C Forums