How is melee weapon attack speed calculated?

I’m just getting into modding CDDA, and I’ve been messing around with a few things, including melee weapons. I’m a bit confused as to how exactly the attack speed is calculated, though, because it’s not a stat included in the weapon description and I can’t figure out what determines the length of an attack. I also couldn’t find anything in the documentation that comes with the game or on the forum.

I don’t know any formula or anything. But for modding, you can manipulate how long the attack takes by changing the weight of the weapon. It’s the only thing I’m aware of in a weapon entry that affects how long the attack takes.

That’s wierd. I thought I tried that and it didn’t do anything. I’ll try it again, thought, thanks.

It is a small change. To make sure I wasn’t lying to you, I tested my broken spear weapon (weight 650) and it has a moves per attack of 91. Then I changed it to weight 6500, ten times more and it had a moves per attack of 189. So, about double for 10 times the weight.

It’s not super noticeable when you make small changes.

I guess I messed up something when I tried it earlier, because volume seems to have an even bigger impact.

Oh, you’re right. I didn’t know volume affected it.

Apparently, unless it was fixed, you can make a weapon bug out with too high of volume and weight values. (I think it was that)
You’ll attack really slowly, but at least you’ll move ten times the normal speed.
So, just be careful when modding, as things can sometimes get really janky and confusing.

I wish it was its own stat so that I could make a tiny dagger weigh the same amount as the corpse if a hulk and also make its attack speed 1.
But changing that in the programming would not be worth it by far.

Ask and you shall receive. Kind of. I couldn’t get it completely, since there is still the chance of missing which would cause you to stumble for an obscene amount of time due to the knife having the approximate weight of a hulk, and the feint only gives limited protection from that. I don’t know how to do c++, but at some point I want to change the game’s way of processing json so that some feints can reduce time even further than the normal feint technique. But for the time being, I just made the altered butter knife insanely accurate. I modified an existing item because I feel like adding a completely new item would be too much work.

First, go to cdda/data/json/techniques and paste:

{
“type” : “technique”,
“id” : “SPEEDHACK”,
“name” : “Weapon Speed Hack Job”,
“min_unarmed” : 0,
“unarmed_allowed” : true,
“melee_allowed” : true,
“mult_bonuses” : [
[“movecost”, 0.003],
[“damage”, “bash”, 0.66],
[“damage”, “cut”, 0.66],
[“damage”, “stab”, 0.66]
],
“messages” : [
“You strike %s with ludicrous speed”,
“ strikes %s with ludicrous speed”
],
“description” : “.3% moves, 66% damage”
},{
“type” : “technique”,
“id” : “SPEEDHACKCRIT”,
“name” : “Sanic’s left arm”,
“min_unarmed” : 0,
“unarmed_allowed” : true,
“melee_allowed” : true,
“crit_tec” : true,
“weighting” : 10,
“mult_bonuses” : [
[“movecost”, 0],
[“damage”, “bash”, 99],
[“damage”, “cut”, 99],
[“damage”, “stab”, 99]
],
“messages” : [
“You somehow make %s instantly explode”,
“<npcname> somehow makes %s instantly explode”
],
“description” : “0% moves, 99x damage”
},

at the beginning of the json file.

Next, go to cdda/data/json/items/melee, search for “butter knife”, and copy-paste over (in other words, replace) its entire json object with:

{
“type”: “GENERIC”,
“id”: “knife_butter”,
“symbol”: “;”,
“color”: “light_gray”,
“name”: “butter knife”,
“name_plural”: “butter knives”,
“description”: “Something is very wrong with this knife.”,
“price”: 150,
“material”: “steel”,
“weight”: 190000,
“volume”: 1,
“bashing”: 10,
“cutting”: 10,
“flags”: [ “STAB”, “SHEATH_KNIFE” ],
“to_hit”: 99,
“techniques”: [ “WBLOCK_1”, “SPEEDHACK”, “SPEEDHACKCRIT”, “tec_feint” ]
}

Now make sure you copy the original version and put it somewhere safe so that butter knives aren’t left ridiculously broken when you want to play normally. If you accidentally exited the json file after saving, here is the original:

{
“type”: “GENERIC”,
“id”: “knife_butter”,
“symbol”: “;”,
“color”: “light_gray”,
“name”: “butter knife”,
“name_plural”: “butter knives”,
“description”: “A dull knife, absolutely worthless in combat.”,
“price”: 150,
“material”: “steel”,
“weight”: 66,
“volume”: 1,
“bashing”: 2,
“cutting”: 1,
“flags”: [ “STAB”, “SHEATH_KNIFE” ],
“to_hit”: -2
}

Next, give yourself a butter knife, pray that your back doesn’t go to the nether dimensions, and hack away at the zombie horde.

Also, I just found out that if you don’t have a debug-level strength stat, your stamina pretty much dies with a single swing of the knife since it’s so heavy.

1 Like