S.T.A.L.K.E.R.: Clear Sky

S.T.A.L.K.E.R.: Clear Sky

nemchenk Feb 16, 2014 @ 3:56pm
Fix for (some) CTDs when saving in Clear Sky (COMPLETE and 'vanilla')
Hi there,

I like to take my time with the STALKER games, so imagine my horror when, 125 hours into CS:COMPLETE, I started getting fairly-consistent crashes to desktop when saving the game.

Skip the long story if you just want to see the fix...

I've had to skip a couple of side-quests because as soon as I would accept the quest the game would start CTDing on save, even after the quest was done. And then, today, the game just flat-out refused to save after talking to the Mercs at the village in the Army Warehouses. "That's it" I thought, game over :( Time to uninstall...

Well, not necessarily -- did some googling, turns out the LUA scripts for CS are fairly badly-written, tending to use variables without checking to see if they are null first. Rookie error ;) So I followed up the BugTrap report the game was giving me, and seems I've fixed my particular problem -- saving and loading works an hour since I implemented the fix, so I'm hopeful...


Clear Sky v1.5.10, Steam version
COMPLETE v1.1.3
Game time: 1 month, 369 quests received, 185 stashes found

Problem

Game CTDs when saving, with the following error log:
... ! [LUA][ERROR] ERROR: You are saving too much FATAL ERROR [error]Expression : fatal error [error]Function : CScriptEngine::lua_error [error]File : E:\priquel\sources\engine\xrServerEntities\script_engine.cpp [error]Line : 180 [error]Description : <no expression> [error]Arguments : LUA error: ...\common\stalker clear sky\gamedata\scripts\_g.script:975: bad argument #2 to 'format' (string expected, got nil) ...

Solution
1. Get your game to use mods if you haven't done already (see http://www.gamespot.com/forums/pc-mac-linux-society-1000004/how-to-install-stalker-clear-sky-mods-26616775/ )
2. Unpack your game if you haven't done already (see http://www.nexusmods.com/stalkerclearsky/mods/464/? )
3. Find your _g.script and open it up in an editor
4. Go down to line 975 ("function abort(fmt, ...)"), and replace
log(string.format("%s",nil))
with
log(string.format("%s",""))
5. That's it -- fire up CS and enjoy!

Hope this helps you, fellow STALKER!
Last edited by nemchenk; Jan 10, 2017 @ 3:56pm
< >
Showing 1-15 of 25 comments
roology Feb 22, 2014 @ 10:09pm 
At least you can fix yours whenever i'm in limansk during the street battle it crashes.
Decane Feb 23, 2014 @ 6:23am 
Originally posted by Vizʞa Да! #Мишка:
At least you can fix yours whenever i'm in limansk during the street battle it crashes.

Use this fix: http://dfiles.eu/files/hktm9vu7r
nemchenk Mar 3, 2014 @ 1:38am 
Just encountered that as well -- it's fixable, but there's still a problem after that where Synchronisation fails after a save/load in Limansk.
nemchenk Mar 3, 2014 @ 2:41pm 
Ok, I managed to fix both the crashes at the MG nest in Limansk, and the inability to save/load. I've had to modify two files:

1) xr_motivator.script - find "function motivator_binder:death_callback(victim, who)" and wrap everything from "xrs_dyn_music.stop_combat(self.object:id())" to the end of the function in
if object then xrs_dyn_music.stop_combat(self.object:id()) ... end end

2) xr_wounded.script - wrap the whole of "function hit_callback(npc_id)" in (an admittedly rather heavy-handed sanity check) the following:
function hit_callback(npc_id) -- Òóò ìîæåò íå áûòü ñòîðàäæà. if npc_id and db and db.storage and db.storage[npc_id].wounded and db.storage[npc_id].wounded.wound_manager then if db.storage[npc_id].wounded ~= nil then db.storage[npc_id].wounded.wound_manager:hit_callback() end end end

Hope this helps, I'll keep updating as I continue to play on...
nemchenk Mar 10, 2014 @ 6:19pm 
Gah, I had to make another handful of changes to fix everything and get through Limansk. I'll update this thread with the changes....
nemchenk Mar 11, 2014 @ 3:10pm 
Ok, here's what I ended up changing to get through Limansk without crashes (changes in bold EDIT: bold not showing inside code, great :/ Just compare what I have posted below with what you have -- the diffs are not that complicated!):

