# LUA mod to add flags to a monster?

**URL:** <https://discourse.cataclysmdda.org/t/lua-mod-to-add-flags-to-a-monster/18437>\
**Category:** The Lab\
**Created:** [January 18, 2019, 3:53pm UTC](https://discourse.cataclysmdda.org/t/lua-mod-to-add-flags-to-a-monster/18437 "2019-01-18T15:53:35Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Human\_Shield](https://avatars.discourse-cdn.com/v4/letter/h/f05b48/32.png) [@Human\_Shield](https://discourse.cataclysmdda.org/u/Human_Shield)\
**Post date:** [January 18, 2019, 3:53pm UTC](https://discourse.cataclysmdda.org/t/lua-mod-to-add-flags-to-a-monster/18437/1 "2019-01-18T15:53:35Z")

</div>

LUA class definitions lists values that can be adjusted and “set\_flag” to change the value of existing flags. But I don’t see any function to add new flags (say add “KEENNOSE” to all zombies).

mtype = {  
string\_id = “mtype\_id”,  
attributes = {  
agro = { type = “int”, writable = true },  
armor\_acid = { type = “int”, writable = true },  
armor\_bash = { type = “int”, writable = true },  
armor\_cut = { type = “int”, writable = true },  
armor\_fire = { type = “int”, writable = true },  
armor\_stab = { type = “int”, writable = true },  
attack\_cost = { type = “int”, writable = true },  
color = { type = “nc\_color”, writable = true },  
death\_drops = { type = “string”, writable = true },  
def\_chance = { type = “int”, writable = true },  
difficulty = { type = “int”, writable = true },  
hp = { type = “int”, writable = true },  
id = { type = “mtype\_id” },  
luminance = { type = “float”, writable = true },  
melee\_dice = { type = “int”, writable = true },  
melee\_sides = { type = “int”, writable = true },  
melee\_skill = { type = “int”, writable = true },  
morale = { type = “int”, writable = true },  
phase = { type = “phase\_id”, writable = true },  
revert\_to\_itype = { type = “string”, writable = true },  
size = { type = “m\_size”, writable = true },  
sk\_dodge = { type = “int”, writable = true },  
speed = { type = “int”, writable = true },  
sym = { type = “string”, writable = true },  
upgrade\_group = { type = “mongroup\_id”, writable = true },  
upgrades = { type = “bool”, writable = true },  
half\_life = { type = “int”, writable = true },  
upgrade\_into = { type = “mtype\_id”, writable = true },  
vision\_day = { type = “int”, writable = true },  
vision\_night = { type = “int”, writable = true },  
},  
functions = {  
{ name = “bloodType”, rval = “field\_id”, args = { } },  
{ name = “get\_meat\_itype”, rval = “string”, args = { } },  
{ name = “gibType”, rval = “field\_id”, args = { } },  
{ name = “has\_flag”, rval = “bool”, args = { “string” } },  
{ name = “made\_of”, rval = “bool”, args = { “material\_id” } },  
{ name = “has\_special\_attack”, rval = “bool”, args = { “string” } },  
{ name = “in\_category”, rval = “bool”, args = { “string” } },  
{ name = “in\_species”, rval = “bool”, args = { “species\_id” } },  
{ name = “nname”, rval = “string”, args = { “int” } },  
{ name = “nname”, rval = “string”, args = { } },  
{ name = “same\_species”, rval = “bool”, args = { “mtype” } },  
{ name = “set\_flag”, rval = nil, args = { “string”, “bool” } },  
}  
},

---

<div class="post-metadata">

**Author:** ![Human\_Shield](https://avatars.discourse-cdn.com/v4/letter/h/f05b48/32.png) [@Human\_Shield](https://discourse.cataclysmdda.org/u/Human_Shield)\
**Post date:** [January 22, 2019, 1:48pm UTC](https://discourse.cataclysmdda.org/t/lua-mod-to-add-flags-to-a-monster/18437/2 "2019-01-22T13:48:53Z")

</div>

This would make it easier to customize enemies, which is the easiest way to change the challenge in the game.
