Raised This Month: $ Target: $400
 0% 

Zombie NPC


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
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
 


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 16:17.


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