Page 1 of 1
Request: New hooks!
Posted: Thu Sep 20, 2012 12:57 am
by Lilltiger
Id like to see some new hooks added to the items so we can use them in the cloned objects like:
onItemLeftMouseButton():
A hook which is called when the item is pressed on with the left mouse button, the default behavior is:
Code: Select all
onItemLeftMouseButton() = function(self)
setMouseItem(self)
end
By specifying this hook for an item you can make the player unable to pick up the item, or play some special
effects etc. when picking it up.
onItemAdded():
A hook which is called when the item is added to an inventory/slot/container(sack, altar, etc..)
Re: Request: New hooks!
Posted: Thu Sep 20, 2012 1:32 am
by Montis
The following party hook that already exists might be something that might interest you:
onPickUpItem: a hook which is called when an item is picked up. The function gets two parameters, the party itself and the item. If the function returns false, the pick up action is cancelled.
Re: Request: New hooks!
Posted: Thu Sep 20, 2012 4:33 pm
by Lilltiger
Indeed, that might replace the first proposed hook, ill try it out.
Re: Request: New hooks!
Posted: Thu Sep 20, 2012 5:04 pm
by Emciel
onItemAdded does sound very useful actually =)
Re: Request: New hooks!
Posted: Fri Sep 21, 2012 1:09 pm
by Lilltiger
Well both would be as the current "onPickUpItem" hook is not called when picking up from the inventory making it quite useless.
Re: Request: New hooks!
Posted: Fri Sep 21, 2012 2:54 pm
by Montis
Request:
A monster "
onAggro" hook would also be nice (maybe name it a bit differently though

).
That would be called when a monster spots the party and turns to attack it.
Re: Request: New hooks!
Posted: Fri Sep 21, 2012 4:00 pm
by Komag
ah I like that one, so when you're spotted an alarm goes off, or there is "insta-kill" if you are supposed to sneak through the map, or the lights go out, etc
Re: Request: New hooks!
Posted: Mon Sep 24, 2012 5:10 pm
by Montis
Another request:
onCraft
A hook in the recipes when crafting an item. Should returns crafted item, champion that crafts it and which item is used to craft (e.g. mortar & pestle, hammer & anvil etc). If false is returned, no item is crafted and the materials are not consumed. If true is returned, the materials are consumed, no matter if they actually crafted something.