Hi All
I have a little problem, with creating a NPC, that can walk.
I made my NPC over the tutorial
Twilight Suzuka (
http://forums.alliedmods.net/showthread.php?t=11756) created, but I just didn't get what he meant about 'EngFunc_RunPlayerMove'.
I have used the some time searching the forum, but I couldn't really find some explanation. Maby it's just me that didn't read the tutorial right, I don't know
So my help request in short is, how do you use 'EngFUnc_RunPlayerMove', or how do you make a NPC walk.
(Please C&P the Example Code this into your thread, showing how I could make my NPC walk)
Example Code:
Code:
/* Zombie Attack! By Alexander Mathiasen. */
#include <amxmodx>
#include <engine>
#include <fakemeta>
#define PLUGIN "Zombie Attack!"
#define AUTHOR "Alexander Mathiasen"
#define VERSION "1.0"
public plugin_init()
{
register_plugin("Zombie Attack!", "1.0", "Alexander Mathiasen")
register_think("npc_zombie", "zombie_think");
//register_cvar("za_zombie_health", "100.0");
register_clcmd(".create", "zombie_spawn");
}
/**/
public plugin_precache()
{
/**/
precache_model("/models/zombie attack/zombie.mdl");
precache_model("/models/zombie attack/p_knife.mdl");
}
public zombie_spawn(id)
{
/* Creates a new Float 'origin'. */
new Float: origin[3];
/* Get Players Cordinates. */
entity_get_vector(id, EV_VEC_origin, origin);
/* Creates a new Variable 'eZombie' to store the entity to. */
new eZombie = create_entity("info_target");
/**/
zombie_knife(eZombie);
/* Moves Player. */
entity_set_origin(eZombie, origin);
origin[2] += 300.0;
entity_set_origin(id, origin);
/* Makes the Entity 'eZombie' able to take damage. */
entity_set_float(eZombie, EV_FL_takedamage, 1.0)
/* Sets the Health of the Zombie 'eZombie' to the Cvar 'za_zombie_health'. */
entity_set_float(eZombie, EV_FL_health, 250.0);
/* Sets the Classname of the Entity 'eZombie' to 'npc_zombie'. */
entity_set_string(eZombie, EV_SZ_classname, "npc_zombie");
/* Sets the Model of the Entity 'eZombie'. */
entity_set_model(eZombie, "/models/zombie attack/zombie.mdl");
/* Makes the Entity 'eZombie' solid. */
entity_set_int(eZombie, EV_INT_solid, 2);
entity_set_byte(eZombie,EV_BYTE_controller1, 125);
entity_set_byte(eZombie,EV_BYTE_controller2, 125);
entity_set_byte(eZombie,EV_BYTE_controller3, 125);
entity_set_byte(eZombie,EV_BYTE_controller4, 125);
/* Creates 2 Floats to store the size of the entity. */
new Float:maxs[3] = {16.0,16.0,36.0}
new Float:mins[3] = {-16.0,-16.0,-36.0}
/* Sets the Entity 'eZombie' minimum size to the Float 'mins',
* and the maximum size to the Float 'maxs'.. */
entity_set_size(eZombie, mins, maxs);
/* ... */
entity_set_float(eZombie, EV_FL_animtime, 2.0);
/* ... */
entity_set_float(eZombie, EV_FL_framerate, 1.0);
/* ... */
entity_set_int(eZombie, EV_INT_sequence, 0);
/* Makes the zombie think every 1/100 second.
* (Calls this block of code again, like 'this.Invalidate()' in C#. */
entity_set_float(eZombie, EV_FL_nextthink, halflife_time() + 0.01);
return 1;
}
public zombie_think(id)
{
/* Makes the zombie think every 1/100 second.
* (Calls this block of code again, like 'this.Invalidate()' in C#. */
entity_set_float(id, EV_FL_nextthink, halflife_time() + 0.75);
}
public zombie_knife(ent)
{
/* Creates a new Variable 'eWeapon' that holds on the Entity 'eWeapon'. */
new eWeapon = create_entity("info_target");
/* Gives the Entity 'eWeapon' a name 'npc_knife'. */
entity_set_string(eWeapon, EV_SZ_classname, "npc_knife");
/* Tells the Entity to follow a other Entity. */
entity_set_int(eWeapon, EV_INT_movetype, MOVETYPE_FOLLOW);
/* Makes the Entity Non Solid, meaning that you can go through.*/
entity_set_int(eWeapon, EV_INT_solid, SOLID_NOT);
/* This is the Entity the Entity 'eWeapon' should follow. */
entity_set_edict(eWeapon, EV_ENT_aiment, ent);
/* Gives the Entity a Model. */
entity_set_model(eWeapon, "/models/zombie attack/p_knife.mdl");
}
Sorry for all wrong or none comented code, would like to hear everything i understanded wrong there to
Thanks in advance, Alexander M
__________________