Quote:
Originally Posted by Bugsy
in_view_cone() + visible check should be enough.
Have you confirmed the correct 2 player variables are used to get the origins?
|
i used this to get data
PHP Code:
public clcmd_origin(id)
{
static Float:fOrigin[3], Float:fAngle[3], iEyeOrigin[3]
get_user_origin(id, iEyeOrigin, Origin_Eyes)
pev(id, pev_origin, fOrigin)
pev(id, pev_angles, fAngle)
server_print("Eye Origin: %i.0, %i.0, %i.0", iEyeOrigin[0], iEyeOrigin[1], iEyeOrigin[2])
server_print("Origin: %0.1f, %0.1f, %0.1f", fOrigin[0], fOrigin[1], fOrigin[2])
server_print("Angle: %0.1f, %0.1f, %0.1f", fAngle[0], fAngle[1], fAngle[2])
pev(id, pev_view_ofs, fAngle)
server_print("View Offset: %0.1f, %0.1f, %0.1f", fAngle[0], fAngle[1], fAngle[2])
pev(id, pev_v_angle, fAngle)
server_print("View Angle: %0.1f, %0.1f, %0.1f", fAngle[0], fAngle[1], fAngle[2])
client_print(id, print_chat, "[Console] Origin Saved. Check Console")
}
and get this result
Code:
Eye Origin: 1698.0, 2137.0, -1907.0
Origin: 1698.7, 2137.0, -1924.9
Angle: -0.5, -92.8, 0.0
View Offset: 0.0, 0.0, 17.0
View Offset: 1.6, -92.8, 0.00
and the data I got at that position that I want to use is
PHP Code:
new const Float:NPC_Origin[][3] =
{
{1707.0, 2154.0, -1924.9}
}
new const Float:NPC_Angle[][3] =
{
{-2.3, -89.0, 0.0}
}
new const Float:NPC_VAngle[][3] =
{
{1.6, -92.8, 0.0}
}
new const Float:NPC_ViewOfs[][3] =
{
{0.0, 0.0, 17.0}
}
PHP Code:
public Spawn_NPC(id)
{
...
set_pev(ent, pev_angles, NPC_Angle[0])
set_pev(ent, pev_view_ofs, NPC_VAngle[0])
set_pev(ent, pev_v_angle, NPC_ViewOfs[0])
...
}
public Zombie_Think(ent)
{
....
pev(g_PlayerID, pev_origin, fVicOrigin)
pev(ent, pev_origin, fOrigin)
if(bRunning)
{
if(distance < 270.0)
set_pev(ent, pev_iuser1, STATE_ATTACK)
}
else
{
if(fm_is_visible(ent, fVicOrigin) && fm_is_in_viewcone(ent, fVicOrigin) && !is_wall_between_points(fOrigin, fVicOrigin, 0))
client_print(0, print_center, "Detected")
}
...
}
I tried but it still didn't work didn't work. I walk in front of it, nothing happened
is_wall_between_points work normally because of my previous code, it did not dectect when I behind object.
Quote:
Originally Posted by Natsheh
TIP : when you're using is_wall_between_points in zombie think set the third Param the zombie entity index to ignore the zombie otherwise it might give you always false results. Since also when you're creating the zombie you dont give him the monster flag.
|
The zombie I used have flags FL_MONSTER and FL_MONSTERCLIP so I think I should put it as 0 (I updated it later on, adding those flags)
__________________