Raised This Month: $ Target: $400
 0% 

create_zombie


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
The Inhabitant Of Heavens
Member
Join Date: Aug 2011
Old 11-16-2011 , 12:50   create_zombie
Reply With Quote #1

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)

The Inhabitant Of Heavens is offline
tuty
Veteran Member
Join Date: Jul 2008
Location: UK
Old 11-16-2011 , 16:08   Re: create_zombie
Reply With Quote #2

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

__________________

Last edited by tuty; 11-16-2011 at 16:08.
tuty is offline
Send a message via ICQ to tuty Send a message via AIM to tuty
The Inhabitant Of Heavens
Member
Join Date: Aug 2011
Old 11-16-2011 , 16:30   Re: create_zombie
Reply With Quote #3

doesnt work
The Inhabitant Of Heavens is offline
tuty
Veteran Member
Join Date: Jul 2008
Location: UK
Old 11-16-2011 , 17:08   Re: create_zombie
Reply With Quote #4

try changing the number on this

origin[2] += 20.0;


is the distance upward from ground, maybe need a bigger value, try 50, 70..
__________________
tuty is offline
Send a message via ICQ to tuty Send a message via AIM to tuty
The Inhabitant Of Heavens
Member
Join Date: Aug 2011
Old 11-16-2011 , 17:20   Re: create_zombie
Reply With Quote #5

doesnt work (

I will show you the code in the PM, ok ?
The Inhabitant Of Heavens is offline
The Inhabitant Of Heavens
Member
Join Date: Aug 2011
Old 11-16-2011 , 19:58   Re: create_zombie
Reply With Quote #6

Fix

origin[1] += 50.0
origin[2] += 50.0
The Inhabitant Of Heavens is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


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


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