Chaosforge Forum

  • March 28, 2024, 14:10
  • Welcome, Guest
Please login or register.



Login with username, password and session length
Pages: [1]

Author Topic: How do I change default melee damage? Also, timers.  (Read 5127 times)

SPTX

  • Sergeant
  • *
  • Offline Offline
  • Posts: 77
  • Lost Soul
    • View Profile

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

Equality

  • Second Lieutenant
  • *
  • Offline Offline
  • Posts: 174
  • Lost Soul
    • View Profile
Re: How do I change default melee damage? Also, timers.
« Reply #1 on: May 06, 2013, 04:16 »

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)
Logged
Once advanced DoomRL player
Find mysterious sword Dragonslayer
Say "Best thing ever found!" and start jumping around...
But he can't get the sword from the ground

SPTX

  • Sergeant
  • *
  • Offline Offline
  • Posts: 77
  • Lost Soul
    • View Profile
Re: How do I change default melee damage? Also, timers.
« Reply #2 on: May 06, 2013, 11:50 »

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

yaflhdztioxo

  • Programmer
  • Local Inquisitor
  • Captain
  • *
  • *
  • Offline Offline
  • Posts: 298
  • Lost Sole
    • View Profile
Re: How do I change default melee damage? Also, timers.
« Reply #3 on: May 06, 2013, 16:58 »

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.
« Last Edit: May 06, 2013, 16:59 by yaflhdztioxo »
Logged

SPTX

  • Sergeant
  • *
  • Offline Offline
  • Posts: 77
  • Lost Soul
    • View Profile
Re: How do I change default melee damage? Also, timers.
« Reply #4 on: May 06, 2013, 17:35 »

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
« Last Edit: May 08, 2013, 04:05 by SPTX »
Logged

SPTX

  • Sergeant
  • *
  • Offline Offline
  • Posts: 77
  • Lost Soul
    • View Profile
Re: How do I change default melee damage? Also, timers.
« Reply #5 on: May 08, 2013, 04:05 »

I can't get the weapons sounds working.

I copied straight from elevator into my main.lua :
Code: [Select]
core.declare("FixAllSounds")
FixAllSounds = function() end

function mymod.OnEnter()
FixAllSounds() end

and then into my items.lua
Code: [Select]
local FixSounds = function()
items["meleeweapon"].sound_attack = core.resolve_sound_id("lostsoul.melee")
end
FixAllSounds = core.create_seq_function(FixSounds, FixAllSounds)
Aaaaand... it's not working.

Am I missing something there?
I also tried a very similar method from metal gear rl and no chance either. I just don't get it.
Logged

yaflhdztioxo

  • Programmer
  • Local Inquisitor
  • Captain
  • *
  • *
  • Offline Offline
  • Posts: 298
  • Lost Sole
    • View Profile
Re: How do I change default melee damage? Also, timers.
« Reply #6 on: May 08, 2013, 18:29 »

To be honest I have no idea which of the sound hacks is currently working.  The sound engine is a weakness in DoomRL and I've had to do different things across different versions.

The only thing that I know works for certain is naming your sound after the property you want to bind it to.  That requires no assigning or specialized Lua code whatsoever.
Logged

SPTX

  • Sergeant
  • *
  • Offline Offline
  • Posts: 77
  • Lost Soul
    • View Profile
Re: How do I change default melee damage? Also, timers.
« Reply #7 on: May 09, 2013, 01:55 »

The problem with that is that I don't use custom sounds, as you can see.
Logged

yaflhdztioxo

  • Programmer
  • Local Inquisitor
  • Captain
  • *
  • *
  • Offline Offline
  • Posts: 298
  • Lost Sole
    • View Profile
Re: How do I change default melee damage? Also, timers.
« Reply #8 on: May 09, 2013, 05:19 »

Copy, paste, rename.

Or you can try experimenting and see if something else works...
Logged

SPTX

  • Sergeant
  • *
  • Offline Offline
  • Posts: 77
  • Lost Soul
    • View Profile
Re: How do I change default melee damage? Also, timers.
« Reply #9 on: May 09, 2013, 07:50 »

I just tried this as well and it doesn't work...
All I seem to have left is trying to change my weapons into ranged weapons and trick them to work like melee weapons... But that's really dodgy and I am not even sure I'll be able to bind these melee sounds to the missiles.
Logged
Pages: [1]