DoomRL > Modding
Can we have tutorial on how to make a the main.lua file?
SPTX:
--- Quote from: yaflhdztioxo on March 30, 2013, 09:19 ---Post your current procedure as a non-jpeg so I can copy it in and see what happens.
And fer chrissakes, use indenting :/. I cannot stress this enough for new coders. It will make your life and by extension my life easier.
--- End quote ---
Nevermind, my mistake, that works.
Thanks a lot.
I'll try using indenting, I already do it here and there, but I have a hard time getting the conventions right.
--- Quote from: Autoquark on March 30, 2013, 09:23 ---So you don't need your hooks to make the player resistant - just set a resistance value on the item.
--- End quote ---
You are right. I wonder where I fucked up.
Anyway, there are monsters in the game that are invulnerable to fluids. How is this achieved? They don't seem to use resistances since there is no pain sound.
yaflhdztioxo:
You can be invincible to fluids by either having an acid/lava resistance of 100% (no monsters have this to my knowledge) or by having the BF_ENVIROSAFE flag (which is meant to simulate flying creatures usually).
And thanks to Autoquark for experimenting in new and inventive ways :). We need more of that. And also more wiki love.
SPTX:
How do you ADD a flag?
I use
--- Code: --- OnEquip = function (self,player)
player.flags = {BF_ENVIROSAFE} end,
--- End code ---
(which didn't grant me fluid invulnerability btw) but I believe it replaces the flags instead of adding to it. I also tried some other silly equations that obviously give errors.
tehtmi:
To add a flag do
--- Code: ---player.flags[BF_ENVIROSAFE] = true
--- End code ---
If you are doing this in OnEquip, OnRemove, it is possible for there to be strange interactions. For example, the player can equip your item, then equip the phaseshift set which also grants to the flag. Then if the player unequips the phaseshift set, that will remove the flag even though your item is still equipped. The only reason the phaseshift wet works is that there is no other way of changing this flag. The classic way of solving this problem is to do something like
--- Code: ---OnEquip(self, player)
if not player:has_property("envirosafe") then
player:add_property("envirosafe", 0)
end
player.envirosafe = player.envirosafe + 1
player.flags[BF_ENVIROSAFE] = true
end,
...
OnRemove(self, player)
if not player:has_property("envirosafe") then
player:add_property("envirosafe", 0)
end
player.envirosafe = player.envirosafe - 1
if player.envirosafe <= 0 then
player.flags[BF_ENVIROSAFE] = false
end
end,
--- End code ---
However, this requires all things modifying this flag to use this protocol. Or you can just ignore it since it's usually an edge case.
damage_add is a valid item property that just effects that particular item. The corresponding prototype property isn't accepted by the blueprint because it is intended to be parsed from the damage string, as you discovered.
Weapon resistances are used in DoomRL by the Acid Spitter, so they are officially supported (if not widely used).
SPTX:
Thank you, it works wonders.
Now I have yet an other questions.
1. How are the monster's melee attack handled? I am thinking about monsters that have both ranged and melee attacks, such as cacodemons. They obviously don't switch weapons, and they seem to be rolling dice too.
What I want to do is basically override the player melee attack that is used under the same circumstances (ranged weapon equipped, bumping into an enemy) But I don't find anything helping me in either "being" and "thing" nor "player" pages of the wiki.
2. is there any parameter that defines the aggressive behaviour or monsters toward the player? I'd want to invert that behaviour (friendly monsters attacking other monsters)
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version