Hey im pretty new to modding with half life. I followed Source Modding channel on youtube to get the initial mod setup going as well as adding a custom static entity with collision boxs including a visualizer, etc. I have experience with c/c++, also just finished a 2 year "computer programming" program at Sheridan College Trafalgar Campus in Ontario Canada so im decently familiar with programming,
Anyways, since there is no more video tutorials there i came here to follow this NPC tutorial and im reading through the entity programming manual here as well.
The tutorial above didn't specify the method to place the npc in game so i just modified the .fgd file and added this so i can place the entity into my map through hammer editor.
@PointClass base(Monster) color(0 255 0) size(-20 -20 -20, 20 20 20) studio() = wip_MonsterPitDrone : "wip_MonsterPitDrone"
[
model(studio) : "Model"
]
I can share the code for my custom entity .cpp file at the bottom of this post so you can see what i have at the moment.
The issue im running into is the npc is not running or walking towards me as it should be according to the tutorial im following.
The npc does however do the "yaw" rotation to track my position when im in the set distance to trigger that, and if i go right up to it, it starts to attack me.
Im trying to troubleshoot why those actions are working but the chasing is not. Ive been trying to set up flags in the code as console alerts so i can check if its failing to create the route to execute the movement but im not sure how to write to the halflife/steam console, all the attempts ive tried didnt work.
Help would be greatly appreciated, thanks!
I can post a video here so you guys can see the npc's behavior.
#include "wip_monster.h"
class CPitDrone : public CBaseMonster
{
public:
void Spawn(void);
void Precache(void);
int iSpikes;
int Classify(void);
void SetYawSpeed(void);
};
LINK_ENTITY_TO_CLASS(wip_MonsterPitDrone, CPitDrone);
void CPitDrone::Spawn()
{
Precache();
SET_MODEL(ENT(pev), "models/pit_drone.mdl");
UTIL_SetSize(pev, VEC_HUMAN_HULL_MIN, VEC_HUMAN_HULL_MAX);
pev->solid = SOLID_SLIDEBOX;
pev->movetype = MOVETYPE_STEP;
m_bloodColor = BLOOD_COLOR_RED;
pev->health = 100; // Health -
pev->view_ofs = Vector(0, 0, 20);
m_flFieldOfView = 0.5;
m_MonsterState = MONSTERSTATE_NONE;
MonsterInit();
iSpikes = 6;
}
int CPitDrone::Classify(void)
{
return CLASS_ALIEN_MONSTER;
}
void CPitDrone::SetYawSpeed(void) {
pev->yaw_speed = 90;
}
void CPitDrone::Precache()
{
PRECACHE_MODEL("models/pit_drone_spike.mdl"); //Loads the model for the spike
PRECACHE_MODEL("models/pit_drone.mdl"); //Loads the NPC model in the game
// Bunch of pretty self-explanatory sounds
PRECACHE_SOUND("pitdrone/pit_drone_melee_attack1.wav");
PRECACHE_SOUND("pitdrone/pit_drone_melee_attack2.wav");
PRECACHE_SOUND("pitdrone/pit_drone_attack_spike1.wav");
PRECACHE_SOUND("pitdrone/pit_drone_eat.wav");
PRECACHE_SOUND("pitdrone/pit_drone_die1.wav");
PRECACHE_SOUND("pitdrone/pit_drone_die2.wav");
PRECACHE_SOUND("pitdrone/pit_drone_die3.wav");
PRECACHE_SOUND("pitdrone/pit_drone_hunt3.wav");
}