Fallout 2 mod FO2 Engine Tweaks (Sfall)

What I ment to say is: this bug with sfallgv.sav is present in about any Fo2 and or conversion there is. that's why Vad made a separate button to save sfallgv.sav file. it doesn't get saved, normally when you save all the other stuff. Nothing to worry about.
Though as I said Phobos2077 helped Vad solving the sfallgv.sv problem in the latest F12se builds. So it's an issue of older F12se buids only. and if You don't want to mess with antivirus warnings, You should stick to whatever version of F12se you have currently.
OK: "There's no error. F12se just can't read sfallgv.sav correctly."

Sorry, I didn't pick that up from the text. My bad.

Something else:
Was experimenting with SPECIAL, killap's hintbook script and "stuff" in WM2 (using Sfall 4.3.7) and the second Dermal upgrade reduced CH by -2. I disabled sfall and it was only -1.
Only difference I can tell is that sfall now adds a rank after the Dermal (2), maybe a side effect...?
Same applies for the other one, the Phoenix one. Same thing. -2 w/ sfall, -1 w/o
...
Should be an error, unless this is on purpose, but I checked the sfall readme and I found nothing. And I think, a balance fix like this would be mentioned.
 
I tried adding the perks with save editor or doing the surgeries in-game in RPU, each of the "enhancement" combat implant reduces CH by 1 as they should.
 
@Nova i think the Bug that Muttie wrote about is related to Wasteland Merc mod only. Since wasteland Merc was designed b4 any sfall saw daylight, i think it has it's own way to handle the oprations, a.k.a by scripts, and sfall does this by engine, and hence when one applies sfall to wasteland merc you get double -1 CHA penalty, hence the -2 for a single enhacment operation. It houldn't be a big deal though, one can have up to 10 operations per special stat in Wasteland Merc mod. the only limiting factorsa for them is getting ahold of the correct chip module, and having enaugh caps.
 
@NovaRain Thanks for checking.

Had another look and apparently it is a script bug that gets enabled by sfall.

This is the code
critter_rm_trait(dude_obj, 0, 76, 1);
critter_add_trait(dude_obj, 0, 77, 2);​
And the error is to set the added trait to rank 2 (should be 1).

However, this does work out fine with the original engine (i.e. sfall disabled) but not with sfall (which adds a rank (2) to the perk name and reduces CH twice, but still only gives +10% DR (because hardcoded?)).

It's never easy, is it? I thought once disabling/enabling sfall it's clear cut.

Anyway, it needs to fix the script, but considering that sfall enables the bug, maybe there is room to handle it better? (especially considering that it seems the rank influences CH decrease, but not the DR increase). But that's as it may be, the issue is with the script (eventually), but the original scripter didn't do anything wrong really as it must have worked when they did it. Can't blame them for not spotting that.
 
v4.2.1
>Fixed critter_add/rm_trait script functions ignoring the value of the 'amount' argument. Note: pass negative amount values to critter_rm_trait to remove all ranks of the perk (vanilla behavior)
critter_add_trait(who, trait_type, trait, amount)
Before 4.2.1, calling "critter_add_trait(dude_obj, 0, 77, 2)" is the same as "critter_add_trait(dude_obj, 0, 77, 1)", which only add one rank of the perk.
And yes, the DR bonus is hardcoded in the engine, which only checks if player has the perk.
 
Here is another weird one:

WM2 sets the Alien Warlord to have a base HP of 50.000.
In game this gets reduced to the max of 999.

However, the current HP stays at 50.000 when using sfall (4.3.7) but gets reduced to the max of 999 when disabling sfall.

