=====================================
*** Some Notes on Modding STALKER ***
=====================================

Author: NatVac, 2007/08/06, 09/28, 10/13, 10/17, 11/09

Please visit the Mod Discussions forum for questions and discussion about this mod and modding in general:

http://www.gsc-game.com/index.php?t=community&s=forums&s_game_type=xr&lang=en

STALKER (when fsgame.ltx is changed) will look first for external versions of its configuration and script files before defaulting to internal versions.  It is recommended that one extract the databases (gamedata.db0 - .db9, .dba, .dbb), in numeric and then alphabetic order, to a gamedata_source directory if you want to be serious about modding.  You can find a link to the tool in the "Getting Started" sticky topic in the Mod Discussions section of the GSC forum web site above.

Most simple modding stuff (config files, scripts) are found in gamedata.dbb, with the possible exception of config\misc\items.ltx (found in gamedata.dba).

This mod is an adaptation of those original files.

**********************************************************
First off:   Can other mods be used with this mod?

In many cases, yes -- but it has to be done on a case-by-case basis.  For example, weather mods like the Thunderbolt Remover mod are fine; there are no common files which might conflict.  The same goes for the Float32 mod, which solely resides in the shaders subdirectory.  Weapon texture mods like Siro's excellent reskins should not be a problem.

In some cases, even though there's no file conflict, the mod won't work well.  One example: changes to the game_relations.ltx file impact reputation, and may break the reputation fix in this code.  (Note: as of 1.03, there is a game_relations.ltx file included.)

Don Reba's Mod Manager might be all you need to merge the mods.  A file comparison tool like the open-source WinMerge program may also prove useful for determining the differences between mods.
**********************************************************

==================
What to Change Where:

All paths are relative to the <stalker_install_dir>\gamedata subdirectory.  Configuration files are usually found under the Config subdirectory in a corresponding category directory.

==================
Scripting and Troubleshooting:

The scripting language used by STALKER is Lua.  There is extensive online help for this language; see http://www.lua.org/ and http://lua-users.org/ for starters.

All the modification files are editable with Notepad or other text editor.

	Comments:
		.ltx files: To comment a line, put a semicolon (;) at the very front of the line.  To uncomment a line, remove the semicolon.  You can also add comments after data on a line:
			variable = data		;assign data to variable

		.script files: To comment a line, put a a pair of hyphens (--) at the front of the text.  To uncomment a line, remove the hyphen pair.
		
		.xml files: To comment a block of text, surround it with "<!--" and "-->" (without the quotes).

	Some debugging support is provided in scripts\_g.script.  You can uncomment the lines in the nvDebug() function to see how your reputation and faction relationships change in game.  You can use the dbglog() function to output statements that appear in the console and in the log file.

	**** If your game "locks up" ****

	You may be able to avoid hard lockups by using the -silent_error_mode command line parameter at the end of the target line in the shortcut you use to start STALKER.  The crash might still occur, but the game will simply exit to the desktop.  This is recommended even if you don't have hard lockup crashes.

	**** If your game crashes to desktop: ****

	The saved games and logs are on the C: drive by default in the STALKER-SHOC subdirectory.  In Vista this subdirectory is under \Users\Public\Documents while in XP this is found in \Documents and Settings\All Users\Documents.

	The latest error log, called xray_<your_user_login>.log* is under STALKER-SHOC in the logs\ subdirectory, while the saved games are stored in the savedgames\ subdirectory.

*<your_user_login> is usually your name, the one you see at the top of the menu when you click on the "start" button on the taskbar in XP.  If your user name is Robert, for example, then you would find a file named xray_Robert.log.

At the end of that file is usually a section that starts with "FATAL ERROR" and has lines beginning with "[error]".  These lines are useful in identifying most script and configuration errors.

==================
Optional Game Enhancements:

There are some files included in the distribution that are not used by the game.  Look in the directories for files with extensions like .normal or .alt1.  The .normal files return more of the original game to you if you wish to use them.  Less quests and the usual auto-quests, for example, when you rename task_manager.ltx.normal to task_manager.ltx.

