Tutorial: Separate Player and Monster Hivehand damages Last edited 6 months ago2020-04-19 15:01:58 UTC

Why?

Well, this could be used to give the Hivehand a bit more "punch" on both ends easily.

Simply changing a number in your skill.cfg would be enough. No need to edit the code and build again and again.

This can be done because Valve hardcoded in the value of the player's hivehand damage, as they tried balancing it late in the development.

The Code

gamerules.cpp

Around line 276, you should find this something similar to this.
// PLAYER HORNET
// Up to this point, player hornet damage and monster hornet damage were both using
// monDmgHornet to determine how much damage to do. In tuning the hivehand, we now need
// to separate player damage and monster hivehand damage. Since it's so late in the project, we've
// added plrDmgHornet to the SKILLDATA struct, but not to the engine CVar list, so it's inaccesible
// via SKILLS.CFG. Any player hivehand tuning must take place in the code. (sjb)
gSkillData.plrDmgHornet = 7;
This means the player's hornet deals 7 points of damage.

NOTE: This tutorial uses "sk_plr_hornet" to represent player hornet damage in the code from now on.

Change the 7 to GetSkillCvar( "sk_plr_hornet" ). It should now look like this.
gSkillData.plrDmgHornet = GetSkillCvar("sk_plr_hornet");
What this does is, it tells the game to retrieve the value of a command called sk_plr_hornet.
It will have to be defined, however.

For that,the next file to edit is:

game.cpp

Around line 855, you'll find this:
// Tripmine
CVAR_REGISTER ( &sk_plr_tripmine1 );// {"sk_plr_tripmine1","0"};
CVAR_REGISTER ( &sk_plr_tripmine2 );// {"sk_plr_tripmine2","0"};
CVAR_REGISTER ( &sk_plr_tripmine3 );// {"sk_plr_tripmine3","0"};

// WORLD WEAPONS
CVAR_REGISTER ( &sk_12mm_bullet1 );// {"sk_12mm_bullet1","0"};
CVAR_REGISTER ( &sk_12mm_bullet2 );// {"sk_12mm_bullet2","0"};
CVAR_REGISTER ( &sk_12mm_bullet3 );// {"sk_12mm_bullet3","0"};
Some console variables (cvars) need to be added for this mod.
// Tripmine
CVAR_REGISTER ( &sk_plr_tripmine1 );// {"sk_plr_tripmine1","0"};
CVAR_REGISTER ( &sk_plr_tripmine2 );// {"sk_plr_tripmine2","0"};
CVAR_REGISTER ( &sk_plr_tripmine3 );// {"sk_plr_tripmine3","0"};

// HORNET PLAYER
CVAR_REGISTER( &sk_plr_hornet1 );// {"sk_plr_hornet1","0"};
CVAR_REGISTER( &sk_plr_hornet2 );// {"sk_plr_hornet2","0"}; // here are the three additions.
CVAR_REGISTER( &sk_plr_hornet3 );// {"sk_plr_hornet3","0"};

// WORLD WEAPONS
CVAR_REGISTER ( &sk_12mm_bullet1 );// {"sk_12mm_bullet1","0"};
CVAR_REGISTER ( &sk_12mm_bullet2 );// {"sk_12mm_bullet2","0"};
CVAR_REGISTER ( &sk_12mm_bullet3 );// {"sk_12mm_bullet3","0"};
Lastly, in the same file around line 370
// Tripmine
cvar_t sk_plr_tripmine1 = {"sk_plr_tripmine1","0"};
cvar_t sk_plr_tripmine2 = {"sk_plr_tripmine2","0"};
cvar_t sk_plr_tripmine3 = {"sk_plr_tripmine3","0"};
Similar steps to above should be done here,namely adding 3 cvars which correspond with the various difficulties.
// Player Hornet
cvar_t sk_plr_hornet1 = { "sk_plr_hornet1","0" };
cvar_t sk_plr_hornet2 = { "sk_plr_hornet2","0" };
cvar_t sk_plr_hornet3 = { "sk_plr_hornet3","0" };
0 is used here because as it would be logical to want the hornet to deal no damage if there are no entries for it in the skill.cfg file.
This is effectively a default value.

Now compile.

Make sure the compiled binaries are in your mod's folder.

Finally, before you play

Add these lines to your mod's skill.cfg
// Player Hornet
sk_plr_hornet1 "7"
sk_plr_hornet2 "7"
sk_plr_hornet3 "7"
Now, 7 was the hardcoded value, but this one can be anything you want. Just, if you're making a mod others will play, make it balanced. Or not.

Have some fun.

Comments

You must log in to post a comment. You can login or register a new account.