Raised This Month: $ Target: $400
 0% 

Zombie NPC


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
razermamba
Member
Join Date: Aug 2010
Old 05-21-2013 , 12:34   Zombie NPC
Reply With Quote #1

Hi all, I want to make my own zombie NPC stuff. I have read about vectors, velocity, origings etc. and I made my own code but it doesn't work good. First I just want to make my zombie move during IDLE state. Thx for reply. Code shuts down server

PHP Code:
#include <amxmodx>
#include <fakemeta>
#include <cstrike>
#include <engine>

// new const DeathSounds[][] ={
//   "dragonus/death1.wav",
//   "dragonus/death2.wav",
//   "dragonus/death3.wav"
// };
// 
// new const PainSounds[][] ={
//   "dragonus/pain1.wav",
//   "dragonus/pain2.wav",
//   "dragonus/pain3.wav"
// };
// 
// new const AttackSounds[][] ={
//   "dragonus/attack1.wav",
//   "dragonus/attack2.wav",
//   "dragonus/attack3.wav"
// };

new const ZombieModel[] = "models/zombie.mdl";

public 
plugin_precache(){
//   new i;
//   for(i = 0; i < sizeof(DeathSounds); ++i)
//     precache_sound(DeathSounds[i]);
//   for(i = 0; i < sizeof(PainSounds); ++i)
//     precache_sound(PainSounds[i]);
//   for(i = 0; i < sizeof(AttackSounds); ++i)
//     precache_sound(AttackSounds[i]);
}

public 
plugin_init(){
  
register_plugin("Dragonus NPC""1.0""Dragonus");
  
register_think("zombie_npc""ZombieThink");
  
register_clcmd("say /spawn""spawn_zombie");
}

public 
ZombieThink(ent){
  
zombie_walk(ent);  
  
entity_set_float(entEV_FL_nextthinkget_gametime() + 0.01);
}  
  
public 
spawn_zombie(id){
  new 
entity create_entity("info_target");
  
entity_set_string(entityEV_SZ_classname"zombie_npc");
  
entity_set_model(entityZombieModel);
  
  new 
FloatVectors[3];
  
entity_get_vector(idEV_VEC_originVectors);
  
Vectors[2] += 80.0;
  
entity_set_origin(entityVectors);
  new 
FloatMins[3] = {16.016.036.0};
  new 
FloatMaxs[3] = {-16.0, -16.0, -36.0};
  
entity_set_size(entityMinsMaxs);
  
  
entity_set_float(entityEV_FL_maxspeed220.0);
  
  
entity_set_int(entityEV_INT_solid2);
  
entity_set_float(entityEV_FL_takedamage1.0);
  
entity_set_float(entityEV_FL_health250.0);
  
  
play_animation(entity1);
  
  
entity_set_float(entityEV_FL_nextthinkget_gametime() + 0.01);
  
  
drop_to_floor(entity);
}

stock play_animation(idsequence)
{
  
entity_set_float(idEV_FL_animtimeget_gametime());
  
entity_set_float(idEV_FL_framerate1.0);
  
entity_set_int(idEV_INT_sequencesequence);
}

public 
zombie_walk(ent)
{
  new 
FloatOrigins[3];
  new 
FloatVelocity[3];
  new 
FloatAngles[3];
  
pev(entpev_originOrigins);
  
pev(entpev_velocityVelocity);
  
play_animation(ent3);
  
Velocity[1] += 300.0;  
  
set_pev(entpev_velocityVelocity);
  
pev(entpev_anglesAngles);
  
Angles[1] += 180.0;
  
set_pev(entpev_anglesAngles);
  
pev(entpev_velocityVelocity);
  
Velocity[1] += 300.0;
  
set_pev(entpev_velocityVelocity);
  
zombie_walk(ent);

razermamba is offline
.Dare Devil.
Veteran Member
Join Date: Sep 2010
Old 05-21-2013 , 13:26   Re: Zombie NPC
Reply With Quote #2

1. ZombieModel[] is not precached
2.
PHP Code:
public zombie_walk(ent)
{

    
zombie_walk(ent)

this is very bad, cpu will be stuck in this function.
.Dare Devil. is offline
razermamba
Member
Join Date: Aug 2010
Old 05-21-2013 , 13:44   Re: Zombie NPC
Reply With Quote #3

With precache still doesnt work.
razermamba is offline
.Dare Devil.
Veteran Member
Join Date: Sep 2010
Old 05-21-2013 , 14:41   Re: Zombie NPC
Reply With Quote #4

Quote:
Originally Posted by razermamba View Post
With precache still doesnt work.
Quote:
Originally Posted by .Dare Devil. View Post
2.
PHP Code:
public zombie_walk(ent)
{

    
zombie_walk(ent)

this is very bad, cpu will be stuck in this function.
.Dare Devil. is offline
razermamba
Member
Join Date: Aug 2010
Old 05-21-2013 , 14:52   Re: Zombie NPC
Reply With Quote #5

Still doesnt work :/
razermamba is offline
yemez1235
New Member
Join Date: Oct 2017
Old 10-14-2017 , 02:48   Re: Zombie NPC
Reply With Quote #6

Quote:
Originally Posted by razermamba View Post
Still doesnt work :/
Code:
public plugin_precache(){
//   new i;
//   for(i = 0; i < sizeof(DeathSounds); ++i)
//     precache_sound(DeathSounds[i]);
//   for(i = 0; i < sizeof(PainSounds); ++i)
//     precache_sound(PainSounds[i]);
//   for(i = 0; i < sizeof(AttackSounds); ++i)
//     precache_sound(AttackSounds[i]);
precache_model(ZombieModel);  <--- add this
}
and after I get error is: Host_Error: backwards mins/maxs

Last edited by yemez1235; 10-14-2017 at 02:50.
yemez1235 is offline
DeMNiX
Veteran Member
Join Date: Nov 2011
Location: Russia
Old 10-15-2017 , 08:52   Re: Zombie NPC
Reply With Quote #7

Quote:
public zombie_walk(ent)
{

zombie_walk(ent)
}
lol, you are kidding?
__________________
My channel with test codes
https://www.youtube.com/user/demnix03

Zombie Riot [Scenario & bots-zombie 11.11.2023]
https://youtu.be/8ZZan-aq2sc
DeMNiX is offline
Natsheh
Veteran Member
Join Date: Sep 2012
Old 10-15-2017 , 10:33   Re: Zombie NPC
Reply With Quote #8

Can you explain more about ur npc
__________________
@Jailbreak Main Mod v2.7.0 100%
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !

Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
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 16:17.


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