ProjectsWhat's NewDownloadsCommunitySupportCompany
Forum Index » S.T.A.L.K.E.R.: Clear Sky Forum » Mod discussion
Stalker Mod Change Script (Modify The Extracted Mod .ltx Files Automatically) - Discussion

« Previous 10 events | 1 2 | All Messages
Posted by/on
Question/AnswerMake Oldest Up Sort by Ascending
  19:30:17  4 June 2009
profilee-mailreply Message URLTo the Top
Don Reba
Bishop and Councilor of War
(Moderator)

 

 
On forum: 12/04/2002
 

Message edited by:
Don Reba
06/04/2009 19:31:17
Messages: 11605

---QUOTATION---
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.
---END QUOTATION---


Again, Smart Mod Manager computes the differences automatically. It seems to me, that you are solving a problem that does not exist.
  18:57:21  4 June 2009
profilee-mailreply Message URLTo the Top
JakFrost
(Senior)
 
On forum: 11/30/2008
Messages: 112
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.
  18:27:23  4 June 2009
profilee-mailreply Message URLTo the Top
Don Reba
Bishop and Councilor of War
(Moderator)

 

 
On forum: 12/04/2002
 

Message edited by:
Don Reba
06/04/2009 18:50:01
Messages: 11605

---QUOTATION---
I found that Smart Mod Manager would not integrate the existing mod files with certain mods that I played because it would only replace the entire file instead of just the relevant sections and values that were different causing a lot of crashes and headaches.
---END QUOTATION---

Your assumption that SMM replaces entire script files is incorrect. It does, in fact, always integrate changes, as you say it should. Frankly, the quality of integration leaves much to be desired, but it is getting better.

In version 1.10, SMM will include ModScript, which covers the functionality of your tool and more, but needs more feedback until then:

https://gsc-game.com/main.php?t=community&s=forums&s_game_type=xr2&thm_page=1&thm_id=20843&sec_id=22
  17:59:38  4 June 2009
profilee-mailreply Message URLTo the Top
JakFrost
(Senior)
 
On forum: 11/30/2008
 

Message edited by:
JakFrost
06/04/2009 18:01:22
Messages: 112
Download Thread: [link]https://www.gsc-game.com/index.php?t=community&s=forums&s_game_type=xr2&thm_page=1&thm_id=20922&sec_id=21[/link]

This is the discussion thread for this script.
 
Each word should be at least 3 characters long.
Search:    
Search conditions:    - spaces as AND    - spaces as OR   
 
Forum Index » S.T.A.L.K.E.R.: Clear Sky Forum » Mod discussion
 

All short dates are in Month-Day-Year format.


 

Copyright © 1995-2019 GSC Game World. All rights reserved.
This site is best viewed in Internet Explorer 4.xx and up and Javascript enabled. Webmaster.
Opera Software products are not supported.
If any problem concerning the site functioning under Opera Software appears apply
to Opera Software technical support service.