GWdope Posted August 15, 2022 Posted August 15, 2022 How would I remove this Event handler with the world.removeEventHandler function? Everything I've tried hasn't worked. Thanks. Quote Handler = {} function Handler:onEvent(event) if event.id == world.event.S_EVENT_SHOT and event.initiator == Unit.getByName('Player') then trigger.action.setUserFlag('200', true) end end world.addEventHandler(Handler)
GWdope Posted August 15, 2022 Author Posted August 15, 2022 Yes and the event handler keeps working. is (Handler) the name of the specific event handler in the script?
cfrag Posted August 16, 2022 Posted August 16, 2022 Perhaps it would be best if you showed your entire script and briefly explained what you are trying to achieve. I'm optimistic that we'll be able to sort this out quickly. 10 hours ago, GWdope said: is (Handler) the name of the specific event handler in the script? At least that is how *you* defined it in your code Handler = {} Redefines "Handler" as an empty table function Handler:onEvent(event) Adds the function "onEvent()" to the table "Handler" world.addEventHandler(Handler) Adds the table "Handler" -- which must have a function "onEvent()" -- to the world's event handler. So you'll have to invoke "removeEventHandler" with the same table "Handler" to have it removed again. Let's go though your code and try and remove the last obstcacle
Recommended Posts