Участник
Пользователь
- Сообщения
- 78
- Реакции
- 1
Подскажите почему может не вызываться "PaladinExplode__Touch", когда "PaladinExplode__Think" отыгрывает всё хорошо и есть анимация, но тач даже не вызывается, пробовал с SOLID_TRIGGER, тоже не работает
Код:
public Create_Sphere(const id, const item)
{
new ent = rg_create_entity(EntityPaladinReferance);
if (is_nullent(ent))
return;
new Vector3(vecOrigin); UTIL_GetEyePosition(id, vecOrigin);
new Vector3(vecDirection); UTIL_GetVectorAiming(id, vecDirection);
xs_vec_add_scaled(vecOrigin, vecDirection, 20.0, vecOrigin);
engfunc(EngFunc_SetOrigin, ent, vecOrigin);
engfunc(EngFunc_SetModel, ent, EntityPaladinModel);
engfunc(EngFunc_SetSize, ent, Float:{-1.0, -1.0, -1.0}, Float:{1.0, 1.0, 1.0});
set_entvar(ent, var_classname, EntityPaladinClassNames[0]);
set_entvar(ent, var_solid, SOLID_TRIGGER);
set_entvar(ent, var_movetype, MOVETYPE_FLY);
set_entvar(ent, var_owner, id);
xs_vec_mul_scalar(vecDirection, EntityPaladinSpeed, vecDirection);
set_entvar(ent, var_velocity, vecDirection);
engfunc(EngFunc_VecToAngles, vecDirection, vecDirection);
set_entvar(ent, var_angles, vecDirection);
set_entvar(ent, var_scale, 0.05);
set_entvar(ent, var_rendermode, kRenderTransAdd);
set_entvar(ent, var_renderamt, 255.0);
SetTouch(ent, "PaladinSphere__Touch");
}
public PaladinSphere__Touch(const ent, const toucher)
{
if (toucher == get_entvar(ent, var_owner))
return;
new id = get_entvar(ent, var_owner);
new Vector3(Origin); get_entvar(ent, var_origin, Origin);
new expl = Create_Explode(id, Origin);
client_print(0, print_chat, "1 - %d", expl);
UTIL_KillEntity(ent);
}
public Create_Explode(const id, const Float:Origin[3])
{
new exp = rg_create_entity(EntityPaladinReferance);
if (is_nullent(exp))
return NULLENT;
static Vector3(vecMins), Vector3(vecMaxs);
if (IsNullVector(vecMins) && IsNullVector(vecMaxs))
{
vecMins[0] = vecMins[1] = vecMins[2] = -EntityPaladinModelSize;
vecMaxs[0] = vecMaxs[1] = vecMaxs[2] = EntityPaladinModelSize;
}
engfunc(EngFunc_SetOrigin, exp, Origin);
engfunc(EngFunc_SetModel, exp, EntityPaladinModelExp);
engfunc(EngFunc_SetSize, exp, vecMins, vecMaxs);
set_entvar(exp, var_classname, EntityPaladinClassNames[1]);
set_entvar(exp, var_movetype, MOVETYPE_NONE);
set_entvar(exp, var_solid, SOLID_NOT);
set_entvar(exp, var_owner, id);
set_entvar(exp, var_frame, 0.0);
set_entvar(exp, var_framerate, 0.075);
set_entvar(exp, var_fuser1, 9.0);
set_entvar(exp, var_scale, 0.5);
set_entvar(exp, var_rendermode, kRenderTransAdd);
set_entvar(exp, var_renderamt, 255.0);
set_entvar(exp, var_nextthink, get_gametime());
SetThink(exp, "PaladinExplode__Think");
SetTouch(exp, "PaladinExplode__Touch");
return exp;
}
public PaladinExplode__Think(const exp)
{
if (is_nullent(exp))
return;
static Float:flFrame; get_entvar(exp, var_frame, flFrame);
static Float:flFrameRate; get_entvar(exp, var_framerate, flFrameRate);
static Float:flMaxFrame; flMaxFrame = get_entvar(exp, var_fuser1);
if(flFrame < flMaxFrame)
{
flFrame += 1.0;
set_entvar(exp, var_frame, flFrame);
set_entvar(exp, var_nextthink, get_gametime() + flFrameRate);
return;
}
UTIL_KillEntity(exp);
}
public PaladinExplode__Touch(const exp, const toucher)
{
if (!IsUserValid(toucher))
return;
static pOwner; pOwner = get_entvar(exp, var_owner);
if (toucher == pOwner)
return;
if (IsSimilarPlayersTeam(toucher, pOwner))
return;
static Float:flGameTime; flGameTime = get_gametime();
static Float:flDamageTime; get_entvar(toucher, var_dmgtime, flDamageTime);
if (flDamageTime < flGameTime)
{
set_member(toucher, m_LastHitGroup, HIT_GENERIC);
ExecuteHamB(Ham_TakeDamage, toucher, exp, pOwner, EntityPaladinDamage, EntityPaladinDamageType);
client_print(0, print_chat, "%d | %d", toucher, exp);
set_entvar(toucher, var_dmgtime, flGameTime + EntityPaladinDamageTime);
}
}