DoomRL > Modding
Changing the ammo system?
Autoquark:
Thanks. Is there any way of accessing the target being (or at least its location) from inside the OnFire hook?
yaflhdztioxo:
No, and that is something many of us have lamented for as long as modding has existed :(
Autoquark:
I'm not sure I understand how the player hooks work. How do I set them, and do I only have the standard being OnCreate, OnAction and OnDie hooks, or is there something like a generic OnFire hook for the player?
SPTX:
Wouldn't it work using
--- Code: ---OnAction()
{
if Being:attack(player) then "your_action"
}
--- End code ---
?
yaflhdztioxo:
The player is defined before you (the modder) ever get near the engine. Because of this you must manually modify or extend the player's being hooks. This is easy to do, and there is a genericized example or two in the Skulltag Arena in the runes and powerups section (okay, granted, it's not easy to find)
--- Code: ---beings["soldier"].HookYouWantToChange = function
--- End code ---
As a practical example, let's day I want to change the OnPickupItem hook AND I want the current hook to still trigger. I can chain an inline function as follows:
--- Code: --- beings["soldier"].OnPickupItem = core.create_seq_function(beings["soldier"].OnPickupItem,
function(self,i)
do_stuff
end)
--- End code ---
There are six being hooks. They're probably documented on the wiki, but just in case they aren't:
--- Code: --- OnCreate(self)
OnAction(self)
OnAttacked(self)
OnDie(self, overkill)
OnDieCheck(self, overkill)
OnPickupItem(self,i)
--- End code ---
Lastly, remember that this logic can be applied to pretty much ANY being, not just the player. That said, there are very few scenarios where this is useful. For levels and challenges it is almost always better to use the corresponding (chained) level or challenge hooks. The only times I have ever needed to use these tricks are when I was making drastic changes to the engine--such as with runes and powerups, both of which in SkulltagRL pretty much required I make my OWN damn affects engine and hook into everything else as a result.
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version