Hello.
I'm trying to remake the boss Dr.Rex from Dias. Maybe some people have heard about this plugin and I have a question. Does anyone know how to speed up the monster's turn towards the player? Because it is slow in my opinion. It's so slow that I can run behind him without any problems and it will never turn to me:
https://www.youtube.com/watch?v=OAre...ature=youtu.be
I would like him to rotate like in this movie:
https://www.youtube.com/watch?v=Z9cYFix-D_0&t=296s
I talked to the author of the film but he did not want to help me, he said that I have to do it myself although I told him that I had no idea about scripting.
I only know that it has something to do with the functions Aim_To and REX_STATE_MOVE:
PHP Code:
public Aim_To(iEnt, Float:vTargetOrigin[3], Float:flSpeed, Style)
{
if(!pev_valid(iEnt))
return
if(!Style)
{
static Float:Vec[3], Float:Angles[3]
pev(iEnt, pev_origin, Vec)
Vec[0] = vTargetOrigin[0] - Vec[0]
Vec[1] = vTargetOrigin[1] - Vec[1]
Vec[2] = vTargetOrigin[2] - Vec[2]
engfunc(EngFunc_VecToAngles, Vec, Angles)
//Angles[0] = Angles[2] = 0.0
set_pev(iEnt, pev_v_angle, Angles)
set_pev(iEnt, pev_angles, Angles)
} else {
new Float:f1, Float:f2, Float:fAngles, Float:vOrigin[3], Float:vAim[3], Float:vAngles[3];
pev(iEnt, pev_origin, vOrigin);
xs_vec_sub(vTargetOrigin, vOrigin, vOrigin);
xs_vec_normalize(vOrigin, vAim);
vector_to_angle(vAim, vAim);
if (vAim[1] > 180.0) vAim[1] -= 360.0;
if (vAim[1] < -180.0) vAim[1] += 360.0;
fAngles = vAim[1];
pev(iEnt, pev_angles, vAngles);
if (vAngles[1] > fAngles)
{
f1 = vAngles[1] - fAngles;
f2 = 360.0 - vAngles[1] + fAngles;
if (f1 < f2)
{
vAngles[1] -= flSpeed;
vAngles[1] = floatmax(vAngles[1], fAngles);
}
else
{
vAngles[1] += flSpeed;
if (vAngles[1] > 180.0) vAngles[1] -= 360.0;
}
}
else
{
f1 = fAngles - vAngles[1];
f2 = 360.0 - fAngles + vAngles[1];
if (f1 < f2)
{
vAngles[1] += flSpeed;
vAngles[1] = floatmin(vAngles[1], fAngles);
}
else
{
vAngles[1] -= flSpeed;
if (vAngles[1] < -180.0) vAngles[1] += 360.0;
}
}
set_pev(iEnt, pev_v_angle, vAngles)
set_pev(iEnt, pev_angles, vAngles)
}
}
PHP Code:
case REX_STATE_SEARCHING_ENEMY:
{
static Victim; Victim = FindClosetEnemy(ent, 1)
if(is_user_alive(Victim))
{
set_pev(ent, pev_enemy, Victim)
g_BossState = REX_STATE_MOVE
} else {
set_pev(ent, pev_enemy, 0)
g_BossState = REX_STATE_IDLE
}
}
case REX_STATE_MOVE:
{
static Enemy; Enemy = pev(ent, pev_enemy)
static Float:EnemyOrigin[3]
pev(Enemy, pev_origin, EnemyOrigin)
if(is_user_alive(Enemy))
{
if(entity_range(Enemy, ent) <= floatround(REX_ATTACK_RANGE))
{
g_BossState = REX_STATE_ATTACK
Aim_To(ent, EnemyOrigin, 2.0, 1)
if(random_num(0, 1) == 1) Rex_StartAttack11(ent+TASK_ATTACK)
else Rex_StartAttack12(ent+TASK_ATTACK)
} else {
if(pev(ent, pev_movetype) == MOVETYPE_PUSHSTEP)
{
static Float:OriginAhead[3]
get_position(ent, 300.0, 0.0, 0.0, OriginAhead)
Aim_To(ent, EnemyOrigin, 1.0, 1)
hook_ent2(ent, OriginAhead, REX_MOVESPEED)
Set_EntAnim(ent, REX_RUN, 1.0, 0)
} else {
set_pev(ent, pev_movetype, MOVETYPE_PUSHSTEP)
}
}
} else {
g_BossState = REX_STATE_SEARCHING_ENEMY
}
}
I just want to give him the function of rotation speed towards the player with the possibility of changing ;)