Skip to content

Lua: Activate event can be called more than once per activation request

First off I have a bad habit of describing two issues in a single post so I'd like to start by clarifying these are actually two separate problems, but they're interrelated enough I am electing to make a single issue here.

The problem is that in some circumstances OnActivate from engineevents.cpp may be called multiple times for a single activation request.

To reproduce, go into Seyda Neen, Arrille's Tradehouse. Click the dunmer woman. Write the following command: aiactivate bk_livesofthesaints

Any global scripts with an onActivate handler will now be triggered every single frame.

Now, in context, the case with a book is somewhat just a compatibility issue with Morrowind.exe. There, when an actor activates a book, it actually just opens it for the player. I'm unsure if openmw needs to replicate this or not?

More relevant, if an activation doesn't complete within the space of a single frame, this function is called repeatedly. When global events are sent via the network as intended for multiplayer, this may introduce additional unnecessary calls to this function as has been demonstrated here:

I can do something about my own netcode but there's something fixable here, I believe, beyond just the book case.

untitled.mp4