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.
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.
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?
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.
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.