DoomRL > Modding

How do I change default melee damage? Also, timers.

(1/2) > >>

items.fists doesn't exist and when I look into the log of beings I don't see anything that points to a weapon for melee, I believe it's coded into the AI or something.
Anyway, here's the question :
-How do I change default melee damage (the one used by melee_ranged/former_ai monsters and the player when he has a ranged weapon equipped)
Also, how do I change its sound?

Now about timers. How do I make them?
For example, I want to make a weapon that will drop bombs on the ground that will not instantly explode, letting the player and enemies play other turns for a bit before that happens.

From wiki:
being.todam  (shortint)  This damage modifier is applied to all the being's melee attacks.

we can't change magic base 1d3, but parameter todam can.

Player deals 1d3. Each level of Brute adds +3 player.todam.

Former human melee: 1d3 -1
imp melee: 1d3 +2
demon melee: 1d3 +5
and so on.

being.soundmelee  (word)  This is the being's .melee sound.

For converting some sound file to word number use core.resolve_sound_id (look into "Elevator of dimensions" code)

Oh, I hadn't noticed that monsters also had 1d3 as a base and were just applied the todam. Well, thanks, that's certainly unlocks me for one big part.

Timers, like the ones I use in Skulltag and Elevator to generate explosions, are NOT DoomRL constructs.  They are queues I spin up and manage myself.

Inserting new events into my event queues is done whenever I feel like it.  I usually manage my event queue with the OnTick hook.  It exists for Level, Module, Challenge, and Core (Lev and Mod being the two you're most likely to use).  That 'timer' runs once every tick (once every 0.1 seconds) which is usually good enough for my needs.  Other things that could be abused to make timers include affects (which is action based instead of tick based but which is much harder to make work) and a being's OnAction (also action based but since it is tied to a being it really only makes sense to time things here in a manner akin to cooldown).  Unfortunately the PLAYER does NOT trigger OnAction hooks, a shame since that would be a perfect answer to a lot of non-absolute timing schemes.  Were the player OnAction hook working I'd move most of the Skulltag effects to that timing system in a heartbeat.

I was afraid I would have to use OnTick.
Well, I guess a proper way to implement timed functions is a fine request for the modding wishlist


[0] Message Index

[#] Next page

Go to full version