Event Trouble (Parameter List? and Globally Noticed Events)

I am having immense trouble with abilities that take action on events. First and foremost, I have spent many hours searching for any documentation on what parameters I can extract from an event (or the technical term for the argument to, for example, the OnAttacked(arg) function). I would appreciate any pointers to documentation or lists. Secondly, even when I have induced such parameter names from reading others' work, events are triggering for me whenever an event of the appropriate type occurs globally (as opposed to, for instance, when the bearer of the modifier that hosts the OnAttacked() function is attacked). I understand that global listeners exist, but my reading of existing work suggests that an event trigger that is a function of a modifier should not listen globally.

As always, any and all assistance welcomed.

Comments

  • I don't know of documentation that lists event parameters, but I can usually list them by doing

    ~~~for k,v in pairs(event) do print(k,v) end~~~

    Events on ability_lua are global, and that's how they're intended to work. To make them for just your unit, just filter it by doing

    ~~~if affectedUnit == myUnit then doStuff() end~~~

  • I had planned to do the filtering if necessary, but that was dependent on getting the event parameters. And now I can do that! Thank you.