# Modding questions

**URL:** <https://discourse.cataclysmdda.org/t/modding-questions/26613>\
**Category:** The Toolbox\
**Created:** [July 6, 2021, 12:03am UTC](https://discourse.cataclysmdda.org/t/modding-questions/26613 "2021-07-06T00:03:25Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jonathan\_Henness](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.cataclysmdda.org/jonathan_henness/32/7950_2.png) [@Jonathan\_Henness](https://discourse.cataclysmdda.org/u/Jonathan_Henness)\
**Post date:** [July 6, 2021, 12:03am UTC](https://discourse.cataclysmdda.org/t/modding-questions/26613/1 "2021-07-06T00:03:25Z")

</div>

Hey there. I am currently working on a chi system similar in vein to the mana system and i was wondering if it was possible to somehow get rid od the two item wear limit.

I have a ki barrier item that provides protection and i want the player to be able to strengthen said barrier to better protect themselves by putting more ki into it.

Right now i have it that it summons a weightless semitangible armor item that provides protection and the strengthening aspect is just summoning more of said item.

However you can only wear two at once so i was wondering if there was a way to bypass that limit so the barriers can be stacked continuously the more ki is used.

---

<div class="post-metadata">

**Author:** ![Valase](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.cataclysmdda.org/valase/32/6972_2.png) [@Valase](https://discourse.cataclysmdda.org/u/Valase)\
**Post date:** [July 6, 2021, 12:15am UTC](https://discourse.cataclysmdda.org/t/modding-questions/26613/2 "2021-07-06T00:15:55Z")

</div>

I think the limit of items that the character can wear is given and can’t be changed from JSON.

However, you probably can bypass it in different ways.  
One thing that comes to my mind would be to create multiple item defintions of the same type (copy-from) with different ids. That way you can wear up to two of each seperate id.

Depending on the way you want to implement it (as in; if you want to just summon one item id and not randomly for example), you could make it that [a]ctivating the items “transmutates” it into one of the other ids, and activating that item will transmutate it further and so on.

---

<div class="post-metadata">

**Author:** ![GiggleGrassGatherer](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.cataclysmdda.org/gigglegrassgatherer/32/7743_2.png) [@GiggleGrassGatherer](https://discourse.cataclysmdda.org/u/GiggleGrassGatherer)\
**Post date:** [July 6, 2021, 12:22am UTC](https://discourse.cataclysmdda.org/t/modding-questions/26613/3 "2021-07-06T00:22:55Z")

</div>

Maybe look into aura spells? They give different protection/stats based on casting level, and I doubt there are 20 versions of each aura in the files. No time to check now so can be wrong, though.

---

<div class="post-metadata">

**Author:** ![Jonathan\_Henness](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.cataclysmdda.org/jonathan_henness/32/7950_2.png) [@Jonathan\_Henness](https://discourse.cataclysmdda.org/u/Jonathan_Henness)\
**Post date:** [July 6, 2021, 12:35am UTC](https://discourse.cataclysmdda.org/t/modding-questions/26613/4 "2021-07-06T00:35:01Z")

</div>

From what i understand aura spells tend to summon an item that is semitangible that you wear and provides the effecta.

I suppose i could make it an effect instead of a item. I would just need to remember how to simply give armor to the full body as say a mutation would.

---

<div class="post-metadata">

**Author:** ![Jonathan\_Henness](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.cataclysmdda.org/jonathan_henness/32/7950_2.png) [@Jonathan\_Henness](https://discourse.cataclysmdda.org/u/Jonathan_Henness)\
**Post date:** [July 6, 2021, 12:57am UTC](https://discourse.cataclysmdda.org/t/modding-questions/26613/5 "2021-07-06T00:57:01Z")

</div>

Hmm…how would i go about doing multiple ids? Its not as clean as i was hoping to make the abillity but it may be what i have to do for its intended effect.

Like say i want it to just summon a random version of a specefied set of ids. How would i go about it?

---

<div class="post-metadata">

**Author:** ![Valase](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.cataclysmdda.org/valase/32/6972_2.png) [@Valase](https://discourse.cataclysmdda.org/u/Valase)\
**Post date:** [July 6, 2021, 1:15am UTC](https://discourse.cataclysmdda.org/t/modding-questions/26613/6 "2021-07-06T01:15:12Z")

</div>

> [@Jonathan\_Henness](#):
>
> how would i go about doing multiple ids?

Based on your first post I think it’s save to assume you already have a definition for your base barrier item.

Let’s say that barrier item looks like this:

```auto
"id": "barrier_armor",
"type": "ARMOR",
"name": { "str": "barrier shield" }

```

…and whatever else is part of the item definition.  
You can then add another item definition:

```auto
"id": "barrier_armor2",
"type": "ARMOR",
"name": { "str": "barrier shield" },
"copy-from": "barrier_armor"

```

…and then `barrier_armor3`, and so on.

To each item definition, starting with `barrier_armor`, you then add an `use_action`:

```auto
"use_action": {
    "type": "transform",
    "msg": "You shift the frequency of the barrier.",
    "target": "barrier_armor2",
    "menu_text": "Change barrier frequency"
}

```

`barrier_armor2` then gets an `use_action` that `target`s `barrier_armor3`, and, if you want to, you can wrap around in the end, so that `barrier_armorX`’s target is `barrier_armor` again.

---

<div class="post-metadata">

**Author:** ![Jonathan\_Henness](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.cataclysmdda.org/jonathan_henness/32/7950_2.png) [@Jonathan\_Henness](https://discourse.cataclysmdda.org/u/Jonathan_Henness)\
**Post date:** [July 6, 2021, 1:17am UTC](https://discourse.cataclysmdda.org/t/modding-questions/26613/7 "2021-07-06T01:17:40Z")

</div>

Thats pretty smart! Thank you very much ill give that a shot. Ive got a bunch of other ki abillities working auch as beams blasts, powering up, making afterimages.

This was the only one i was having some issue with. I sure hope this works!

---

<div class="post-metadata">

**Author:** ![Valase](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.cataclysmdda.org/valase/32/6972_2.png) [@Valase](https://discourse.cataclysmdda.org/u/Valase)\
**Post date:** [July 6, 2021, 1:39am UTC](https://discourse.cataclysmdda.org/t/modding-questions/26613/8 "2021-07-06T01:39:16Z")

</div>

> [@Jonathan\_Henness](#):
>
> Thank you very much ill give that a shot.

You’re welcome, always glad I can help and good luck!

> [@Jonathan\_Henness](#):
>
> Like say i want it to just summon a random version of a specefied set of ids. How would i go about it?

I just saw your edit.  
It highly depends on how you spawn them in. You might be able to pass an item group and let it pick one randomly from the list in that item group.

Also, I’m not sure what you exactly mean by “strengthening aspect is just summoning more of said item” in your first post.  
Do they use up a predefined value of ki and spawn one item at a time or do you spawn multiple of them based on ki available (like some bionics empty your power completely on use but provide a longer or stronger effect)?

If it’s the latter, it might be possible to spawn in an item group of the `"subtype": "collection"` and provide a max of two of each different id directly, scaled on the ki available (although you’d probably would have to add a collection for every range, like: 100 ki = 1 `barrier_armor`, 200 ki = 2 `barrier_armor`, 300 = 2 `barrier_armor` + 1 `barrier_armor2` etc)…

---

<div class="post-metadata">

**Author:** ![Jonathan\_Henness](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.cataclysmdda.org/jonathan_henness/32/7950_2.png) [@Jonathan\_Henness](https://discourse.cataclysmdda.org/u/Jonathan_Henness)\
**Post date:** [July 6, 2021, 3:43am UTC](https://discourse.cataclysmdda.org/t/modding-questions/26613/9 "2021-07-06T03:43:28Z")

</div>

I would like to confirm that the shifting frequencies idea worked, so when activated you can now shift the ki barriers frequency up one level (Currently capping at 5) Allowing someone to potentially have up to 12 ki barriers at once (Not that anyone would have the ki to do that but its there.) I would like to thank you very much for your help Valase.

---

<div class="post-metadata">

**Author:** ![Zhilkin](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.cataclysmdda.org/zhilkin/32/3749_2.png) [@Zhilkin](https://discourse.cataclysmdda.org/u/Zhilkin)\
**Post date:** [July 6, 2021, 6:52pm UTC](https://discourse.cataclysmdda.org/t/modding-questions/26613/10 "2021-07-06T18:52:25Z")

</div>

> <https://github.com/CleverRaven/Cataclysm-DDA/blob/6419e560ea9cdb945bdd570ba0f8f9b1af5f7023/src/game_constants.h#L30>

---

<div class="post-metadata">

**Author:** ![Jonathan\_Henness](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.cataclysmdda.org/jonathan_henness/32/7950_2.png) [@Jonathan\_Henness](https://discourse.cataclysmdda.org/u/Jonathan_Henness)\
**Post date:** [July 8, 2021, 1:56am UTC](https://discourse.cataclysmdda.org/t/modding-questions/26613/11 "2021-07-08T01:56:48Z")

</div>

Where if anywhere, would i find that in the game files?

---

<div class="post-metadata">

**Author:** ![Valase](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.cataclysmdda.org/valase/32/6972_2.png) [@Valase](https://discourse.cataclysmdda.org/u/Valase)\
**Post date:** [July 8, 2021, 2:11am UTC](https://discourse.cataclysmdda.org/t/modding-questions/26613/12 "2021-07-08T02:11:13Z")

</div>

Zhilkin linked a source file of the game (written in c++). You will find this file in the source code of the game, in the src folder.  
You could change that variable to whatever value you desire and then recompile the game to be able to wear more than the 2 of one item.

If you want to write (and distribute) a mod, however, that uses the built in mod loader system… then this isn’t really helpful in any way I’d know of…  
Maybe s-/he can explain it better how this would be helpful?
