Escort AI missing argument
Issue Description
AI.startPackage with type = 'Escort' crashes with a C++ argument error because scripts/omw/ai.lua does not pass the isRepeat argument to the internal _startAiEscort function.
The C++ signature expects 7 arguments:
void(MWLua::SelfObject&, const MWLua::LObject&, MWLua::LCell, float, const osg::Vec3f&, bool, bool)
But scripts/omw/ai.lua only passes 6:
self:_startAiEscort(args.target, args.destCell or self.cell, args.duration or 0, args.destPosition, cancelOther)
The isRepeat field from the package table is never read or forwarded, so the its bool parameter in the C++ binding receives no value.
Error:
L0x101f7c5[scripts/nightpatrol_guard.lua] onUpdate failed. Lua error: [string "scripts/omw/ai.lua"]:22: stack index 7, expected boolean, received no value: (bad argument into 'void(MWLua::SelfObject&, const MWLua::LObject&, MWLua::LCell, float, const osg::Vec3f&, bool, bool)') stack traceback: [C]: in function '_startAiEscort' [string "scripts/omw/ai.lua"]:22: in function 'startPackage' [string "scripts/nightpatrol_guard.lua"]:146: in function 'startEscortPackage' [string "scripts/nightpatrol_guard.lua"]:274: in function <[string "scripts/nightpatrol_guard.lua"]:204>
Once you modify the line like this
self:_startAiEscort(args.target, args.destCell or self.cell, args.duration or 0, args.destPosition, args.isRepeat, cancelOther)
the error is gone.
Steps to Reproduce
-
Create a local NPC script that calls AI.startPackage with an Escort package: In my case it's
local function startEscortPackage()if not target or not target:isValid() or not doorPos then return endescorting = trueAI.startPackage({type = 'Escort',target = target,destPosition = doorPos,destCell = self.cell,duration = 10800,isRepeat = false,cancelOther = false,})end -
Trigger the code in-game.
System Information
-
OpenMW Version:
0.50
-
Operating System & Version: Win 11
-
GPU: Radeon Vega 7
-
Morrowind Version:
GOG
-
Language:
English
-
Addons:
Tribunal, Bloodmoon
Mods
- Are you using mods? Yes
- Are you using any shader mods? No
- Does it happen in a clean vanilla install? Untested