Jump to content
SandyBeaches

Detailed information about melee weapons and how combat is calculated

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!

 

 

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...