Summary
Game crashes when opening/drawing the PDA, likely because unjam_motion_mark.script assumes the actor's active item is always a weapon.
When the active item is PDA/device/non-weapon, this line crashes:
db.actor:active_item():cast_Weapon():SetMisfire(false)
The script does not check whether active_item() exists and whether it can be cast to weapon.
Environment
- Game: S.T.A.L.K.E.R. Anomaly / GAMMA
- GAMMA version: 0.9.5 update after May 15 2026
- Engine: X-Ray Monolith v1.5.3
- Modded Exes: MT-TEST version 2026.05.15
- Executable:
anomalydx11avx.exe
- Location where reproduced: Garbage
- Trigger: opening/drawing PDA
Reproduction steps
- Start/load a game.
- Go to Garbage / Свалка.
- Equip normal weapons.
- Open/draw PDA.
- Game crashes with Lua runtime error.
Actual result
The game crashes with:
[LUA] d:/anomaly\gamedata\scripts\unjam_motion_mark.script:4: attempt to index a nil value
FATAL ERROR
Function : CScriptEngine::lua_pcall_failed
Description : fatal error
LUA error:
d:/anomaly\gamedata\scripts\unjam_motion_mark.script:4: attempt to index a nil value
Stack trace points to:
unjam_motion_mark.script(4)
axr_main.script(284) : make_callback
_g.script(118) : SendScriptCallback
_g_patches.script(418)
The uploaded log confirms the crash path: unjam_motion_mark.script(4) is called through SendScriptCallback, then the game raises CScriptEngine::lua_pcall_failed and exits with fatal Lua error.
Active conflicting file in MO2
In MO2 Data tab, active script path:
Data\gamedata\scripts\unjam_motion_mark.script
is provided by:
92- Vityaz Replacer - Blackgrowl
There are many other mods shipping the same script, but the winning/active one in MO2 was:
92- Vityaz Replacer - Blackgrowl
Original script
-- Clear jam mid animation with motion marks
function actor_on_hud_animation_mark(state, mark)
if mark == "clear_jam" then
db.actor:active_item():cast_Weapon():SetMisfire(false)
end
end
function on_game_start()
RegisterScriptCallback("actor_on_hud_animation_mark", actor_on_hud_animation_mark)
end
Suspected cause
actor_on_hud_animation_mark can be fired while the actor's active item is not a weapon, for example PDA/device/empty hands.
The script assumes this chain is always valid:
db.actor:active_item():cast_Weapon():SetMisfire(false)
But if:
db.actor == nil
db.actor:active_item() == nil
active_item is not a weapon
cast_Weapon() returns nil
then line 4 crashes with:
attempt to index a nil value
Temporary workaround / local hotfix
I created a small MO2 override mod placed lower than weapon reanimation mods:
SUKUNA - Safe unjam_motion_mark hotfix
with this safe version:
-- Safe unjam motion mark handler.
-- Fixes crash when actor_on_hud_animation_mark fires while active item is not a weapon
-- e.g. PDA / device / empty hands.
local function safe_clear_misfire()
if not db or not db.actor then
return
end
local item = db.actor:active_item()
if not item then
return
end
local weapon = nil
local ok_cast = pcall(function()
weapon = item:cast_Weapon()
end)
if not ok_cast or not weapon then
return
end
pcall(function()
weapon:SetMisfire(false)
end)
end
function actor_on_hud_animation_mark(state, mark)
if mark ~= "clear_jam" then
return
end
safe_clear_misfire()
end
function on_game_start()
RegisterScriptCallback("actor_on_hud_animation_mark", actor_on_hud_animation_mark)
end
Expected fix
Add nil/type guards before calling:
At minimum:
function actor_on_hud_animation_mark(state, mark)
if mark ~= "clear_jam" then
return
end
if not db or not db.actor then
return
end
local item = db.actor:active_item()
if not item then
return
end
local weapon = item:cast_Weapon()
if not weapon then
return
end
weapon:SetMisfire(false)
end
A pcall around cast_Weapon() may be safer if some active items do not support this call cleanly.
Notes
This does not appear to be a PDA bug directly. PDA only triggers the animation/callback chain.
The crash is caused by unjam_motion_mark.script assuming the active item is always a weapon.
Summary
Game crashes when opening/drawing the PDA, likely because
unjam_motion_mark.scriptassumes the actor's active item is always a weapon.When the active item is PDA/device/non-weapon, this line crashes:
The script does not check whether
active_item()exists and whether it can be cast to weapon.Environment
anomalydx11avx.exeReproduction steps
Actual result
The game crashes with:
Stack trace points to:
The uploaded log confirms the crash path:
unjam_motion_mark.script(4)is called throughSendScriptCallback, then the game raisesCScriptEngine::lua_pcall_failedand exits with fatal Lua error.Active conflicting file in MO2
In MO2
Datatab, active script path:is provided by:
There are many other mods shipping the same script, but the winning/active one in MO2 was:
Original script
Suspected cause
actor_on_hud_animation_markcan be fired while the actor's active item is not a weapon, for example PDA/device/empty hands.The script assumes this chain is always valid:
But if:
then line 4 crashes with:
Temporary workaround / local hotfix
I created a small MO2 override mod placed lower than weapon reanimation mods:
with this safe version:
Expected fix
Add nil/type guards before calling:
At minimum:
A
pcallaroundcast_Weapon()may be safer if some active items do not support this call cleanly.Notes
This does not appear to be a PDA bug directly. PDA only triggers the animation/callback chain.
The crash is caused by
unjam_motion_mark.scriptassuming the active item is always a weapon.