# Modding question

**URL:** https://discourse.cataclysmdda.org/t/modding-question/6640
**Category:** The Lab
**Created:** [June 28, 2014, 3:48am UTC](https://discourse.cataclysmdda.org/t/modding-question/6640 "2014-06-28T03:48:44Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![OrigamiZoo](https://avatars.discourse-cdn.com/v4/letter/o/ea666f/32.png) [@OrigamiZoo](https://discourse.cataclysmdda.org/u/OrigamiZoo)
#### Post date: [June 28, 2014, 3:48am UTC](https://discourse.cataclysmdda.org/t/modding-question/6640/1 "2014-06-28T03:48:44Z")

</div>

Been looking at modding some existing items but not sure the proper way to go about it. If I make a mod can I just ‘update’ the items in the mod, or do I have to blacklist the original item, and create a new one? Or is it something else?

So now on to some of the stuff I would like to do/address:  
Personally, I want to flesh out throwing more. Add more weapons and add special attacks to some to help expand and hopefully make it more attractive/viable.  
I would also like to make armor/clothing more varied. Currently most protection values are equal which would not be the case in reality. Simple clothing does nothing to protect against a bludgeoning attack.

I don’t know… thoughts/comments?

---

<div class="post-metadata">

### Author: ![kevin.granade](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.cataclysmdda.org/kevin.granade/32/1316_2.png) [@kevin.granade](https://discourse.cataclysmdda.org/u/kevin.granade)
#### Post date: [June 28, 2014, 3:57am UTC](https://discourse.cataclysmdda.org/t/modding-question/6640/2 "2014-06-28T03:57:55Z")

</div>

If you make a copy of the item with the same id but different stats in a mod, I believe it will overwrite the original.

---

<div class="post-metadata">

### Author: ![KA101](https://avatars.discourse-cdn.com/v4/letter/k/278dde/32.png) [@KA101](https://discourse.cataclysmdda.org/u/KA101)
#### Post date: [June 28, 2014, 3:59am UTC](https://discourse.cataclysmdda.org/t/modding-question/6640/3 "2014-06-28T03:59:29Z")

</div>

New items: just copy, paste, and edit as desired. If you’re replacing the existing item, advertise as much and then I’d just change the existing item. (Yeah, what Kevin said.) Messing around with stuff that’s in a save either kills compatibility or creates Nones.

Work on the clothing sounds interesting. Throwing has been tried and I think that hit problems re weight/damage calculations, but maybe you’ll have better luck.

---

<div class="post-metadata">

### Author: ![OrigamiZoo](https://avatars.discourse-cdn.com/v4/letter/o/ea666f/32.png) [@OrigamiZoo](https://discourse.cataclysmdda.org/u/OrigamiZoo)
#### Post date: [June 28, 2014, 6:19am UTC](https://discourse.cataclysmdda.org/t/modding-question/6640/4 "2014-06-28T06:19:06Z")

</div>

In regards to throwing: what I was thinking of was something, like a bola, that would entangle/trip opponents opening them up to further attacks, or allowing a retreat. Another idea was that the sling/slingshot could have a small chance to stun. BUT, I guess the first question should be: can ranged weapons have special effect/attacks?

Also, while doing research on clothing I came up with some questions, or things I would like to clarify:  
What decides that a weapon is piercing? the spear tag?  
What does environmental protection on something other than eyes and mouth do?  
How does armor affect the damage calculations? I’m looking at the source, but want to make sure I’ve got it right.

---

<div class="post-metadata">

### Author: ![kevin.granade](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.cataclysmdda.org/kevin.granade/32/1316_2.png) [@kevin.granade](https://discourse.cataclysmdda.org/u/kevin.granade)
#### Post date: [June 28, 2014, 8:53am UTC](https://discourse.cataclysmdda.org/t/modding-question/6640/5 "2014-06-28T08:53:06Z")

</div>

> [@OrigamiZoo](#):
>
> In regards to throwing: what I was thinking of was something, like a bola, that would entangle/trip opponents opening them up to further attacks, or allowing a retreat.

Neat, good idea. This has been brought up, but no one has implemented it.

> [@OrigamiZoo](#):
>
> Another idea was that the sling/slingshot could have a small chance to stun. BUT, I guess the first question should be: can ranged weapons have special effect/attacks?

They can, though I’m not sure why a slingshot in particular should have a stun chance.  
The two places to look are ammo\_effects() in damage.cpp and deal\_projectile\_attack() in creature.cpp. The first is more for explosion and AOE type stuff, the second is where most attack effects happen. There’s already a stun effect from the beanbag rounds, though with a bola you might want an entangle thing.

[quote=“OrigamiZoo, post:4, topic:6640”]Also, while doing research on clothing I came up with some questions, or things I would like to clarify:  
What decides that a weapon is piercing? the spear tag?[/quote]  
Spear or pierce flag, they’re only very slightly different.

> [@OrigamiZoo](#):
>
> What does environmental protection on something other than eyes and mouth do?

Diseases have a chance to infect based on the environmental protection of the body part they target. Different diseases target different body parts. Fungal spores for example target every body part, so you need total coverage to be safe from them, others only target eyes or mouth.

> [@OrigamiZoo](#):
>
> How does armor affect the damage calculations? I’m looking at the source, but want to make sure I’ve got it right.

Armor simply has a damage negation value, incoming attacks are applied to the armor starting from the outermost and working its way in, finally hitting the player if it has damage left. Along the way it has a chance to damage the armor.

---

<div class="post-metadata">

### Author: ![OrigamiZoo](https://avatars.discourse-cdn.com/v4/letter/o/ea666f/32.png) [@OrigamiZoo](https://discourse.cataclysmdda.org/u/OrigamiZoo)
#### Post date: [June 29, 2014, 5:54am UTC](https://discourse.cataclysmdda.org/t/modding-question/6640/6 "2014-06-29T05:54:56Z")

</div>

Ok, so just adding the items that I wanted to mod works fine… except for recipes. It is looking for a single item which, apparently, when you mod an item creates a duplicate of it. Just for reference both items have the same stats (looking at them through the debug menu).  
No problem, recipe is minor anyway.  
So I created my bola just to try see if I can get it to work like I hope. Looks like thrown weapons don’t trigger effects or techniques…  
I’ll take a look at the code later to see if I can maybe spot the issue. (I can mostly read the source, just really suck at writing it :))  
Anywho I’ll add what I have so if somebody sees something I missed… I’m using the large\_beanbag as a test effect. Future plan would be to write a function to add different effects depending on area hit (Head could choke or stun, legs entangle/trip, ect.)

EDIT: Almost forgot… looks like adding stab or spear to thrown doesn’t seem to help either

```auto
{
        "type" : "AMMO",
        "id" : "bola",
        "category" : "weapons",
        "price" : 10000,
        "name" : "bola",
        "name_plural" : "bolas",
        "symbol" : ";",
        "color" : "light_gray",
        "description" : "A throwing weapon made of weights on the ends of interconnected cords, designed to capture animals by entangling their legs. Causes minor damage.",
        "material" : "cotton",
        "volume" : 1,
        "weight" : 907,
        "bashing" : 4,
        "cutting" : 0,
        "to_hit" : 1,
        "ammo_type" : "thrown",
        "casing" : "NULL",
        "damage" : 0,
        "pierce" : 0,
        "range" : 0,
        "dispersion" : 0,
        "recoil" : 0,
        "count": 1,
        "effects" : ["LARGE_BEANBAG"]
    },
```

---

<div class="post-metadata">

### Author: ![i2amroy](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.cataclysmdda.org/i2amroy/32/909_2.png) [@i2amroy](https://discourse.cataclysmdda.org/u/i2amroy)
#### Post date: [June 30, 2014, 9:09pm UTC](https://discourse.cataclysmdda.org/t/modding-question/6640/7 "2014-06-30T21:09:43Z")

</div>

Pro tip: Putting code tags inside of spoilers breaks them both. Just put it in the code tags and it will automatically create a scrollable, fairly small box.

As for throwing IIRC it was just never updated when the rest of the ranged weapons were (so it’s still using old code) and nobody has gotten around to doing it yet. There have been a few tweaks since then, but it’s still basically the same code it’s always been.