The .alt1 files (config\system.ltx.alt1 and config\creatures\actor.ltx.alt1) must be used together, if used.  They give you slightly improved aim, 150/200 carry capacity, higher jump, less hunger, and a 10% longer reach.  Also, you might be fighting opponents that are 20% more accurate.  To use the files, remove the .alt1 extension.

***********************************************************************
                          List of Changes
***********************************************************************

Here is a list of the file changes over and above those done by bardak in his "Patch 1.0004 bug fix attempt" (also called the "bfa").

***********************************************************************
                          SPECIAL NOTE:

                 Most of these items are optional,
              and can be set via the Modifier program.
***********************************************************************

==================
Ammo

	The file config\misc\death_items_by_levels.ltx was tweaked to make AP ammo in later levels on corpses.  The NPCs can also use AP ammo against you when alive via the optional character_desc_xxxx.xml files, which you can copy from config\gameplay\optional\ to config\gameplay\.
	The file config\misc\death_items_count.ltx has been tweaked as well to set the range of ammo you will find.

	These two files are optional.  If you don't like the quantities on the bodies, just rename the files or edit them to change the values.

==================
Armor stats

	There is an optional file that tells you what the armor protection values are, before you put the suit on.  It is useful for comparing outfits before you buy.  It is currently only for the default values in the vanilla game, so if you want to use it, rename string_table_outfit.xml.suit_stats to string_table_outfit.xml in the config\text\eng\ subdirectory.

==================
Body removal time limit:

	See config\creatures\monsters.ltx and config\creatures\stalkers.ltx.
	CAUTION:  You can make the time limit shorter at any time, but you will likely need to start a new game if you want a longer body-stay time.  The game may otherwise crash when loading a level with entities that were killed while the old short limit was in effect.

==================
Debug code:

	There is some debug code which might prove useful to modders.  The on-screen code is located in the scripts\bind_stalker.script file, and is toggled on/off via code in the scripts\ui_main_menu.script file when the menu is displayed; see the OnKeyboard() function.  The <debug_task> definition for the on-screen display is in the config\ui\ui_custom_msgs.xml file.

	Press ESC followed by TAB while the menu is displayed to toggle rs_stats, and press ESC followed by D to toggle the on-screen data in the upper right.  Adjust it for your own needs.

==================
"Find Strelok" Mission Completion:

	Files:
		config\gameplay\tasks_escape.xml
		config\text\eng\stable_storyline_info_deadcity.xml
		scripts\db.script
	I commented out one objective and added an <infoportion_complete> section to another, to allow the task to be completed.  I am reusing an existing infoportion entry, one that was supposed to be used for the actual event -- before the Dead City level was cut out of the game.
	It's not perfect.  You have to exit from the level where you find out about Strelok in order to see the "Task complete" message.  Then you can look at your PDA for more info.  See the add_actor() function in scripts\db.script.

==================
Fire Immunity for NPCs (non-playing characters):

	config\creatures\immunities.ltx.  A 0.0 immunity means totally immune.  Note that this is probably no longer needed with bardak's 1.0004 bug fix attempt.

==================
Flashlight:

	The default flashlight is not adequate.  There are many replacement flashlights available.  If you are using jjwalker's Float32 mod, I understand that Ceano's flashlight is very good.
	A usable flashlight file is available in the mod to improve the flashlight if you don't have one of the mod flashlights.  To use it, rename or copy config\models\objects\light_night.ltx.zrp to config\models\objects\light_night.ltx.

==================
Gun Stashing on Death:

	Files:
		death_manager.script
		state_lib.script
		death_manager.script.normal
		state_lib.script.normal

	Compare these two sets of files for the differences between old default toss-the-gun-on-death behavior (the ".normal" files) and the new self-cleaning mortuary.  You can rename the newer scripts to end in ".nodrop" and remove the ".normal" from the other two to restore weapon drops.
	Destruction of tossed weapons worked in 1.0001/1.0003 but causes problems in 1.0004.  The workaround, transferring the weapon to the backpack as often as possible (not 100%) sometimes causes the script engine to complain a bit, maybe due to NPC injury making the weapon independent prior to death.  This does not affect gameplay.