1) xr_motivator.script in "function motivator_binder:hit_callback(obj, amount, local_direction, who, bone_index)":
... if self and self.object and object and who then xr_wounded.hit_callback(self.object:id()) sim_combat.hit_callback(self.object:id(),who:id()) end

2) xr_motivator.script in "function motivator_binder:death_callback(victim, who)":
callstack() --' Distemper 03.2008 -- if object then xrs_dyn_music.stop_combat(self.object:id()) ... release_body_manager.get_release_body_manager():moving_dead_body(self.object) --' Distemper 11.02.2008 end

3) xr_wounded.script in "function hit_callback(npc_id)":
if npc_id and db and db.storage and db.storage[npc_id] and db.storage[npc_id].wounded and db.storage[npc_id].wounded.wound_manager then if db.storage[npc_id].wounded ~= nil then db.storage[npc_id].wounded.wound_manager:hit_callback() end end

4) stalker_generic.script in "function remove_level_spot(npc, st)":
if npc and st then local map_spot = utils.cfg_get_string(st.ini, st.section_logic, "level_spot", npc, false, "") ... end

5) _g.script in "function abort(fmt, ...)":
local reason
if ... then
reason = string.format(fmt, ...)
else
reason = string.format(fmt, "")
end
assert("ERROR: " .. reason) error_log("ERROR: " .. reason) log(string.format("%s","")) end

Still had a lot of glitches on the last level, but eventually managed to play through it and complete the game... phew! :]
Last edited by nemchenk; Mar 11, 2014 @ 3:11pm
RåKjell Jan 4, 2015 @ 3:32am 
Thank you so much. This saved me from starting over after 3-4 nights of playing. Can't believe noone else have chimed in here, but I'd like to say this was much appreciated!
nemchenk Jan 4, 2015 @ 3:38pm 
Cheers, matey :) Glad this thread helped you.


And: Good hunting, STALKER!
Last edited by nemchenk; Jan 4, 2015 @ 3:41pm
deadant Jan 11, 2015 @ 1:14am 
Nemchenk - you got pretty close to super hero status in my book last night when I found this!

I got stuck with this damn save crashes back in 2013 and, while crying my face off, left it unfinished and went for other games. Then last night I took it up again and started to look for some God Mode cheat (or anything really) so I could at least finish the game and found this thread. All by sudden six hours had passed and it was three in the morning... :-)

So before I dive back in: Thank you very very much for taking time to document this fix!
Last edited by deadant; Jan 11, 2015 @ 1:14am
deadant Jan 11, 2015 @ 1:20am 
Oh, I should mention I have the CD version of the game and playing without any mods so maybe the thread title should be changed? (But on the other hand, when you get desperate enough you'll read it anyway:-)
nemchenk Jan 11, 2015 @ 1:50pm 
:) Again, glad to be of help... Six hours disappearing to the Zone is a great result in my book!

I'll change the thread title since you've proven it works for the plain vanilla version just as well.

Good luck out there, STALKER!
Eradan Jan 13, 2015 @ 4:10pm 
Unistall kb2670838

http://support.microsoft.com/kb/2670838/en

For correct DX10 run.
Last edited by Eradan; Jan 13, 2015 @ 4:11pm
Keyser Băsoze Jan 9, 2017 @ 12:09pm 
Guys, hello... Looks like it's been a while. :)

If I'm here, you guessed it: playing Clear Sky Complete, got to Limansk, can't load any save games other than the autosave at the beginning of the level. :/

Tried a few times to "iron man" it, got reasonably far in, saved a few times in the process, just in case one of these might work. They don't. :|

I'm checking out nemchenk's comments above, but I don't quite understand what file am I supposed to edit ? Can't find the _g.script anywhere. Running Win 10. Here's what the log says:

! [LUA][ERROR] ERROR: xr_logic: pstor_load_all: not registered type N 147 encountered

FATAL ERROR

[error]Expression : fatal error
[error]Function : CScriptEngine::lua_error
[error]File : E:\priquel\sources\engine\xrServerEntities\script_engine.cpp
[error]Line : 180
[error]Description : <no expression>
[error]Arguments : LUA error: ...\common\stalker clear sky\gamedata\scripts\_g.script:975: bad argument #2 to 'format' (string expected, got nil)

