AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   create_zombie (https://forums.alliedmods.net/showthread.php?t=172167)

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(entEV_SZ_classname"npc_zombie"); 
   
    
entity_set_origin(entorigin);  
    
entity_set_vector(entEV_VEC_anglesangle);
 
    
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(entEV_FL_takedamage1.0); 
    
entity_set_float(entEV_FL_health250.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(entEV_INT_movetypeMOVETYPE_PUSHSTEP); 
    
entity_set_int(entEV_INT_solidSOLID_BBOX); 
        
    
Util_PlayAnimation(ent2)
         
    
//Set our NPC bounding size box respect to the models origin 
    
new Floatmins[3] = {-24.0, -24.00.0 
    new 
Floatmaxs[3] = { 24.024.075.0 
    
entity_set_size(entminsmaxs); 
     
    
//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(entEV_INT_modelindexmdl_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(entEV_FL_nextthinkget_gametime() + 0.01)



tuty 11-16-2011 16:08

Re: create_zombie
 
i dont know exactly your code bu try this

PHP Code:

public create_zombie(Float:origin[3],Float:angle[3]) 

    
origin[2] += 20.0;
    
    new 
ent create_entity("info_target");  
    
entity_set_string(entEV_SZ_classname"npc_zombie");  
    
    
entity_set_origin(entorigin);   
    
entity_set_vector(entEV_VEC_anglesangle); 
  
    
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(entEV_FL_takedamage1.0);  
    
entity_set_float(entEV_FL_health250.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(entEV_INT_movetypeMOVETYPE_PUSHSTEP);  
    
entity_set_int(entEV_INT_solidSOLID_BBOX);  
         
    
Util_PlayAnimation(ent2
          
    
//Set our NPC bounding size box respect to the models origin  
    
new Floatmins[3] = {-24.0, -24.00.0 }  
    new 
Floatmaxs[3] = { 24.024.075.0 }  
    
entity_set_size(entminsmaxs);  
      
    
//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(entEV_INT_modelindexmdl_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(entEV_FL_nextthinkget_gametime() + 0.01



The Inhabitant Of Heavens 11-16-2011 16:30

Re: create_zombie
 
doesnt work

tuty 11-16-2011 17:08

Re: create_zombie
 
try changing the number on this

origin[2] += 20.0;


is the distance upward from ground, maybe need a bigger value, try 50, 70..

The Inhabitant Of Heavens 11-16-2011 17:20

Re: create_zombie
 
doesnt work (

I will show you the code in the PM, ok ?

The Inhabitant Of Heavens 11-16-2011 19:58

Re: create_zombie
 
Fix

origin[1] += 50.0
origin[2] += 50.0


All times are GMT -4. The time now is 08:26.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.