Raised This Month: $ Target: $400
 0% 

NPC spawns in ground


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
GinNNy
Senior Member
Join Date: Mar 2014
Old 05-21-2014 , 08:19   NPC spawns in ground
Reply With Quote #1

Hi,
I have made a npc plugin but the problem is the npc stuck on the ground but before i add the animation code server reads a origins config and respawning them in the places written in the configfile but they dont move after i add the animation code all the npcs stuck on one place and attacking.
PHP Code:
Load_Npc()

    
//Get the correct filepath and mapname 
    
new szConfigDir[256], szFile[256], szNpcDir[256];
    
    
get_configsdir(szConfigDircharsmax(szConfigDir));
    
    new 
szMapName[32];
    
get_mapname(szMapNamecharsmax(szMapName));
    
    
formatex(szNpcDircharsmax(szFile),  "%s/zombie_nightmare"szConfigDir);
    
formatex(szFilecharsmax(szFile),  "%s/%s.cfg"szNpcDirszMapName);
    
    
//If the map config file does not exist we will make one
    
if (!file_exists(szFile))
    {
        
//return PLUGIN_HANDLED_MAIN;
        //write_file(szFile, "");
    
}
    
    
//Variables to store when reading our file
    
new szFileOrigin[3][32];
    new 
sOrigin[128], sAngle[128], Float:fOrigin[3], Float:fAngles[3];
    new 
iLineiLengthsBuffer[256];
    
    
//When we are reading our file...
    
while (read_file(szFileiLine++, sBuffercharsmax(sBuffer), iLength))
    {
        
//Move to next line if the line is commented
        
if((sBuffer[0]== ';') || !iLength)
            continue;
        
        
//Split our line so we have origin and angle. The split is the vertical bar character
        
strtok(sBuffersOrigincharsmax(sOrigin), sAnglecharsmax(sAngle), '|'0);
        
        
//Store the X, Y and Z axis to our variables made earlier
        
parse(sOriginszFileOrigin[0], charsmax(szFileOrigin[]), szFileOrigin[1], charsmax(szFileOrigin[]), szFileOrigin[2], charsmax(szFileOrigin[]));
        
        
fOrigin[0] = str_to_float(szFileOrigin[0]);
        
fOrigin[1] = str_to_float(szFileOrigin[1]);
        
fOrigin[2] = str_to_float(szFileOrigin[2]);
        
        
//Store the yawn angle
        
fAngles[1] = str_to_float(sAngle[1]);
        
//Keep reading the file until the end
        
create_zombie()
    }
    return 
PLUGIN_CONTINUE;
}

public 
create_zombie()
{    
    new 
ent create_entity("info_target")
    
ent2 ent
    
    entity_set_origin
(entg_spawn_point)
    
    
entity_set_float(entEV_FL_takedamage,1.0)
    
entity_set_float(entEV_FL_health100.0)
    
    
entity_set_string(entEV_SZ_classnameZB_CLASSNAME)
    
entity_set_model(entzombie_model)
    
entity_set_int(entEV_INT_solid2)
    
    
entity_set_int(entEV_INT_movetypeMOVETYPE_STEP)
    
    
set_pev(entpev_victim0)
    
    
entity_set_byte(entEV_BYTE_controller1125)
    
entity_set_byte(entEV_BYTE_controller2125)
    
entity_set_byte(entEV_BYTE_controller3125)
    
entity_set_byte(entEV_BYTE_controller4125)
    
    new 
Float:maxs[3] = {16.016.036.0}
    new 
Float:mins[3] = {-16.0, -16.0, -36.0}
    
entity_set_size(entminsmaxs)
    
    
play_anim(entANIM_IDLE1.0)
    
    
entity_set_float(ent,EV_FL_nextthinkhalflife_time() + 0.01)
    
drop_to_floor(ent)
    
    
RegisterHamFromEntity(Ham_TakeDamageent"fw_zb_takedmg")
    
RegisterHamFromEntity(Ham_Killedent"fw_zb_killed")
    
    return 
1
}


GinNNy is offline
DavidJr
Senior Member
Join Date: Apr 2012
Old 05-21-2014 , 09:04   Re: NPC spawns in ground
Reply With Quote #2

In Load_NPC()

PHP Code:
create_zombie() 


PHP Code:
create_zombie(fOrigin
then

PHP Code:
public create_zombie() 


PHP Code:
public create_zombie(flOrigin[3]) 
and a bit finishing

PHP Code:
entity_set_origin(entg_spawn_point


PHP Code:
entity_set_vector(entEV_VEC_originflOrigin); 
__________________
What are you looking for here?
DavidJr is offline
GinNNy
Senior Member
Join Date: Mar 2014
Old 05-21-2014 , 20:37   Re: NPC spawns in ground
Reply With Quote #3

worked but check this problem
Attached Thumbnails
Click image for larger version

Name:	2014-05-22_00002.jpg
Views:	153
Size:	55.8 KB
ID:	133716  
GinNNy is offline
DavidJr
Senior Member
Join Date: Apr 2012
Old 05-21-2014 , 21:32   Re: NPC spawns in ground
Reply With Quote #4

I don't see any problem there, what's wrong?
__________________
What are you looking for here?
DavidJr is offline
GinNNy
Senior Member
Join Date: Mar 2014
Old 05-22-2014 , 03:00   Re: NPC spawns in ground
Reply With Quote #5

they dont move lol they teleporting
GinNNy is offline
DavidJr
Senior Member
Join Date: Apr 2012
Old 05-22-2014 , 03:25   Re: NPC spawns in ground
Reply With Quote #6

PHP Code:
entity_set_int(entEV_INT_movetypeMOVETYPE_STEP


PHP Code:
entity_set_int(entEV_INT_movetypeMOVETYPE_PUSHSTEP
__________________
What are you looking for here?
DavidJr is offline
Reply


Thread Tools
Display Modes

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 09:44.


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