| 18:57:21 4 June 2009
On forum: 11/30/2008
Personal Need Spawns Creation|
(i.e. Necessity is the mother of all inventions)
I know that this script is quite late in the game for STALKER games since the development of many mods has slowed down or even stopped but I felt like I needed to write it for my own usage. I was installing and changing mods in my own STALKER games so many times and then having to manually use a text editor to make the changes that I wanted something automatic. I've wasted more time manually changing mod .ltx files than the amount of time it took me to create this script to do it automatically. I only wanted to change a few values in the files and not add more content to the game so I thought it was easier and faster to just change them manually, boy was I wrong after I started installing different mods and then updating those mods with new versions, every time losing all my changes and having to do them all again manually.
Monolithic Whole File Mods
I was also dissatisfied people releasing Mods by including the whole file in the distribution when they were only changing a few numbers in the .ltx files. I always thought that if you are going to change a few small things in a file and not really add more data then you could have done this but submitting a difference patch instead of the whole thing. However, most people are not familiar with .diff files unless they are developers or advanced computer users.
I understand that these mods are mean for casual gamers, who mostly do not know anything about advanced computer topics, and also do not want to bother with manually modifying files. It is hard enough to have them actually read any readme.txt files and then have them modify the "fsdata.ltx" file to set the "$game_data$" values to "true | true" as it is.
Shortsightedness For Ease
However, the modders who released their minor mods that only change numbers and release their own copy of the regular game file really became shortsighted since they didn't realize that other mods that provide new content would be using those same files and the files with the new content would have to overwrite the regular game files from the first mod. This made the minor mods completely incompatible with the new content mods, but they did not have to be incompatible if they only released the information about the lines that they have changed so that their minor mod could be applied on top of the new content mod.
Difference Engine That Could Have Been
My guess is that if I came across the game STALKER earlier and came across these problems I would have written my script earlier and then maybe convinced some of the minor modders to release their mods as data files for my script. I have a feeling that if that happened I would probably end up writing up a whole difference engine for STALKER LUA .ltx mod files or using an existing engine allowing mods to be quite modular, by only releasing data files with their own changes, additions, and modifications, so that mods could be merged one over another by modifying existing game files instead of replacing them whole. But it is too late at this point to work on this kind of an engine for these games, at least until STALKER Prypiat comes out and we'll see what kind of a script system that game will use.
Minor Modders Welcome and Encouraged
The script that I created is really fed by a data file that you can specify so if you're a minor mod maker, where you only like to change a few values here and there inside the scripts to change the game here and there then I encourage you to create your minor mod as a data file to my script so that your mod users can apply your mod to any other mod out there that might be using the same files.
I would probably encourage you to provide your mod as both, a single file that is compatible with the existing mod distribution format used here and also Smart Mod Manager, but also as a data file for this script so that if another mod already uses the same file as yours, you can instruct the user to download this script and apply your data over after he installs the other mod. It is a good way of ensuring that your mod users have a choice of using your mod if another mod conflicts with it because of the same file.
The data files are quite easy to create and you can use full Extended Regular Expression syntax for searching and replacing values inside the data file giving you a lot of flexibility in writing a single data like that would change hundreds of entries without having you hunt down and type in those hundreds of individual entries.
Data File Line Examples - Future-Looking and Forward-Compatible
One advanced example from my own Data File is the one that I wrote for limiting the number of grenades that spawn on new enemies. This single line affects half a dozen files, and dozens of entries inside those files. It is really a very efficient way of doing this.
You can see the wildcard "*.xml" entry to affect multiple files. Along with the Extended Regular Expression syntax "[^[:space:]]+" to affect any fields that start with the word "grenade_". This example means to select all characters that are not "^" space characters such as space, tab, vertical space, etc. So that it affects all fields such as "grenade_f1" and "grenade_rgd5". However, it would also apply to any other types of grenades that another modder might include in the game in his own mod such as "grenade_jumper" and "grenade_claymore" if you were applying this data file to a game that already includes another mod. This wildcard matching behavior is very flexible because it becomes future-looking and forward-compatible with other mods since you do not have to know exactly the names of other grenades that might be in those files, but you still really want the enemy to have a lot less of them.
STALKER-STCS;Grenades Less Available To Enemies;gamedata\configs\gameplay\character_*.xml;spawn;grenade_[^[:space:]]+;1, prob=0.1 \\n
A more powerful example of Extended Regular Expressions is the trader modifications for more ammo that I wanted to modify for the STALKER Clear Sky - Total Faction War mod that I played and enjoyed very much. The traders in the 0.6.9 version of this mod only had 1 or 3 boxes of ammo available and when I was playing the Freedom faction that users 5.56 NATO weapons I could never find enough ammo and could never buy enough to actually use those weapons, requiring me to convert my guns to 5.45x39 Russian so that I could at least scrounge up ammo from dead bodies since I also couldn't buy enough.
In the example below you see the section field that includes a pretty flexible and powerful wildcard match "supplies_(generic|res_[[:digit:]]+)". This match includes the very useful "OR" character "|" allowing the wildcard to applying to different sections that have the same "supplies_" prefix such as "supplies_generic" and "supplies_res_" while also including a wildcard match "[[:digit:]]+" to match all the "supplies_res_3" "_9", "_12", "_14", and "_16" sections all in a single line. This one line applies to half a dozen "trade_trade_*" files while making dozens of changes in each file itself. This is pretty flexible and powerful while at the same time being very easy and convenient for the modder since he only has to create one line to make all those changes to affect all the different files, and also easy for the user to implement since these changes are fairly future-looking and forward-compatible so that if a new version of the mod makes a few changes to the ammo lists that each trader provides this data file will still work correctly and apply the changes to those files also.
STALKER-STCS;Ammo More Available At Traders;gamedata\configs\misc\trade\trade_trader_*.ltx;supplies_(generic|res_[[:digit:]]+);ammo_[^[:space:]]+;100, 1.0
The two examples above demonstrate the power and flexibility of a non-monolithic system for implementing minor mods for users that are future-looking and forward-compatible across changes and updates to mods.
Minor Modders The Future Is Up To You
Since I'm pretty much finished with the current STALKER games and mods I leave this script and data files as an example for future minor moders for when the next game STALKER Prypiat comes out. If by some chance the new game users the same engine and LUA .ltx files in similar configurations as the previous games then this script might even be fully compatible with the future game as long as you include the proper Registry Key reference in the data file for the Game field such as I might guess "STALKER-PRIP" or something like that, and then just put in a reference to the other fields in the data file. Use this script as an example.
Future Improvements - Auto File Extraction for Missing Mod Files
One thing that I would like to see added is an automatic extraction function to this script so that if this script is processing a data file and it notices that the file to modify is missing that it could automatically extract the latest version of that file from the game DB files, place it in the proper folder in the "gamedata\" folder and then apply the mod there. That would be great but I would need tools to selectively extract specific files from inside the game DB folders. I don't believe that the current tools allow that, since I believe that they extract all the files from the DB files and do not allow single file extraction.