Need help with NPC shooting RPG, Crossbow, Gauss and Egon bullets Created 3 years ago2020-07-03 19:57:57 UTC by Alexis_of_Steel Alexis_of_Steel

Created 3 years ago2020-07-03 19:57:57 UTC by Alexis_of_Steel Alexis_of_Steel

Posted 3 years ago2020-07-03 19:57:57 UTC Post #344503
Hello everyone! I'm making a NPC that can shoot the following weapons: Glock, Python (357. Magnum), Shotgun, MP5, Crossbow, RPG, Gauss and Egon!
Hard work I've chosen. I wrote up the code for Glock, Python, Shotgun and MP5. They basically are a slightly modified copy of a hgrunt.cpp's bunch of code. I'll show up as an example my Python's method:

//=========================================================
// PythonShoot
//=========================================================
void CMyNewNPC :: PythonShoot ( void )
{
Vector vecShootOrigin = GetGunPosition();
Vector vecShootDir = ShootAtEnemy( vecShootOrigin );

UTIL_MakeVectors ( pev->angles );

Vector vecShellVelocity = gpGlobals->v_right * RANDOM_FLOAT(40,90) + gpGlobals->v_up * RANDOM_FLOAT(75,200) + gpGlobals->v_forward * RANDOM_FLOAT(-40, 40);
EjectBrass ( vecShootOrigin - vecShootDir * -24, vecShellVelocity, pev->angles.y, m_iBrassShell, TE_BOUNCE_SHELL);
FireBullets(1, vecShootOrigin, vecShootDir, VECTOR_CONE_10DEGREES, 2048, BULLET_PLAYER_357 );

pev->effects |= EF_MUZZLEFLASH;

m_cAmmoLoaded--;

Vector angDir = UTIL_VecToAngles( vecShootDir );
SetBlending( 0, angDir.x );
}

I wonder if you have the bunch of code for RPG, Crossbow, Gauss and Egon shoots! Due to I couldn't find them out through the Half-Life SDK yet. Or at least if you know where I can find them, please tell me! I suspect they are a little bit more complicated than the others I made! (I think they use different sprites, more sounds and models, beams...).

Thanks in advance,
Alexis.
Posted 3 years ago2020-07-07 06:47:48 UTC Post #344512
For the RPG, inspire yourself from the player weapon or the func_tankrocket entity (HGrunt uses them during the "On A Rail" chapter).

For the crossbow, inspire yourself from the player crossbow weapon (or the bullsquid spit attack).

The Gauss and Egon will require some extra work since some effects are done on the client side. I guess you will have to "copy and translate" all the effects from the client to the server.
Posted 3 years ago2020-07-07 12:10:17 UTC Post #344514
Thanks Shepard! :cool:
You must be logged in to post a response.