NPC not causing damage and low health Created 3 years ago2021-03-15 21:13:00 UTC by Kriegmorder Kriegmorder

Created 3 years ago2021-03-15 21:13:00 UTC by Kriegmorder Kriegmorder

Posted 3 years ago2021-03-15 21:13:00 UTC Post #345431
Hello all. Having an odd issue and I'm super new to coding.

I'm working a mod for HL and decided I want to pull a few NPC's from Opposing Force. I've successfully incorporated them into a custom FGD file so they show in JackHammer as entities. To test if things worked I made a quick map with a regular zombie, soldier zombie, guard zombie and Otis.

I recoded Otis to use the "Python" as the Deagle isn't in HL, and had to pull some code from Barney to fix an error about some "Facing" thing not being defined.

Run the map and here are the results:

1) The soldier and guard zombies die with one shot anywhere with the 9mm pistol.
2) The soldier and guard zombies will attack (animation and sound OK), but not cause any damage to me.
3) Otis will not engage the soldier or guard zombie and will die just as quick with a 9mm pistol shot.
4) Regular zombie still causes damage to me and takes several shots to put down.
5) Otis will engage the regular zombie but will die with one hit from it.

Working off of Valve's GitHub HL SDK and an OP4 SDK pulled from a different GitHub account. Coding program I'm using is VisualStudio 2019. Not sure if there's a message limit but I can post the code if need be.

Thanks in advance
Kriegmorder KriegmorderDon't cite the deep magic, I was here when it was written
Posted 3 years ago2021-03-16 01:43:20 UTC Post #345432
I'm no coder, but I do know that the lack of damage output and dying in a single hit suggests that your new entities do not have the appropriate entries in the skills.cfg file for their health and attack damage.

You will likely find that Otis and the guard zombie will also die if you try to get them to carry out a scripted_sequence.
monster_urby monster_urbyGoldsourcerer
Posted 3 years ago2021-03-16 09:28:58 UTC Post #345438
You probably didn't add the skill cvars and code to sync the cvars to the variables in gSkillData.
Posted 3 years ago2021-03-16 22:55:55 UTC Post #345443
do not have the appropriate entries in the skills.cfg file for their health and attack damage
Thanks, made a skills file that was missing. Took the stock HL one and added the couple lines from the OP4 one.
add the skill cvars and code to sync the cvars to the variables in gSkillData
This is where I think most of my problems are stemming from. A lot of this wasn't in the respective files. Getting closer I think - but still not working. I'll focus on one ripped NPC and copy any fixes over to the others. Here's what I've added tonight, not sure what I'm still missing:

skill.h (Had this prior)
float zombieBarneyHealth;
float zombieBarneyDmgOneSlash;
float zombieBarneyDmgBothSlash;

game.cpp:
// Zombie Barney
cvar_t sk_zombie_barney_health1 = { "sk_zombie_barney_health1","0" };
cvar_t sk_zombie_barney_health2 = { "sk_zombie_barney_health2","0" };
cvar_t sk_zombie_barney_health3 = { "sk_zombie_barney_health3","0" };

cvar_t sk_zombie_barney_dmg_one_slash1 = { "sk_zombie_barney_dmg_one_slash1","0" };
cvar_t sk_zombie_barney_dmg_one_slash2 = { "sk_zombie_barney_dmg_one_slash2","0" };
cvar_t sk_zombie_barney_dmg_one_slash3 = { "sk_zombie_barney_dmg_one_slash3","0" };

cvar_t sk_zombie_barney_dmg_both_slash1 = { "sk_zombie_barney_dmg_both_slash1","0" };
cvar_t sk_zombie_barney_dmg_both_slash2 = { "sk_zombie_barney_dmg_both_slash2","0" };
cvar_t sk_zombie_barney_dmg_both_slash3 = { "sk_zombie_barney_dmg_both_slash3","0" };

gamerules.cpp:
// ZombieBarney
gSkillData.zombieBarneyHealth = GetSkillCvar("sk_zombie_barney_health");
gSkillData.zombieBarneyDmgOneSlash = GetSkillCvar("sk_zombie_barney_dmg_one_slash");
gSkillData.zombieBarneyDmgBothSlash = GetSkillCvar("sk_zombie_barney_dmg_both_slash");

And then the external skills.cfg file:
// ZombieBarney
sk_zombie_barney_health1 "50"
sk_zombie_barney_health2 "50"
sk_zombie_barney_health3 "100"

sk_zombie_barney_dmg_one_slash1 "10"
sk_zombie_barney_dmg_one_slash2 "20"
sk_zombie_barney_dmg_one_slash3 "20"

sk_zombie_barney_dmg_both_slash1 "25"
sk_zombie_barney_dmg_both_slash2 "40"
sk_zombie_barney_dmg_both_slash3 "40"
Kriegmorder KriegmorderDon't cite the deep magic, I was here when it was written
Posted 3 years ago2021-03-17 20:50:13 UTC Post #345447
BOOM! Got it!!!!!!

I originally didn't go all the way down the game.cpp file. Started poking around the OP4 SDK and found the issue. Added the following to the tail end in the "register" section and now it works!!!!

Thank you UrbaNebula and Solokiller!!

// Zombie Barney
CVAR_REGISTER(&sk_zombie_barney_health1);// {"sk_zombie_barney_health1","0"};
CVAR_REGISTER(&sk_zombie_barney_health2);// {"sk_zombie_barney_health3","0"};
CVAR_REGISTER(&sk_zombie_barney_health3);// {"sk_zombie_barney_health3","0"};

CVAR_REGISTER(&sk_zombie_barney_dmg_one_slash1);// {"sk_zombie_barney_dmg_one_slash1","0"};
CVAR_REGISTER(&sk_zombie_barney_dmg_one_slash2);// {"sk_zombie_barney_dmg_one_slash2","0"};
CVAR_REGISTER(&sk_zombie_barney_dmg_one_slash3);// {"sk_zombie_barney_dmg_one_slash3","0"};

CVAR_REGISTER(&sk_zombie_barney_dmg_both_slash1);// {"sk_zombie_barney_dmg_both_slash1","0"};
CVAR_REGISTER(&sk_zombie_barney_dmg_both_slash2);// {"sk_zombie_barney_dmg_both_slash2","0"};
CVAR_REGISTER(&sk_zombie_barney_dmg_both_slash3);// {"sk_zombie_barney_dmg_both_slash3","0"};
Kriegmorder KriegmorderDon't cite the deep magic, I was here when it was written
You must be logged in to post a response.