My solution to the errors/bugs in the NPC Projectile Tutorial here Created 2 months ago2024-08-28 09:36:15 UTC by sleepye sleepye

Created 2 months ago2024-08-28 09:36:15 UTC by sleepye sleepye

Posted 2 months ago2024-08-28 09:36:15 UTC Post #349103
Hey yall i thought i might share my solution to all the errors/bugs with the NPC projectile tutorial here

https://twhl.info/wiki/page/Tutorial%3A_Coding_NPCs_in_GoldSrc

I posted my solution in the comments but i might as well give yall a heads up.
since everyone has been having trouble with this and i needed to learn projectiles, i decided to work on fixing the bugs in this tutorial.
The integers that represent the animation events were not the same as what was written in the .qc for the melee attacks and reload so you had to change it to this
#define PDRONE_FIRE_SPIKE ( 1 )
#define PDRONE_MELEE_LEFT ( 2 )
#define PDRONE_MELEE_RIGHT ( 4 )
#define PDRONE_MELEE_BOTH ( 6 )
#define PDRONE_RELOAD ( 7 )
the return NULL under GetScheduleOfType was causing crashes so i changed it to:
return CBaseMonster::GetScheduleOfType(Type);
i had to make a custom checkAmmo function and override checkRangeAttack1 and explicitly call them in getSchedule.

and thats about it. heres a video preview of the changes i made and the showcasing it working. I will share the gitHub Code below so you can reference it.
PROJECTILE NPC
GITHUB FILES:
https://github.com/TylerMaster/ICE1/blob/BRANDON_SMITH_Ex1/wip_monster.cpp
https://github.com/TylerMaster/ICE1/blob/BRANDON_SMITH_Ex1/wip_monster.h
Posted 2 months ago2024-08-28 14:36:09 UTC Post #349105
I remember being 14 and trying to figure out this specific thing, almost a decade ago. I remember I did some stupid nonsense thing to get it to compile, and then it crashed whenever the monster looked at me. I've come a long way since and, even though this would be super easy for me now, it gives me a unique kind of satisfaction, justice almost, to see someone publish a solution. Thank you.

I sure wonder why they returned null in GetScheduleOfType, probably an SDK difference of some sort? In either case you can also edit the tutorial itself.
Admer456 Admer456If it ain't broken, don't fox it!
Posted 2 months ago2024-08-28 16:13:43 UTC Post #349106
hah i noticed that in the forum comments. I actually learned a lot from your youtube videos so thank you for your efforts :P
You must be logged in to post a response.