Is it possible to define new special attacks/deaths with a mod?

After some tinkering with the data I did find, Ive been unable to either find an example of it or get my own jerry-rigged example to work.

I took the thrillers death function and replaced the monster_id to let me turn all squirrels into bees upon the death of a critter, but the game doesnt seem to recognize my efforts.

mmmk.

So I thought on it, and maybe? Im not afraid to try.

Ive managed to get the main.lua file that I see in some mods to accept a specific creature instead of a species, and as far as Im concerned thats more progress than a less curious person would have.

I dont know if main.lua is the only lua file accepted, what lua is, or even how .cpp and .h files play into that, but .h files seem to name variables and ids, while .cpp files have the meats.

It appears I need to get the game to register a new deathtype or special attack. From there, with some inspiration, I could cannibalize existing code into something that might function, but I dont know if I can define new variables in lua.

I have relevant input!
You can define a new variable like this:
local blah = blah

It seems to not care about types, I’ve seen strings and ints used with the same declaration ie:
local string = "foobar"
and
local number = 18

and it can accept data from functions as well
local p = player:pos()

uses one of the functions from catabindings to return a tripoint of the player position. Not that I know what a tripoint is or how to use one, but…

So if I define a mdefense (treesprout) as a local variable, then the game should read it as an attack_on_hit that sprouts trees like a Queen would if I do a rough copypaste job?

See, my problem is I know what I mean, but I have zero clues if that makes senses.

But I dont really have to bother with trying to replicate the .h or .cpp files then? I can define them in lua? Because lua is a bit friendlier on my eyes.

I’m not sure, but my gut says no. Have you seen the class_definitions.lua in the lua directory? There are a lot of predefined functions available to manipulate creatures and the environment. Perhaps something in there will help?

Well Im still not making headway. Thanks for the help though

I beat my head against the lua brick wall whenever I feel like getting frustrated and angry at a computer screen. I’m considering springing for some online classes in c++ and lua or something similar to give myself a better foundation, this self-taught-no-lessons crap is bad for the blood pressure.

This only means that Id have to maintain/compile my own version of dda to put threse in.

tempting, but not with my level of expertise, jaa

If you put your mod into github, kevin has said before he’s willing to support code changes that would support the mod.

If I’m not mistaken, there currently isn’t code to handle custom on_hit effects for monster attacks. One thing we could do, however, is refactor the on_hit effect handling to something similar to iuse actions. This would let you register a function in lua as an on_hit effect, which could then be used in the json definition to tell the game to use that function for the effect. I’ll take a look at this later in the week/weekend to see if I can get something going.

there is now code to support this. special player defined attacks and mon effects both…

i respond to this because its on the top of my feed fsr. happy holidays