AlliedModders

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

razermamba 05-21-2013 12:34

Zombie NPC
 
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);



.Dare Devil. 05-21-2013 13:26

Re: Zombie NPC
 
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.

razermamba 05-21-2013 13:44

Re: Zombie NPC
 
With precache still doesnt work.

.Dare Devil. 05-21-2013 14:41

Re: Zombie NPC
 
Quote:

Originally Posted by razermamba (Post 1955815)
With precache still doesnt work.

Quote:

Originally Posted by .Dare Devil. (Post 1955804)
2.
PHP Code:

public zombie_walk(ent)
{

    
zombie_walk(ent)


this is very bad, cpu will be stuck in this function.


razermamba 05-21-2013 14:52

Re: Zombie NPC
 
Still doesnt work :/

yemez1235 10-14-2017 02:48

Re: Zombie NPC
 
Quote:

Originally Posted by razermamba (Post 1955863)
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

DeMNiX 10-15-2017 08:52

Re: Zombie NPC
 
Quote:

public zombie_walk(ent)
{

zombie_walk(ent)
}
lol, you are kidding?

Natsheh 10-15-2017 10:33

Re: Zombie NPC
 
Can you explain more about ur npc


All times are GMT -4. The time now is 16:17.

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