Hello, I did a "laser spot" like of RPG of Half-Life 1. I'm not sure why, but the entity disappear depending of the location that I walk around in the map. In some maps the laser nor appear. The laser is being updated in weapon idle.
Code:
CLaserSpot_Create()
{
new pevLaserSpot = rg_create_entity("env_sprite");
set_entvar(pevLaserSpot, var_movetype, MOVETYPE_NONE);
set_entvar(pevLaserSpot, var_solid, SOLID_NOT);
set_entvar(pevLaserSpot, var_rendermode, kRenderGlow);
set_entvar(pevLaserSpot, var_renderfx, kRenderFxNoDissipation);
set_entvar(pevLaserSpot, var_renderamt, 255.0);
entity_set_model(pevLaserSpot, g_szLaserDotModel);
entity_set_size(pevLaserSpot, Float:{ 0.0, 0.0, 0.0 }, Float:{ 0.0, 0.0, 0.0 });
set_entvar(pevLaserSpot, var_classname, g_pszNameLaserSpot);
//set_entvar(pevLaserSpot, var_owner, this);
return pevLaserSpot;
}
Code:
CRpg_UpdateSpot(this)
{
if (is_nullent(g_pevLaserSpot[this]))
return;
static Float:vecSrc[3], Float:vecVelocity[3], Float:vecAiming[3], Float:vecEndPos[3];
ExecuteHamB(Ham_Player_GetGunPosition, this, vecSrc);
velocity_by_aim(this, 8192, vecVelocity);
xs_vec_add(vecSrc, vecVelocity, vecAiming);
engfunc(EngFunc_TraceLine, vecSrc, vecAiming, DONT_IGNORE_MONSTERS, this, 0);
get_tr2(0, TR_vecEndPos, vecEndPos);
//client_print(0, print_chat, "TR_pHit(%d)", get_tr2(0, TR_pHit))
//get_pmtrace(tr, pmt_endpos, vecEndPos);
/*message_begin(MSG_ONE_UNRELIABLE, SVC_TEMPENTITY, .player = this)
{
write_byte(TE_BEAMPOINTS);
write_coord_f(vecSrc[0]);
write_coord_f(vecSrc[1]);
write_coord_f(vecSrc[2]);
write_coord_f(vecEndPos[0]);
write_coord_f(vecEndPos[1]);
write_coord_f(vecEndPos[2]);
write_short(g_sModelIndexSmokeTrail)
write_byte(0)
write_byte(0)
write_byte(1)
write_byte(15)
write_byte(0)
write_byte(0)
write_byte(0)
write_byte(255)
write_byte(255)
write_byte(0)
}
message_end();*/
set_entvar(g_pevLaserSpot[this], var_origin, vecEndPos);
}
__________________