==================
Head-Bobbing:

	To turn off head bobbing/view wobbling, rename or copy config\misc\effectors.ltx.no_bob to config\misc\effectors.ltx.

	To adjust the head bobbing amount, you can edit the config\misc\effectors.ltx file.  Look at the first three items in that file to see what to adjust.  Just delete that file to restore the original behavior.

==================
Lights in the ground - earlier "fix" removed

	The NPCs will take off their torches, but they won't turn them off, and the game leaves a light shining out of the spots where the NPCs originally spawned in the level.  These lights will go away when either the NPC turns on the flashlight again, or when the NPC dies.

==================
Main Menu:

	Files:
		config\ui\ui_mm_main.xml
		scripts\ui_main_menu.script

	To re-arrange the menu items, look at config\ui\ui_mm_main.xml.

	If you want the original "Quit to windows?" confirmation dialog, edit the scripts\ui_main_menu.script file and change the "local quit_without_asking = true" line to say "local quit_without_asking = false".

	Additional changes:  You can stop the animations on the main window by commenting out the lines that contain "back_movie" and "fire_movie" text in the function "main_menu:InitControls()".  Use double hyphens to comment out a line here, so that it looks like this:

    -- xml:InitStatic("back_movie", self)
    xml:InitStatic("background", self)
    -- xml:InitStatic("fire_movie", self)
    self.shniaga = xml:InitMMShniaga("shniaga_wnd",self);

==================
Music:

You can add to the bar music.  Compare scripts\sound_theme.script.ExtraBarMusic with the normal scripts\sound_theme.script file.  The extra songs are already in the game, although they play faintly when enabled at the moment.

==================
News Display Time:

	See scripts\news_manager.script.  The top of the file has a couple of variables that determine how long the news tips are displayed in the lower left (default is 5000 milliseconds) and how long the task announcement banners stay displayed centered at the top of the screen (default is 7 seconds).

==================
Nightvision:

	See the config\misc\postprocess.ltx.all_good_nv file.  You can rename it or copy it to postprocess.ltx to get good nightvision for all the suits that have night vision.  This is accomplished by changing the pp_eff_name assignment in the [effector_nightvision_bad] section.
	For the sounds, open config\misc\items.ltx and find the snd_night_vision_* entries.  Replace "weapons\nv_loop" with "ambient\silence, 0.0".  You can also change other sounds in a similar fashion.

==================
Quest Time Limits and Other Quest Management:

	The main change is to scripts\task_manager.script.  There are three variables at the top of this file that control task time limits and determine whether or not to display the potential rewards for completing tasks.
	Task time limits are in days.  Decimal fractions are permitted (e.g., 2.5).  A zero means no time limit.  When you change the limits, only future tasks will use the new limits.
	For general tasks, set the quest_days variable to the number of days you want to complete a task.  The default is 5.
	For auto-quest tasks (tasks given when you enter a level where the task can be carried out, like "Defend the stalkers" or "Protect border"), set the autoquest_days to the number of days you want to be able to complete the task and claim the reward.  It should generally be longer than quest_days because it might be out of the way to claim the reward.  Default is 0 (no time limit).
	The show_quest_rewards variable tells the game whether to display the rewards for completing tasks in the dialog box.  The default is "true"; set it to "false" (without the quotes) if you don't want to know what you'll get.
	Notes:  You can tweak the quests.  Set "need_return = false" for one-way quests, and set the reward_money to be the value you want.  Comment out any reward_item by prefixing the line with a semicolon.  "Prior" is only used on standard quests to determine when you will see that quest; lower numbered values are seen first.  If any previously-completed quest with a lower prior number than the next quest becomes active, it will appear before the next quest in the quest-giver's dialog.  Set the idle_time to determine the delay after a quest is completed before you see it again.  86400 = 1 day, 864000 = 10 days.

	There are two files included with different auto-quest behavior:
		config\misc\task_manager.ltx	-- some autoquests are regular quests
		config\misc\task_manager.ltx.normal
		
	Just rename task_manager.ltx to task_manager.ltx.changed_auto_quests or something similar, then rename the other to task_manager.ltx and you're ready to go on _new_ tasks.  Old tasks will keep the limits they had when you received them.

	Finally, if you don't want any autoquests, simply comment out this line in scripts\bind_stalker.script, in the function actor_binder:update(delta):

	task_manager.actor_update()

	To comment out the line, put two consecutive hyphens in front of the text, like this:

	-- task_manager.actor_update()