This is sfall hitting the warlord for 2584 damage, which only reduces it down to 999/999 (however, that's vanilla behaviour):
upload_2023-8-8_0-33-14.jpeg


This is w/o sfall hitting the warlord for 60 damage. So it truly is set to the max of 999 and not just a visual bug.
upload_2023-8-8_0-33-19.jpeg


So it seems sfall enables current HP to be above the max (if the proto is set as such), while the vanilla engine does not.


If you need a quick test, here is the WM2 game I was using: https://easyupload.io/bh3o8h
(full game, I only removed critter.dat and master.dat, the save is 09 (called DoubleChecking; ready to go to the Lair) another is under 02 (called Test; just about to face the Warlord; which was loaded w/o sfall so it has 999/999 HP)). Both saves were made w/o sfall.
There is also a Dev Room which allows to get to any point in the game, but I'm not sure how easy that is w/o knowing how WM2 works... anyway, you can quickly check the HP by just toggling sfall, load either save (2 or 9), exit map, enter Lair and check the silver alien. Should adjust as above.

Special Note: The build is currently using the original proto files, which adjust base HP, so you can make them glitch by giving the Warlord beer (resets HP to 999/43). That's how I tested if vanilla behaves the same as sfall, and it does (any damage > 0 and it drops to 43/43), so it seems, the only difference is the disabled max check for current HP.

Anyway, not sure if there is a reason or anything, I was just surprised that the 50k HP is a sfall thing. While vanilla seems to cap it correctly...
 
I bashed my had against this for the past four days.
These are my notes, maybe something is interesting.

[transfer_pid_between_objs]
[transfer_all_pid_between_objs]
[remove_pid_qty]
-can detect all items (inventory, handslot, worn).
-but only move what they can find in inventory and ignore the rest (handslot & worn) (bug).
-if nothing is in inventory it will remove a single item instead. The order to select this item is: handslot item1, handslot item2, worn. And last: (oddity: picked up items*). If this happens it (may) remove the item incorrectly (bug). That means it may not clean up animation (weapon & armour; minor bug) and may not reset DT/DR (armour; bug).
*ODDITY: an item (or items) dropped to the ground and picked up again, are not part of the inventory until opening/closing inventory. So in the case of the bug the engine will check handslots and worn first, and the picked up items last. [note: only if the picked up items do not already exist in inventory. If they do, the picked up items get added to that stack and removed with it. But if it's a new stack, the whole stack of items is in “limbo”. Until opening/closing inventory.]
**ODDITY II: This is more vague, but it's possible that an item moved from handslot to inventory via [
inven_unwield] will enter the same limbo state as the picked up item.
I did run [
inven_unwield] before [remove_pid_qty] and it would put the item in limbo, but when I used [rm_obj_from_inven plus add_obj_to_inven] instead [inven_unwield], it didn't. May have been bad scripting on my part. Used this:
if (critter_inven_obj(dude_obj, 2) or critter_inven_obj(dude_obj, 1)) then begin
metarule
(43, dude_obj);
end
which does unwield but may not do it correctly... not sure. Anyway, [inven_unwield] may be another potential case.

Btw, I also tested this w/ [rm_mult_objs_from_inven] only, see AcMorlis.int (node007). She wants three Healing Powder and you can hide two on your handslots.
[You can also test the pick up limbo with her: Put one powder on handslot and drop the other two. Then pick the two up again. And deliver. And it will only remove the one from handslot.]

Tests done w/ sfall 4.3.7. And confirmed w/o it. This should all be vanilla behaviour.

Fixes:
-The first [incorrect removal] can be fixed by adding a "proper" [remove_armor] and [inven_unwield] check into the code.
[Notes: The transfer command misses it entirely. The check in [remove_pid_qty] uses self_obj for [critter_inven_obj] (instead of who_obj) so it does not adjust to dude_obj. This creates a bug w/ [remove_armor], i.e. it removes the armour but does not reset DT/DR or clean up animation.]
Note: may also use [rm_obj_from_inven] or [move_obj_inven_to_obj] which do this [i.e. unequip] correctly, and w/o any addition to the code.

-The second [ignoring items on handslot and armour]... I only managed to fix with this:
#define remove_pid_qty_proper(who_obj, the_pid, pid_qty)
counter := 0; \
while (counter < pid_qty) do begin \
restock_obj := obj_carrying_pid_obj(who_obj, the_pid); \
rm_obj_from_inven(dude_obj, restock_obj); \
destroy_object(restock_obj); \
counter := (counter + 1); \
end
And
remove_pid_qty_proper(dude_obj, PID_COMBAT_ARMOR, 5)
scr_return(1);​
Which seems to work so far.

-The limbo thing is beyond my scope.
[Notes on behaviour: when using the loop it only results in unnecessary stripping (i.e. it removes handslot & worn first and “limbo” item last). With [rm_mult_objs_from_inven] it results in removing only a single item again (i.e. it can't find an item in inventory). Example, I can have 5 combat armour, put one on handslot, drop the other 4, pick them up again, deliver and only lose the one on handslot. However, using the loop can fix this.]

Should this be fixed yes/no?
I'm not really sure... [rm_mult_objs_from_inven] allows to transfer items from one NPC to another w/o wiping their equipped gear. Which could be useful. [Of course if wanting to move all it would need a workaround then...]
However, regarding the dude I can't think of a case where the equipment should be untouched. In most cases that results in buggy behaviour (like the old "dropping items from barter" trick).
A technical issue is that hiding items on handslot & worn has a range of X + 3. Example; I need to deliver 5 Combat Armours. I can put 2 in inventory, one on each handslot and wear the 5th.
That said, maybe [rm_mult_objs_from_inven] could get an extension of:
if dude then, if items on dude => qty and < qty +3 then, loop to remove items one by one... not sure if this makes sense (or just loop always?), but in theory that would not create wrong behaviour i.e. strip the player unnecessarily [unless there is a limbo item].
Idk, may be a starting point.

Personally, I'm not sure yet, I don't think LH (for example) should replace any check with the loop, I'd rather have sfall fix that. But for WM2 I may consider to use it, as I like that the mod works w/o sfall and I'd like to maintain that (if possible), but it would mean to rebuild every single request script.

Anyway, [summary]
-[rm_mult_objs_from_inven] not removing armor & weapons correctly, script error. [i.e. use correct unwield and/or the correct [rm_obj_from_inven].]
-[rm_mult_objs_from_inven] not touching equipped gear, engine error. (esp. for the dude) [loop can fix it]
-Unable to find items in limbo (Object Pointer?), engine error, probably. (allows to reduce any "hand in" quest to a single item if it runs [rm_mult_objs_from_inven] w/o loop fix.)

The easiest to confirm this is w/ AcMorlis, should work in 1.02d and RP 2.3.3.
Using 1.02d has the benefit of toggling sfall. Almost anything else nowadays stops working the moment you disable sfall.

That's all. The tests on the last day had become very consistent and predictable. So, I think I'm done with this... then again... idk, there is always something.
 
So, I think I'm done with this...
You could create issues on github for each of things you find. It's hard to discuss when you dumped a lot of various issues as one pile.

Personally I used a lot of the inventory opcodes without much trouble. You need to understand how inventory in the game works, some things are not intuitive. If something doesn't work as you want it to, there's always some workarounds you can script. If there's really something that can't be done with scripts, then by all means - post an issue, or maybe try to contribute some fix.
 
sfall 4.4 and 3.8.40 are released on SourceForge, along with their respective modders packs.
Changelog said:
v4.4
>Implemented a mods_order.txt to improve and simplify mod ordering and add support for mod managers. This replaces previous .dat file autoloading. Please refer to ddraw.ini for details
>Implemented a custom config file parser, which greatly improves the performance of sfall initialization and reading files from scripts
>Item highlighting and NPC combat control mods are now packed into sfall.dat resource file, and sfall-mods.ini is moved to <GameRoot>\mods\
>Fixed a bug when updating the maximum HP stat of critters on the map when loaded for the first time
>Fixed set_pc_base/extra_stat and set_critter_base/extra_stat script functions not updating derived stats when setting SPECIAL stats
>Fixed wield_obj_critter script function, which can now put non-weapon/armor items in the critter's hand
>Fixed get_tile_fid script function to work on elevations 1 and 2 instead of always elevation 0
>Fixed create_spatial script function not setting the script index number upon object creation
>Fixed incorrect behavior of the subtraction operator involving floats and negative integers
>Fixed the backward compatibility of get_npc_level script function
>Fixed a crash bug in display_msg and debug_msg script functions when printing a string longer than 260 characters
>Fixed a crash bug in AMMOCOST hook when returning ammo cost of 0 for burst attacks
>Fixed various issues in script compiler and decompiler (compile.exe and int2ssl.exe in the modders pack)
>Improved item highlighting mod to handle the line-of-sight check properly when the player is moving while holding down the key
>Improved and tweaked the behavior of ComputeSpray_* options
>Expanded atoi script function to support parsing binary strings
>Expanded string_format script function to support more arguments and conversion types
>Changed CheckWeaponAmmoCost to be enabled by default and affect only hook type 1 of HOOK_AMMOCOST hook script
>Changed how HOOK_DESCRIPTIONOBJ hook script handles its return value. Now you can return normal strings directly in the hook
>Re-added the check for valid objects to get/set_object_data script functions (only disabled in combat for accessing the combat data)
>Removed the debug message about a missing critter art file from displaying in the game (added in 4.2.2)
>Added options to override the names of sound files used by the engine
>Added an option to item highlighting mod to highlight critters with the same rules as in combat, and changed CheckLOS to be enabled by default
>Added a debug option to duplicate logs to a dedicated console window alongside the game window
>Added a lower limit of -99% and an upper limit of 999% to the hit chance value to prevent a display issue
>Added more options for tweaking some engine perks to the perks ini file
>Added a new argument and a new return value to HOOK_STEAL hook script
>Added a burst control example script and a resting encounters mod to the example mods in the modders pack
>Updated the compute damage example script in the modders pack. Now it should be easier to write one's own damage formula
>Increased the setting range of the combat speed slider in the preferences screen
>New script functions: set_spray_settings, get/set_combat_free_move, get_ini_config, string_find

Important changes in 4.4:
  1. The newly implemented mods_order.txt replaces previous .dat autoloading mechanism.
    (PatchFileXX options in ddraw.ini's [ExtraPatches] section are still honored.)
    If you only update sfall for your current RPU/TCs decked out with mods, nothing will change. Because if the txt doesn't exist, sfall will try to initialize a new one with your current mods setup. The catch is when you want to install a new mod after that, you have to add the mod to mods_order.txt. Currently EcCo and EtTu beta/development versions have already utilized mods_order.txt.
  2. The two basic script mods, gl_highlighting.int and gl_partycontrol.int, are now packed into sfall.dat, and their config file sfall-mods.ini is moved to the "mods" folder. If you update sfall for your games, make sure to remove sfall's old gl_highlighting.int and gl_partycontrol.int from your data\scripts\ folder, and migrate your settings to the new sfall-mods.ini in the "mods" folder.
 
I think backwards compatibility on this one is broken? At least I tried to run it on xpsp3.

Edit: that said, maybe I just need to install a newer msvc redist. I'll try that later
 
Last edited:
I think backwards compatibility on this one is broken? At least I tried to run it on xpsp3.

Edit: that said, maybe I just need to install a newer msvc redist. I'll try that later
Thanks for the report. Yes, 4.4 crashes on startup on XP/2003, there will be a hotfix release later.
 
I tried Fallout 2 modding.
Compiled some simple INT file. How do I integrate it into game now? There is no /Data/scripts folder in my GOG version of the game. I have read multitude instructions on the internet and tried them all but nothing makes my compiled script recognized by the engine.

Is there a way to plugin INI file into installed sFall?
 
I tried Fallout 2 modding.
Compiled some simple INT file. How do I integrate it into game now? There is no /Data/scripts folder in my GOG version of the game. I have read multitude instructions on the internet and tried them all but nothing makes my compiled script recognized by the engine.
Did you try this guide? https://f3mic.github.io/

You can create data/scripts folder if it doesn't exist. But the more "modern" approach is to create a subfolder in mods/ folder like mods/mymod.dat and place scripts folder inside it. Then, if you use sfall 4.4 or higher, add it to mods_order.txt.

Is there a way to plugin INI file into installed sFall?
What do you mean exactly?
 
That is a good idea. Thank you.

I tried the guide you mentioned and this one and others but none tells how to properly deploy/install them onto the game and not within the modding environment only.

When you tell about create directory do you mean structure like mods/mymod.dat/scripts/ACKLINT.int ?
(I am trying to modify a simplest script by this manual).
I tried your technique and it didn't pick it up. Should I probably convert INT into DAT?
 
When you tell about create directory do you mean structure like mods/mymod.dat/scripts/ACKLINT.int ?
(I am trying to modify a simplest script by this manual).
I tried your technique and it didn't pick it up. Should I probably convert INT into DAT?
Yes, the path is correct. But make sure that it's actually loaded by whichever sfall you're using. If you use the one that comes with EcCo 0.9, you need to add "mymod.dat" to mods/mods_order.txt file.

Should I probably convert INT into DAT?
No, script should be picked up if it's in scripts folder. Try "<fallout_dir>/data/scripts/acklint.int". Also make sure data_patches path in fallout2.cfg points to a data folder.
 
Hello. I am using the sfall to achieve some stuff and I've come across issues which I don't know how to solve. I would appreciate any help on these:
1) While traveling on worldmap, the outdoorsman skill can give you option to avoid the random encounter. Is there any hook to modify this? Or completely cancel it? Simply force player to visit the random encounter?

2) Can I change the AP cost when using some misc item? Stealth Boy for example, but that way that the new cost appears on the interface correctly?

3) Can I somehow stop player or NPC from moving during fight? I tried changing the AP cost through movecost hook but it doesn't work. The player moves despite it shows he can't.

Thanks for any help.
 
1. try HOOK_ENCOUNTER.
2. HOOK_CALCAPCOST, for those toggleable items you need to check both normal and "active" PIDs.
 
1. try HOOK_ENCOUNTER.
2. HOOK_CALCAPCOST, for those toggleable items you need to check both normal and "active" PIDs.

Thanks, HOOK_CALCAPCOST actually works, I didn't even try it coz the documentation says that "Runs whenever Fallout is calculating the AP cost of using the weapon (or unarmed attack). Doesn’t run for using other item types or moving."

The HOOK_ENCOUNTER doesn't really do what I need. Or maybe I don't know how to use it. I tried it in combination with force_encounter() but that just makes me appear on empty map. I guess there is no way to force a player to enter random encounter.
 
Back
Top