Hi everyone. With the help of VEN (a lot of help from VEN) and many others from this community, i'm very close to finishing a plugin that makes HE grenades in Counter-Strike shootable with any weapon. It works by creating a new breakable entity everytime a grenade has been thrown, and once it is created, it is set to follow the thrown grenade. If the entity is shot and destroyed, it tells the grenade it is following to detonate. It works very well, however, i do have a problem with the bounding box of the new entity.
When i use entity_set_size() with the mins at { -40.0, -40.0, -40.0 } and maxs at { 40.0, 40.0, 40.0 }, the grenade is almost impossible to shoot. But, when i set the entity's size to { -3.5, -3.5, -3.5 } and { 3.5, 3.5, 3.5 }, it works pretty consistently but not every time, even if i shoot the grenade directly in the center. How come, even if i shoot the nade directly, it will not explode half the time? If I set the entity's size to a large number, shouldn't i be able to shoot anywhere around the nade and break the entity? Any advice is appreciated! here's the code for creating the entity, i use the FM_SetModel forward:
Code:
public Set_Grenade_Box( entity, model[] ) {
if( get_cvar_num( "ToggleValue" ) == 0 )
return PLUGIN_HANDLED;
if( !( is_valid_ent( entity ) ) ) {
return FMRES_IGNORED;
}
if(entity_get_edict( entity, EV_ENT_owner ) && equal( model, g_sHE_Nade_Model ) ) {
new eNade = entity;
new Float:fNadeOrigin[3];
entity_get_vector( eNade, EV_VEC_origin, fNadeOrigin );
entity_set_int( eNade, EV_INT_solid, SOLID_TRIGGER)
new eBox = create_entity( "func_breakable" );
entity_set_origin( eBox, fNadeOrigin );
entity_set_float( eBox, EV_FL_takedamage, 1.0 );
entity_set_float( eBox, EV_FL_health, 5.0 );
entity_set_string( eBox, EV_SZ_classname, g_sBoxClass );
entity_set_model( eBox, g_sHE_Nade_Model );
// entity_set_int( eBox, EV_INT_movetype, MOVETYPE_BOUNCE)
entity_set_int( eBox, EV_INT_solid, SOLID_BBOX)
new Float:mins[3] = { -3.5, -3.5, -3.5 };
new Float:maxs[3] = { 3.5, 3.5, 3.5 };
entity_set_size( eBox, mins, maxs );
// new Float:mins[3] = { -20.5, -20.5, -20.5 };
// new Float:maxs[3] = { 20.5, 20.5, 20.5 };
// entity_set_size( eBox, mins, maxs );
entity_set_edict( eBox, EV_ENT_aiment, eNade );
entity_set_int( eBox, EV_INT_movetype, MOVETYPE_FOLLOW )
entity_set_int( eBox, EV_INT_sequence, 0 );
}
return FMRES_IGNORED;
}