Any ideas ? I already tried setting the .exe to run as admin, not using DX10, etc.

Thanks !

----

LATER EDIT:

Ok, so I figured out I had to unpack the game data to get to the _g.script file. The link initially posted for the unpacker doesn't work any more, but I found one here: http://www.nexusmods.com/stalkerclearsky/mods/464/?

Just follow the instructions and when it's done unpacking you'll find all the files in the "unpacked" sub-folder. In there, I edited the line in _g.script just like nemchenk posted in the first comment and then copied the file to ...steamapps/common/STALKER Clear Sky/gamedata/scripts. Then I took a deep breath, fired up the game, loaded my latest save from Limansk and... IT WORKED!

Nemchenk, if you read this, you are a f***ing hero man! A MILLION THANKS! I searched all over the internet for a solution and didn't think there was one, then this! This should be pinned or something so anyone else that might encounter this bug can see it. Again, nemchenk, THANK YOU!
Last edited by Keyser Băsoze; Jan 9, 2017 @ 1:19pm
nemchenk Jan 10, 2017 @ 3:53pm 
Glad I could help :)

It's funny how things work -- would you believe it, I just started playing STALKER again last week, this time something called STALKER: Call of Misery, which is a blend of Call of Chernobyl and Misery mod, on the Call of Pripyat platform. 32 levels, free-play, Misery UI and equipment... it's totally awesome :D

Anyway, have fun, and good luck out there in Limansk, STALKER!

PS. I've updated the links in the first post -- thanks for the heads-up, Jebedaias!
Last edited by nemchenk; Jan 10, 2017 @ 3:56pm
0wnage Apr 25, 2018 @ 8:20am 
I have not modded my Clear Sky yet. I just started playing after it downloaded. But there is this bug wherein you crash trying to chase Strelok in the Red Forest. I survived the ambush and told the last stalker to guide me through the mutants, but when he says "That's him, take him down" the game crashes with this report.

Expression : fatal error
Function : CScriptEngine::lua_error
File : E:\priquel\sources\engine\xrServerEntities\script_engine.cpp
Line : 180
Description : <no expression>
Arguments : LUA error: ...\s.t.a.l.k.e.r. clear sky\gamedata\scripts\_g.script:975: bad argument #2 to 'format' (string expected, got nil)

Here are my PC specs

OS Name: Microsoft Windows 10 Pro
Version: 10.0.16299 Build 16299
Other OS Description: Not Available
OS Manufacturer: Microsoft Corporation
System Type: X86-based PC
Processor: Intel(R) Core(TM) i3-2120 CPU @ 3.30GHz, 3300 Mhz, 2 Core(s), 4 Logical Processor(s)
BIOS Version/Date: Intel Corp. BEH6110H.86A.0041.2012.0319.1659, 3/19/2012
SMBIOS Version: 2.6
Embedded Controller Version: 255.255
BIOS Mode: Legacy
BaseBoard Manufacturer: Intel Corporation
BaseBoard Model: Not Available
BaseBoard Name: Base Board
Platform Role: Workstation
Secure Boot State: Unsupported
PCR7 Configuration: Binding Not Possible
Windows Directory: C:\WINDOWS
System Directory: C:\WINDOWS\system32
Boot Device: \Device\HarddiskVolume1
Locale:United States
Hardware Abstraction Layer: Version = "10.0.16299.371"
Installed Physical Memory (RAM): 4.00 GB
Total Physical Memory: 3.61 GB
Available Physical Memory: 1.59 GB
Total Virtual Memory: 10.6 GB
Available Virtual Memory: 6.54 GB
Page File Space: 7.00 GB
Page File: C:\pagefile.sys
Virtualization-based security: Not enabled
Device Encryption Support: Reasons for failed automatic device encryption: TPM is not usable, PCR7 binding is not supported, Hardware Security Test Interface failed and device is not InstantGo, Un-allowed DMA capable bus/device(s) detected, Disabled by policy, TPM is not usable
Hyper-V - VM Monitor Mode Extensions: Yes
Hyper-V - Second Level Address Translation Extensions: Yes
Hyper-V - Virtualization Enabled in Firmware: Yes
Hyper-V - Data Execution Protection: Yes

I am no coding expert on this, so just please help me. I have no mods or textures, I run on lowest quality
< >
Showing 1-15 of 25 comments
Per page: 1530 50