New safe areas to hide from emissions and psy-storms. Finally, you can hide in the apartment blocks in Dead City, plus several other buildings!
A new game is not required to use this addon.
Also, your NPC companions will still die a horrible death in the new locations.
The safety calculation is currently only done for the player.
I am attempting to solve this, NPC safe-zone calculation is strange!
For a long time now, I have been thinking: "Why isn't this building safe from an emission?" and after much trial and error, I have a functional solution!
During an emission or a psy-storm, this script checks to see if the player is within the bounds of the given coordinates (set per level) and appropriately switches on the "I'm standing in a safe place" flag, allowing you to now take shelter in the following locations:
Added in v1.2:
Added in v1.5:
I have included an edited version of zat_b22_medic_door.ltx changing the "@locked" to "@closed".
NOTE: The Meadow shop and flooded basement are built at an angle in the game, and my maths isn't yet good enough to calculate rotated rectangles, so stay in the middle of these places, and you will be okay! See bottom of description for How does it work?
Please feel free to suggest any other places that should be considered a safe shelter!
The script will also place a PDA map icon on all the new safe locations, and also all the default locations. The game will still highlight the nearest default shelter, but without editing the emission/psy-storm scripts, I thought best to have it so that All the safe locations are shown instead. (Why not?)
Hiding in action
Changelog
Added some new locations. (detailed above)
Changed the way the tiny cube objects (used for the map icons) are added and removed from the world. This is so people can remove the addon without having to run a script in debug mode.
The objects are now added when an emission/psy-storm starts and are removed when the storm is over.
As long as the game is saved while there is not a storm occurring, then this addon can be removed.
Added a function for using the sleeping bag in these calculated shelters. Unfortunately, the message still shows "A safer place is needed to sleep" / "Необходимо безопасное место для сна", however, one second after this happens the sleep menu will appear, and the screen text will read "Sleep" / "Спать".
It's not perfect, but it seems to work for now.
Thanks to Cr3pis for the quick bug report! It looks like the callback function that I am using "physic_object_on_use_callback(obj, who)" is a bit buggy and sometimes doesn't return the "who" variable (as NIL or anything), but as long as I don't reference the "who", then it should be okay.
Again, this is not an ideal solution, but hopefully I can code up a better one!
Please comment if this causes a crash, thanks!
Small update to make sure that the script checks if the player is already underground and appropriately unsets the flag, after an emission/psy-storm, if not underground.
This was clashing with my RF Receiver Hidden Packages addon.
Added a bunch of locations in Rostok, Pripyat and The Outskirts. These are listed above in the description.
Added a script to remove all the "Tiny Cube" models from the game (which are used for the PDA map icons), so that this addon can be removed.
To do this:
How does it work?
For each set of coordinates, I have taken the lowest north-western point of an area (Point A), and the highest southeastern point of the area (Point B), as accurately as possible.
During the emission or psy-storm, the script will check the level name and checks if the player is within any of the sets of coordinates by iterating through each coordinate set doing some basic maths:
If
(player's X is greater than Point A's X)
and
(player's Z is less than Point A's Z)
and
(player's X is less than Point B's X)
and
(player's Z is greater than Point B's Z)
and finally
(player's Y is less than Point B's Y)
(Checking to see if the player is higher than Point A's Y is not required, unless they manage to fall out of the level I guess?)
This then is considered safe, and the script actually sets the flag to tell the game the player is underground (very sneaky), so that the default script that checks to see if the player is in shelter is skipped... until the player goes outside the safety area.
Because the PDA map icons require an object to mark, this script will once-only add several tiny cube models to where a map icon is needed. I found the small_cube.ogf in meshes\dynamics\equipments which is conveniently highly appropriate for this!
Also, the AI NPCs are unaware of these locations, that is a whole new coding level for the future!
Please let me know as soon as you are able if there are any problems and I will do my best to help!
Average
9.9124 votes submitted.
New Game required?
No, this will work on a current game (added to description, thanks) :)
MUUUUUUST, THANKYOUUU
Heh, you're welcome!
Wow! Thank you for this mod and for even explaining the process. This is really interesting and makes the mod even more creditable. Nice!
Thanks! The next step is to brush up on maths to work out how to do weird shapes that aren't simple rectangles :D
Nice!
Cheers :)
Another brilliant mod from TB, Thank you.
Thanks, it's a weird one but it works :)
Amazing!!
this is a must have like all your other addons.. thank you!!
It really is a joy to see other people appreciating my tweakings, cheers :)
LETS GOOO
here's another safe area i think would be nice: the apartment complex (it has multiple rooms) in pripyat that leads to jupiter
I remember always wanting to make it my hideout but couldn't lol
Nice one, I will have a look and add this one in for the next version!
Edit: Your wish has been granted! :D
Here's another nice addon! Thanks a lot!
*Performs a thumbs up* :)
Hello. If you turn off the mod. I can't get into the game
FATAL ERROR
[error] Expression: <no expression>
[error] Function: CInifile :: r_section
[error] File: Xr_ini.cpp
[error] Line: 544
[error] Description: fatal error
[error] Arguments: Can't open section 'tb_tiny_cube'. Please attach [* .ini_log] file to your bug report
Okay this is important - that means if I once install, I never can uninstall?
That newscript will sort that out, I couldn't think of another way to do this, but luckily there is the "run_script" command built into the console, phew!
Thanks for pointing this out, I didn't think of this!
I have added a removal script and instructions how to do this in the description for changelog v1.1.
Sorry for the initial crash!
Great idea, thanks
Thanks for trying it out :)
WOW I guess this will be a must HAVE
Great work, thank you
best regards,
Waymor
Cheers, feel free to suggest anywhere else that would be a feasible shelter!
yes!!!
if (affirmative == "true") then
do_a_little_dance()
end
*Tweaki_Breeki does a little dance*
Hahaha, I really had a laugh on this! Thanks :D :D :D
Thanks for making this, I always thought it was necesary but couldn't figure out how to make it myself, this is a great aportation.
Cheers! I initially started out by adding tiny, unnoticeable objects to the game and using a radius. So if you were close enough to the object you would be safe, but it would be a circle around the object, and buildings are cuboid.
Next up is working out how to do weird shapes!
great mod from the sound of it, thanks!
A suggestion for another one, or expansion of this one, would be to make the sleeping process a little less rigid and restrictive than in vanilla game where you can't sleep almost nowhere, even in common sense places, and a little more restrictive than some mods that just unlock the sleeping bag usage anywhere allowing sleeping in the open through a blowout, scot-free.
So:
1. Perhaps allowing to sleeping bag sleep in spots that ARE safe from blowouts (pretty much most of the spaces you have added, I'd imagine).
2. Alternatively allowing to use sleeping bag for sleep anywhere, BUT killing the player if there was an actual blowout during his sleep.
3. As above but waking him up to a blowout alarm if one is about to start.
4. as 1 and 2 but also representing the risk of sleeping in such spots by some chance spawn occurrence of an enemy patrol in vicinity on waking up.
This is all excellent, I agree the sleeping mechanic is a bit odd sometimes.
I've had a go at editing the files to also stop the screen fading to black when placing the sleeping bag, I need to release this tweak as well really.
Not yet tested the sleeping bag in these calculated safety zones, I'll have a look to see what the sleeping bag requires for a "yes, you can sleep here".
Awesome! :)
Cheers!
The Dead City changes alone are a livesaver, cheers for making this
It was a bit unfair in Dead City playing as an enemy of the Mercenaries.
The only places were their HQ building, their other building south of the HQ or the southeastern building (I forget the name) but it is mostly covered with a Psy-field!
No longer! :)
! [LUA] 0 : [C ] on_door_is_open
! [LUA] 1 : [Lua] ...hi/s.t.a.l.k.e.r anomaly\gamedata\scripts\ph_door.script(95) :
! [LUA] SCRIPT RUNTIME ERROR
! [LUA] ...y\gamedata\scripts\tb_coordinate_based_safe_zones.script:339: attempt to index local 'who' (a nil value)
! [SCRIPT ERROR]: ...y\gamedata\scripts\tb_coordinate_based_safe_zones.script:339: attempt to index local 'who' (a nil value)
FATAL ERROR
[error]Expression : <no expression>
[error]Function : CScriptEngine::lua_error
[error]File : ..\xrServerEntities\script_engine.cpp
[error]Line : 191
[error]Description : fatal error
[error]Arguments : LUA error: ...y\gamedata\scripts\tb_coordinate_based_safe_zones.script:339: attempt to index local 'who' (a nil value)
stack trace:
Transition from Garbage to Cordon, near the farm. Some fights between bandits and loners and then this crash.
Oh bugger! Thanks so much for posting this... on it now!
I've reuploaded v1.3 for the time being, it will be safe to downgrade from v1.4.
I should spend more time testing!
Sorry for the crash!
I loaded up my save and teleported to The Farm in Cordon, spawned in lots of bandits and stalkers, and it did crash!
It was because when they open the doors on The Farm buildings, the function to check NPCs and players using physics objects is sometimes buggy and returns rubbish data.
I have made a change to my script and tested again with another war at The Farm, and it didn't crash... fingers crossed this has solved the problem!
Not sure if it comes from this Mod or its a conflict with some other Mod but for some reason i don't get any more the Symbol on the Mini map where are the save place
Hi! I've just tested this now and the symbols are working for me, both on the PDA and on the mini-map.
Please can you save the game and load again to see if this fixes the problem? Thanks!
i have install 2 Days ago your Mod and Moddb.com this one for minimap to see all better and Moddb.com this as Hud at the same Time from there i have play now 2 days.But i don't get any more the Save Zone symbol even after a new start/reload.So real im not sure if this Mod have a conflict with one of the 2 Mods or 1 of the 2 Mods make such a change or the Problem come from your Mod :). I get all the Message and Quest text go to a save place and when im there now stay sheltered and so on but no symbol on Minimap or PDA for save place.
That is very strange. I just installed both 'SquareDOV' and 'SidHUD' and tested with my addon on my own saved game.
The symbols are working for me, on the square mini-map and on the PDA map.
I'm very sorry, I don't know why the icons/symbols are not appearing on your maps. Maybe another addon you have installed is conflicting? :(
Cant believe nobody thought of this sooner! Great job :)
Heh, thanks! I started with using objects all over the place, but then thought no wait... just use the coordinates in the levels, they don't change! :D
Very good mod mate, saved my life. By the way, are there mod incompatibilities here? Like conflicting mod?
Glad to be a lifesaver :)
No addon conflicts to my knowledge so far.
I'm not sure what the outcome was of GladiusVictorius' issue a bit further up the comments.
The only thing I can think of is if they use an addon that changes the 'map_spots.xml' (this addon uses the "secondary_task_location" map spot icon) or the 'ui_actor_hint_wnd.dds' image (which stores all the different map icons), but they haven't posted anything further.
Keep adding more locations! This is something that's been needed for a long time. I miss the days of being able to hide in the concrete pipes and many other places to stay alive. Also might try to find ways to make tuck cemetery less of a death trap?
I agree! Although, I am leaning towards places that could properly shielded from the blast. A pipe, having two open ends, might not be the best place. Unless it was facing directly East-West as I think the blast always comes from the North, I think?
Is near Lab-X18 Building Included?
I've only just checked, it looks like the building around X18 in Dark Valley is safe, though I will add the building to the south of there.
Also, in The Outskirts, I will add more of the building around X8, only the middle rooms in the centre are safe.
I found a few new places in Outskirts to add also for the next version :)