Jump to content

Detailed information about melee weapons and how combat is calculated


SandyBeaches

Recommended Posts

I made some posts in the Hydrocraft mod thread showing the java behind melee combat and some quick thoughts on it.

See here and here

 

I am going to use this thread to summarize my findings, so others can use them as a reference.

 

Firstly: Skill modifiers and weapon categories. What do they affect? By how much?

If the weapon has the category "Unarmed", no perk related.

The only calculation for unarmed is that it is capped at 0.7 damage per hit.

NOTE MODDERS: This means if you categorize a weapon in your scripts as unarmed, putting max damage higher than 0.7 does nothing.

 

These are not intuitive at all. Rather than either starting at 100% damage and increasing (bonus damage) or starting at a low point and reaching 100% at level 10 (competency), skills in project zomboid are a mixture of both.

If the weapon has the category of "Blade" or "Axe", use Blade Accuracy perk (java name=PerkFactory.Perks.Axe):

If the weapon has the category of "Blunt", use Blunt Accuracy perk (java name=PerkFactory.PerksBlunt):

Both Axe and Blunt perks affect damage the same way.

0:30%, 1:40%, 2:50%, 3:60%, 4:70%, 5:80%, 6:90, 7:100%, 8:110%, 9:120%, 10:130%

Or, to put it more compactly: Damage = TotalDamage*(0.3+PerkLevel*0.1)

 

If the weapon is "Ranged" (not category), Aiming level affects critchance, not damage.

The calculation is weapon.critchance + weapon.AimingPerkCritModifier * (AimingLevel/2)

So for calculating the maximum crit of you custom guns, add the amingcritmodifier only 5 times, not 10.

 

Lastly calculated,

If the weapon has the category of "Axe" and the target is NOT knocked over.

Double damage. Yup, axes do double damage to all standing targets.

 

ORDER OF CALCULATION

None of these calculations are exclusive! Furthermore, none of the melee checks actually restricts themselves to melee weapons. So, if you have a firearm (isRanged=TRUE) with the categories Unarmed,Axe,Blunt, and you attack a standing zombie, the following would happen.

  1. Get damage from weapon/wielder.
  2. If damage is more than 0.7, reduce to 0.7 (unarmed).
  3. damage *= 0.3+AxeLevel*0.1
  4. damage *= 0.3+BluntLevel*0.1
  5. critical chance = weapon.critchance + weapon.AimingPerkCritModifier * (AimingLevel/2)
  6. damage = damage*2 (Axe)

 

There may be checks earlier in the code to prevent such items from existing at startup, but I know you can make these with lua.

NOTE: I have yet to find any references to "improvised" in the code. I'll keep looking.

 

Next time, Strength, endurance, push back, knockdown, and YOU!

 

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...