public CreateNPC(id)
{
new Float:fOrigin[3];
get_user_origin(id, OriginCien[id]);
IVecFVec(OriginCien[id], fOrigin);
iEnt[id] = create_entity("info_target")
fOrigin[2] += 40.0;
entity_set_int(iEnt[id], EV_INT_movetype, MOVETYPE_FOLLOW)
entity_set_int(iEnt[id], EV_INT_solid, SOLID_BBOX)
entity_set_edict(iEnt[id], EV_ENT_aiment, id)
entity_set_edict(iEnt[id], EV_ENT_owner, id);
entity_set_origin(iEnt[id],fOrigin);
entity_set_float(iEnt[id], EV_FL_ltime, halflife_time() + 10 + 0.5);
entity_set_float(iEnt[id],EV_FL_takedamage,1.0)
entity_set_float(iEnt[id],EV_FL_health,get_user_health(id) + 0.0)
new szModel[ 64 ] , szAllPath[ 256 ];
cs_get_user_model( id , szModel , charsmax( szModel ));
formatex( szAllPath , charsmax( szAllPath ) , "models/player/%s/%s.mdl" , szModel , szModel );
entity_set_string(iEnt[id],EV_SZ_classname,"NPC");
entity_set_model(iEnt[id],szAllPath);
entity_set_int(iEnt[id],EV_INT_solid, 2)
new Float:maxs[3] = {16.0,16.0,36.0}
new Float:mins[3] = {-16.0,-16.0,-36.0}
entity_set_size(iEnt[id],mins,maxs)
entity_set_int(iEnt[id],EV_INT_sequence,1);
drop_to_floor(iEnt[id])
entity_set_float(iEnt[id],EV_FL_nextthink,halflife_time() + 0.5);
}
Jest tutaj nadane:
entity_set_int(iEnt[id], EV_INT_movetype, MOVETYPE_FOLLOW)
entity_set_int(iEnt[id], EV_INT_solid, SOLID_BBOX)
entity_set_edict(iEnt[id], EV_ENT_aiment, id)
Okej, NPC się tworzy, podąża za graczem. Ale jak zrobić, by ent stał obok mnie, a nie we mnie?