Jump to content

Adding a headshot modifier to a weapon


Baesics

Recommended Posts

Hello everyone, i was doing some testing today to figure out how to make headshots do more damage and body shots do less than headshots (the game naturally has headshot damage do more damage but i wanted to see if i can increase it)

 

 

 

So this is what i have found:

 

 

Here is the full code (i added it to the wooden bow which can be found in items.xml)

 

<property name="Group" value="Ammo/Weapons,Basics"/>

<effect_group name="Base Effects"> <!-- gunWoodenBow -->

<passive_effect name="DamageFalloffRange" operation="base_set" value="20"/>

<passive_effect name="MaxRange" operation="base_set" value="100"/>

<passive_effect name="MagazineSize" operation="base_set" value="1"/>

 

<passive_effect name="DamageModifier" operation="perc_add" value="2" tags="head"/>

 

<passive_effect name="EntityDamage" operation="perc_add" value="0"/>

<passive_effect name="BlockDamage" operation="perc_add" value="0"/>

 

 

 

everything in this code is default except what i added which is

 

<passive_effect name="DamageModifier" operation="perc_add" value="2" tags="head"/>

 

 

Now i am not sure how this is calculated or how much this will affect the headshot perk but with a value of 2, i had to shoot 2 arrows into a zombies head to kill him, and i put his health at 300, so you can calculate what value you want....

 

I made my server a bit harder, Zombies have increased health (just by a little bit) and i made some of them run (runners hit less damage but stun more) and others walk (hit harder, adds random bleed/infection/stun, i added zombie bosses that have high health that drops good loot to make it worth killing them...

 

 

so i wanted to up the damage to the wooden bow but only to headshots... with the codes above, i tested it and it worked exactly how i wanted.... i tested this on a fresh character so i am not sure how the headshot perk will affect it yet.

 

hope this helps anyone

 

Happy Modding!

Link to comment
Share on other sites

Damage calculation is ((EntityDamage +/- any base_adds/subtracts in descending order) * (1 + sum of all perc_add values)) * (1 + sum of DamageModifier perc_adds)

 

So first any EntityDamage perc_ modifiers are added together and multiply the number, then for headshots that new number is taken and multiplied by the head DamageModifier perc_adds. The new modifier you inserted is additive with the Headshot Perk perc_adds. So player base modifier in entityclasses.xml is 0.5, lvl 2 Headshot Perk adds another 0.5, you added 2. This works out to Damage + (Damage * 3) or more simply, Damage * (1 + 3).

 

If you just want to increase headshot damage for all weapons, search for the DamageModifier tags="head" in entityclasses.xml and change that.

Link to comment
Share on other sites

thanks Deceptive Pastry, you are right, and i was actually looking for headshot bonus for all weapons and because of you i see it now

 

if anyone else is wondering, if you look at the; <entity_class name="playerMale"> script, in it you will see

 

<passive_effect name="DamageModifier" operation="perc_set" value="1" />

<passive_effect name="DamageModifier" operation="perc_add" value="0.5" tags="head"/>

 

i hope this is the correct spot lol, it would make sense..

 

changing the value of .5 increases all headshot damage from the player ..

 

question, what does it mean by perc_set value = 1 .... is that the max set damage?

 

thank you,

Link to comment
Share on other sites

Happy to be proven wrong but i don't think you're right Baesics.

 

That modifier is what the player receives if hit in the head.

 

What you want is to modify what is being fired at the Zs. I've not got access at the moment to my gaming rig but if i get a chance tonight i'll post up my code for you. I modded all the guns and the arrows for increased damage and extra damage to the head. It needs more balancing but it's a good start for what you want to do.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...