| The Inhabitant Of Heavens |
11-16-2011 12:50 |
create_zombie
my NPC always stuck in ground, how to fix that
PHP Code:
public create_zombie(Float:origin[3],Float:angle[3])
{
new ent = create_entity("info_target");
entity_set_string(ent, EV_SZ_classname, "npc_zombie");
entity_set_origin(ent, origin);
entity_set_vector(ent, EV_VEC_angles, angle);
set_pev(ent,pev_takedamage,1.0)
set_pev(ent,pev_dmg,1.0)
//Make our NPC recieve damage and give it some health
entity_set_float(ent, EV_FL_takedamage, 1.0);
entity_set_float(ent, EV_FL_health, 250.0+HEALTH_OFFSET);
//Set the model for our NPC
entity_set_model(ent, "models/npc.mdl");
//Set our movetype and solid stuff for our NPC
entity_set_int(ent, EV_INT_movetype, MOVETYPE_PUSHSTEP);
entity_set_int(ent, EV_INT_solid, SOLID_BBOX);
Util_PlayAnimation(ent, 2)
//Set our NPC bounding size box respect to the models origin
new Float: mins[3] = {-24.0, -24.0, 0.0 }
new Float: maxs[3] = { 24.0, 24.0, 75.0 }
entity_set_size(ent, mins, maxs);
//These four controllers are for the moveable bones for models. All vary differently. Numbers start at 0 to 255
//This controller for our model controls the head rotation. 0 means the head will turn far left while 255 means the head will turn far right
entity_set_byte(ent,EV_BYTE_controller1,125);
// entity_set_byte(ent,EV_BYTE_controller2,125);
// entity_set_byte(ent,EV_BYTE_controller3,125);
// entity_set_byte(ent,EV_BYTE_controller4,125);
//Drop our NPC to the floor
drop_to_floor(ent);
entity_set_int(ent, EV_INT_modelindex, mdl_zombie);
// set speed monster
npc_speed[ent]=130;
npc_state[ent]=0; //spawning
npc_activenode[ent]=-1;
npc_node[ent][0]=-1;
npc_node[ent][1]=-1;
npc_node[ent][2]=-1;
// starting animation
set_task(2.0,"state_active",ent);
//Make our NPC instantly think when it spawns
entity_set_float(ent, EV_FL_nextthink, get_gametime() + 0.01)
}
|