Hook Signature Discrepancy

Ask for help about creating mods and scripts for Grimrock 2 or share your tips, scripts, tools and assets with other modders here. Warning: forum contains spoilers!
Post Reply
User avatar
strangely
Posts: 25
Joined: Mon Oct 29, 2012 2:28 am
Location: Tucson, AZ

Hook Signature Discrepancy

Post by strangely »

I have successfully added an 'onAttack' hook to the party component.
The signature for my hook is as follows:

Code: Select all

onAttack = function(party, champion, weapon)
   ...
end
However, the script reference shows the following signature:

Code: Select all

onAttack(self, champion, action, slot)
I changed my script to use the second signature and the engine accepted it and called it on attacks.

Does anybody know which signature I am supposed to use? In the second one, the one listed in the scripting reference, I can't figure out what is in the action parameter. Calling type(action) returns 'table' but when I try the following:

Code: Select all

for key,value in pairs(action) do
   hudPrint(key, value)
end
nothing is printed on the hud.

Any help would be appreciated.

Thanks.
Post Reply