Semtex Novice
Posts : 12 Join date : 2021-04-23
| Subject: [SOLVED] Crash when using bandage + medkit Tue 7 Feb 2023 - 0:16 | |
| Hi there, I have instant CTD every time I use a bandage then a medkit. Here is the stack trace: FATAL ERROR [error]Expression : fatal error [error]Function : CScriptEngine::lua_error [error]File : E:\stalker\sources\trunk\xr_3da\xrGame\script_engine.cpp [error]Line : 73 [error]Description : <no expression> [error]Arguments : LUA error: ...es\stalkersoup\gamedata\scripts\dmx_medicines.script:167: attempt to perform arithmetic on upvalue 'act_health' (a nil value) stack trace: Can anyone help me on this? thx -------------------------------------------------------------------------------------- RESPONSE from nekomaster: I found the culprit, when you deactivate the "dmx_hide_weapon" option in modder's script, this makes the function "medical_hide_wpn" in dmx_medicines.script crash because lines 151 and 243 are commented. The function need to be like that to prevent crashes: - Code:
-
function medical_hide_wpn(obj_section) if dmx_hide_weapon == true then --110019 // HERE, REMOVE THE "--" AT THE START OF THIS LINE if not (has_alife_info("advanced_outfit_used") or has_alife_info("bar_arena_fight")) then --utils.info_msg("2", script_name(), "medical_hide_wpn:", "act_health value: "..utils.ToString(act_health)) if food_tabl[obj_section] then dmx_medical_hide_wpn(5) elseif drink_tabl[obj_section] then dmx_medical_hide_wpn(4) elseif medical_tabl[obj_section] then --110017.1 if obj_section == "medkit" then if not has_alife_info("actor_medkit_use_info") then --amk.start_timer("actor_medkit_use_timer", 3, "") --tb3d_services.give_info("actor_medkit_use_info") act_health = db.actor.health dmx_medical_hide_wpn(6) medical_show_hud() else db.actor.health = act_health - 0.48 --110020 - aleks1970 --utils.info_msg("3", script_name(), "medical_hide_wpn: medkit", "db.actor.health value: "..utils.ToString(db.actor.health)) amk.spawn_item_in_inv("medkit") news_manager.send_tip(act, "medic_not_finished", nil, "medic_icon", 16000) end elseif obj_section == "medkit_army" then if not has_alife_info("actor_medkit_use_info") then --amk.start_timer("actor_medkit_use_timer", 8, "") --tb3d_services.give_info("actor_medkit_use_info") act_health = db.actor.health dmx_medical_hide_wpn(8) medical_show_hud() else db.actor.health = act_health - 0.70 --110020 - aleks1970 amk.spawn_item_in_inv("medkit_army") news_manager.send_tip(act, "medic_can_overdose", nil, "medic_icon", 16000) end elseif obj_section == "medkit_scientic" then if not has_alife_info("actor_medkit_use_info") then --amk.start_timer("actor_medkit_use_timer", 7, "") --tb3d_services.give_info("actor_medkit_use_info") act_health = db.actor.health dmx_medical_hide_wpn(11) medical_show_hud() else --db.actor.health = act_health - 0.75 --110020 - aleks1970 amk.spawn_item_in_inv("medkit_scientic") news_manager.send_tip(act, "medic_can_overdose", nil, "medic_icon", 16000) end elseif obj_section == "suvorotka" then if not has_alife_info("actor_medkit_use_info") then --amk.start_timer("actor_medkit_use_timer", 10, "") --tb3d_services.give_info("actor_medkit_use_info") act_health = db.actor.health dmx_medical_hide_wpn(14) medical_show_hud() else --db.actor.health = act_health - 0.95 --110020 - aleks1970 --utils.info_msg("3", script_name(), "medical_hide_wpn: suvorotka", "db.actor.health value: "..utils.ToString(db.actor.health)) amk.spawn_item_in_inv("suvorotka") news_manager.send_tip(act, "medic_can_overdose", nil, "medic_icon", 16000) end elseif obj_section == "medkit_elite" then if not has_alife_info("actor_medkit_use_info") then --amk.start_timer("actor_medkit_use_timer", 10, "") --tb3d_services.give_info("actor_medkit_use_info") act_health = db.actor.health dmx_medical_hide_wpn(18) medical_show_hud() else --db.actor.health = act_health - 0.95 --110020 - aleks1970 amk.spawn_item_in_inv("medkit_elite") news_manager.send_tip(act, "medic_can_overdose", nil, "medic_icon", 16000) end elseif obj_section == "morphine" then --110016 if not has_alife_info("actor_medkit_use_info") then --amk.start_timer("actor_medkit_use_timer", 10, "") --tb3d_services.give_info("actor_medkit_use_info") act_health = db.actor.health dmx_medical_hide_wpn(10) medical_show_hud() else db.actor.health = act_health - 0.76 --110020 - aleks1970 amk.spawn_item_in_inv("morphine") news_manager.send_tip(act, "medic_can_overdose", nil, "medic_icon", 16000) end end elseif mini_medical_tabl[obj_section] then dmx_medical_hide_wpn(6) --110020 - aleks1970 medical_show_hud() end else if has_alife_info("actor_medkit_use_info") then tb3d_services.remove_info("actor_medkit_use_info") end hud:RemoveCustomStatic("medkit_static") --110020 - aleks1970 dmx_medical_hide_wpn(0) --110019.1 end end -- // HERE, REMOVE THE "--" AT THE START OF THIS LINE end EDIT from nekomaster: So using those changes I'm STILL having this crash/error when I use bandages and then a medkit right after - Code:
-
FATAL ERROR [error]Expression : fatal error [error]Function : CScriptEngine::lua_error [error]File : E:\stalker\sources\trunk\xr_3da\xrGame\script_engine.cpp [error]Line : 73 [error]Description : <no expression> [error]Arguments : LUA error: ... - stalkersoup\gamedata\scripts\dmx_medicines.script:167: attempt to perform arithmetic on upvalue 'act_health' (a nil value)
stack trace:
I copied and pasted the code-snippet from the first post and replaced the exact same section in my dmx_medicines.script just so I dont miss anything and yeah it still crashes for me with the same error that the first post was complaining about and suppossedly fixed. EDIT from nekomaster: For now I commented out these lines... - Code:
-
db.actor.health = act_health - 0.xx (where xx = the value) ...aaaaand the game functions fine without them! Just means that now the warnings in the news will always appear regardless of the player/actors health but I think this is a fair trade off to have stuff work. Either way in the end using medkits or morphine works and hides weapons without issue or crashes (I think I managed to solve my issue with my own code tweaks lol) | |
|
Sword2012 Administrator
Posts : 1240 Join date : 2017-05-31 Location : UK
| Subject: Re: [SOLVED] Crash when using bandage + medkit Sun 9 Jul 2023 - 15:42 | |
| My apologies, but in editing the above post for conciseness, I inadvertently sent it back in time to last February... This combined post from Semtex, with a very useful fix from nekomaster, should be dated today
Last edited by Sword2012 on Sun 9 Jul 2023 - 18:49; edited 5 times in total (Reason for editing : Trying to do a relatively simple job while tired...) | |
|
nekomaster Novice
Posts : 16 Join date : 2021-02-13
| Subject: Re: [SOLVED] Crash when using bandage + medkit Sun 9 Jul 2023 - 15:44 | |
| - Sword2012 wrote:
- My apologies, but in editing the above post for conciseness, I inadvertently sent it back in time to last February...
This combined post from Semtex, with a very useful fix from nekomaster, should be dated today Enh, either way, so long as people can find the fix, which ever works, is what counts in the end. I'm just glad my hack works (at least for myself) | |
|
Hydralisk Novice
Posts : 15 Join date : 2018-10-07 Location : Poland
| Subject: Re: [SOLVED] Crash when using bandage + medkit Tue 29 Aug 2023 - 16:31 | |
| I have the same issue, however I don't have the dmx_medicines.script file and I'm not sure how to get a hold of it. I tried to extract it from the game files but all I got was a garbled mess of missing characters. | |
|
Sponsored content
| Subject: Re: [SOLVED] Crash when using bandage + medkit | |
| |
|