==================
Shotgun in first slot:

	Rename the file config\weapons\w_bm16.ltx.1st_slot to config\weapons\w_bm16.ltx to make the shotgun a slot-1 weapon.  Before you do this, unequip the shotgun in game (move it out of slot 2) and save.

==================
Sounds:

	I made changes to config\misc\script_sound.ltx to comment out the repetitive speakers.  The original forms are prefixed with semicolons to turn them into comments.  This is just a cheap hack.  Changed:
		[state_rnd]: bar_general, bar_dolg (general drunk chatter)
		[bar_bar_osvedomitel_hello_rnd]: bar_bar_osvedomitel (Snitch)
		[bar_guard_prohodi_seq]: bar_barman_guard2 ("Come in" Bar bouncer)
		[bar_dolg_hangar_bridge_hello_rnd]: dolg ("Get out of here, stalker!" guy)*
		[yantar_professor_talk_1_rnd]: stalker (Professor "Hello, hello" Sakharov)

	To change other sounds, open up config\misc\script_sound.ltx in a text editor.  Look at the bar_general and bar_dolg entries as examples of what to do.
		Voronin:  Change the bar_dolg_leader entry's 0 to 1 in the [state_rnd] section.
		Petrenko:  Change the bar_dolg_petrenko entry's 0 to 1 in the [state_rnd] section.

	The Pripyat background sounds are aesbattle1 and aesbattle2, in scripts\sound_theme.script.

	See the Nightvision entry for info on the sound there.

	You can reduce the volume of a sound in a configuration file.  By appending a ", 0.5" to the sound specifier, you can reduce the volume by half.

	See also:  Music

	*I healed this guy after a soldier wounded him.  We were already faction friends. Still he said "Get out of here, stalker!"

==================
Treasure Manager:

	Files:
		scripts\treasure_manager.script
		config\misc\treasure_manager.ltx
		config\text\eng\stable_treasure_manager.xml
		scripts\news_manager.script

	You can remove this line in the send_treasure() function in news_manager.script to keep the level abbreviation from showing in the history when you first get the secret:
			string.sub(name,1,string.find(name,"_s",1,plain)-1)..": "..

	You can show a secret's stash contents on the tooltip pop-up by uncommenting out a line in the function CTreasure:give_treasure().  You'll see how to do this when you look at the function.

	If you examine these files, you can see how to change the contents of new secrets.

==================
Weapons Changes:

	Files:
		config\misc\unique_items.ltx
		config\weapons\*.ltx  -- optional files
		config\text\eng\string_table_enc_weapons.xml

	The hunters_toz is modified to say "Hunting Shotgun" in the display, and to keep the weapon from being traded or stored via "quest_item = true" in unique_items.ltx.  There is a non-breaking space between "Hunting" and "Shotgun"; this saves having to make separate entries in the text files, although that can be done if you are converting this for another language.  This file is not otherwise needed for this mod.
	The ammo used by the default weapons is in the file config\text\eng\string_table_enc_weapons.xml.  There are also some typos and clarifications made there.  This file can be replaced by a Real Names mod file without problems.
	If you want the old 1.0001 binoculars behavior (held lower on the screen while equipped but not used), rename or copy w_binoc.ltx.old_position to w_binoc.ltx in the config\weapons\ directory.

	See also:  Gun Stashing on Death, Shotgun in first slot

==================
User Interface Changes:

	Files:
		config\text\eng\ui_st_inventory.xml
		config\text\eng\ui_st_other.xml
		config\ui\*.xml

	Some hard spaces were added in menu and dialog text to increase the "hot spot" of the text.

	The dragdrop_list and dragdrop_list_* items were tweaked in the other .xml ui files to make the grids show more items.

	Rename config\ui\events_new.xml if you don't want the Log/Message History link bar moved down.
	Rename config\ui\pda_events.xml if you don't want the Center-On-Player and Zoom link bar moved down.

