Page 1 of 1
How do we specify hooks in init scripts?
Posted: Fri Oct 31, 2014 4:39 pm
by MrChoke
Maybe this has been answered and I just failed to find it. You know how in LoG1 we can override hooks by adding them to init.lua. Take this one for the party:
cloneObject{
name = "party",
baseObject = "party",
onMove = function(self, dir)
print("party moves in direction", dir)
end,
}
I think its now "defineObject" but I can't seem to figure out how to do it? Does anybody know?
Re: How do we specify hooks in init scripts?
Posted: Fri Oct 31, 2014 4:49 pm
by Doridion
Think than Jgwman coded a hook for his
Combat Log. Just called in the init.lua but seems to be a fine hook definition.
Re: How do we specify hooks in init scripts?
Posted: Fri Oct 31, 2014 8:03 pm
by JKos
viewtopic.php?f=22&t=7642
so you don't have to test which of the old party-hooks do work and which don't.
Re: How do we specify hooks in init scripts?
Posted: Sat Nov 01, 2014 12:17 am
by MrChoke
Re: How do we specify hooks in init scripts?
Posted: Sat Nov 01, 2014 1:12 pm
by Jgwman
Thought I should mention-it seems that there is no longer an onUseItem hook. Just use onAttack and check if weapon.usableitem exists.
Re: How do we specify hooks in init scripts?
Posted: Sat Nov 01, 2014 6:54 pm
by JKos
I just noticed that you can now define hooks dynamically in run time.
Example
party.party:addConnector("onMove", "hooks", "onPartyMove")
Nice! So I guess I don't have to write "LoG Framework" for LoG2.