Fallout 2 mod FO2 Engine Tweaks (Sfall)

I added an sfall request just in case it happens to be easy to implement:

From JtD: Could the secondary unarmed attacks be optionally made available at the start of the game? I would like to make secondary attacks things like sweeping kicks that sacrifice damage for more chance of knockdown, or grapple attacks that increase chance of disarms.
 
Really sorry for spamming this thread, but I have another request that might be easy to fill. Given that it's probably not going to happen that we'll ever have a hs_use_skill hookscript to change how completely and utterly borked Fallout's "keep spamming skill x until succesful or bored" system is, could some skills simply be deactivated to bypass them entirely and implement your own approach? Specifically, I'd love to disable First Aid and (especially) Doctor: being able to easily heal a crippled leg with minimal Doctor skill by simply repeating the action a couple of times is just so incredibly terrible. I'd love to make my own Doctor skill with a key press that makes succes determined by the healer's Doctor skill and the patient's Endurance/Current HP.
 
Really sorry for spamming this thread, but I have another request that might be easy to fill. Given that it's probably not going to happen that we'll ever have a hs_use_skill hookscript to change how completely and utterly borked Fallout's "keep spamming skill x until succesful or bored" system is, could some skills simply be deactivated to bypass them entirely and implement your own approach? Specifically, I'd love to disable First Aid and (especially) Doctor: being able to easily heal a crippled leg with minimal Doctor skill by simply repeating the action a couple of times is just so incredibly terrible. I'd love to make my own Doctor skill with a key press that makes succes determined by the healer's Doctor skill and the patient's Endurance/Current HP.

Every possibility need to be researched. Currently I don't have time for sfall, but I can give you my IDA Pro databases for Fallout2.exe and Mapper2.exe (even mapper code with all debugging information is 70% obscure, so you will have to deduce things). You could at least learn how stuff works and find easy opportunities for hacks if there are some. You need to learn x86 ASM basics (if you don't know already), learn how to use IDA and then you're set :)
 
Hey phobos, found one more removeinvenobj reason to add to your modderspack header file:

#define RMOBJ_THROW_REPLACE 4686256

this gets called after the RMOBJ_THROW one if the critter has another throwing weapon that gets immediately added to the active hand.
 
Here's sfall SVN builds, r305 (3.4.1.305): https://www.mediafire.com/?112wy6qlkzhqfcy

For the changes since the official sfall 3.4 (r295), please refer to SVN log.
(BTW, I'm now using VS2013 for compiling.)

The archive includes four DLLs:
  • the one in the root directory of the archive - normal sfall for WinXP SP3 or later.
  • trace - the debugging version.
  • win2k - for Win2000 and WinXP RTM/SP1/SP2.
  • win2k_trace - the debugging version for modders on older OSes.
The included ddraw_adv.ini has almost all settings recognized by sfall. The only settings not included are debugging settings (they only work with debugging DLLs), main menu offsets (currently only useful for FO1 to FO2 conversion) and NPC combat controls.

In r303, there are two new options to adjust the speed of combat/dialog panel sliding animations, thanks to TeamX member Tehnokrat:
Code:
;Controls the speed of combat panel animations (lower - faster; valid range: 0..65535)
CombatPanelAnimDelay=1000
;Controls the speed of dialog panel animations (lower - faster; valid range: 0..255)
DialogPanelAnimDelay=33
Try not to set the values too high, unless you want to wait nearly 50sec for combat panel opening/closing (CombatPanelAnimDelay=65535) :P
 
Last edited:
.. being able to easily heal a crippled leg with minimal Doctor skill by simply repeating the action a couple of times is just so incredibly terrible.
There's that "tired" status appearing after three successful attempts, which makes another attempt to use the same skill forbidden for short period of time. Perhaps enabling this tideness even for three unsuccessful attempts wouldn't be a bad idea too, if that's possible.
 
report on new features

I have added some features and improvements to both compiler (sslc) and decompiler (int2ssl):

Here's a brief changelog for sslc:
Code:
- completed namespace compression optimization with respect to imported/exported variables
- changed 'for' and 'foreach' syntax to allow parentheses which are easier to read IMHO
- heavy code refactoring - split "parse.c" into several files, replaced all dirty workaround code in "lex()" (some syntax features) with parser-level equivalents
- added syntax to reference elements in multi-dimensional arrays (unlimited sequence of brackets [] and dots . )
- added fully featured "break" and "continue" statements for loops

For int2ssl: it was updated to respect "break" and "continue" statements and also some nasty bug was fixed (when using "if" statement as the first statement in "else" block, it produced incorrect code).

Documentation on new syntax was written and will be included in next sfall_modderspack.


Also some new possibilities for sfall global scripts were implemented:

1) You can now safely pass values between global scripts and all other kinds of scripts using "export", "import". Variable export is a feature of original Star Trek language and used in almost every map script in the game. The problem was that if you export variable from a global script, it will be removed at next map change (the reason of this - all "vanilla" script types - map scripts, objects, spatial, etc. - have their life-cycle tied to specific map. when you exit the map, all scripts are removed from memory along with all exported variables; this conflicts with logic of global and hook scripts - they "live" until you re-load the game). Now variable exported from global or hook scripts will be "alive" and available for import in every other script (but you must "export" those variables in global/hook script only!).
While this doesn't really add new abilities for scripts, it helps to make your code as well as user savegames cleaner (not using sfall globals in cases you don't really need them)

2) New function "register_hook_proc" allows to "attach" specific event (hook script) to specific procedure in a global scripts. You can attach several different hook scripts to a single global script, which allows for better mods modularity (one mod can contain all it's logic in a single independent script).

3) New hook scripts:
- hs_keypress - triggers when any keyboard key was pressed or released (args - key code, pressed state)
- hs_mouseclick - triggers when mouse button state changed (args - button number, pressed state)
Along with (2) you should be able to make *proper* hotkeys in mods (I'm looking at party orders addon...)

4) Requirement to define "start" procedure as first procedure in you script is gone (for both global and hook scripts), sfall will find those wherever they are ;)
 
Last edited:
Not intended to be offensive, but I'm wondering why you work in the direction to improve ssl.
Why not add a modern script VM alongside with ssl, or even get rid of ssl?


VM => Native is 200-ish APIs, and signatures are regular.
Native => VM callbacks are quite few.
Plus one or two pair of epilogue/prologue to handle ABI changes, all global/hook scripts can run in new VM.


To remove .int scripts:
Since you have worked on both compiler and decompiler, it shouldn't be difficult to translate .int to other script language.

The only tricky thing(s) I could think of, is due to that .int scripts are embedded in map.
But I feel that it should be possible to simply hook all .int scripts and load corresponding new scripts.
 
I was wondering, would it be possible to add "to the power of"? I know square root is included, but I'd like to do a cube root as well, so being able to do x^(1/3) would be quite nice (unless it's already included of course; I tried using ^ but it didn't seem to work).
 
The only tricky thing(s) I could think of, is due to that .int scripts are embedded in map.
But I feel that it should be possible to simply hook all .int scripts and load corresponding new scripts.
Well, I see no point integrating another scripting language since we don't have actual engine to properly do it (just a shitload of machine code). And we've got falltergeist incoming, which should have proper language, but that's future :)
The real reason behind SSL improvements is.. well, just for fun. I've had a course on compilers theory just recently and couldn't stop after I've done it :)

.int scripts are not embedded in maps, they are referenced by script IDs (line number in scripts.lst). You could decompile all scripts into other language, but the problem is that those scripts won't be readable. Scripts use macros extensively to the point where pure decompiled code is meaningless or too complex (which kind-a kills modding of the original game). Of course you could use those in global scripts, but you will still be limited to those opcodes.


I was wondering, would it be possible to add "to the power of"? I know square root is included, but I'd like to do a cube root as well, so being able to do x^(1/3) would be quite nice (unless it's already included of course; I tried using ^ but it didn't seem to work).

Well it should be pretty straightforward to do, if it's not there already. I might add it later.
 
Well, I see no point integrating another scripting language since we don't have actual engine to properly do it (just a shitload of machine code).
the broken FO VM <=> ABI handler <=> Native(C etc.) binding <=> whatever non-trash script language
But well, if the FO VM is so broken there is no generic ABI, then it's indeed pointless to embed another script VM.

And we've got falltergeist incoming, which should have proper language, but that's future
I never heard of it before :shock:

.int scripts are not embedded in maps, they are referenced by script IDs (line number in scripts.lst).
Thanks.

You could decompile all scripts into other language, but the problem is that those scripts won't be readable. Scripts use macros extensively to the point where pure decompiled code is meaningless or too complex (which kind-a kills modding of the original game). Of course you could use those in global scripts, but you will still be limited to those opcodes.
The problem of (sfall) SSL is that, as a language it is too much broken, or too much under documented.

1. Type system features no doc.
how to explicitly convert between types is unknown;
weird APIs signature, e.g. set_sfall_global/get_sfall_global;
there appears to be no type check, neither compilation time nor runtime.

2. No global function, or function export/import.

3. Broken control flow.
For example, logical operator is not early-out. (expression [[cond or crash]] always crash)

and more
 
1. Type system features no doc.
how to explicitly convert between types is unknown;
weird APIs signature, e.g. set_sfall_global/get_sfall_global;
there appears to be no type check, neither compilation time nor runtime.

2. No global function, or function export/import.

3. Broken control flow.
For example, logical operator is not early-out. (expression [[cond or crash]] always crash)

and more

1. What doc do you need? SSL is dynamically typed, there ARE (original interplay) docs which explain how implicit type conversion works. There are no explicit conversion, and there is no need for it IMO, only 3 types total.
I agree some sfall functions are weird but that's only problem of particular functions, not the language.
2. There IS import/export. You can (theoretically) have a global script running with all global functions used by other scripts.
3. Totally agree with this. This could be fixed by compiler, but such change will be backwards-incompatible, so we have to stick with if (not(cond)) then if (crash)
 
Last edited:
myocytebd said:
Not intended to be offensive, but I'm wondering why you work in the direction to improve ssl.Why not add a modern script VM alongside with ssl, or even get rid of ssl?

I think any efforts along those lines would be wasted, as no one would use it. Those actively modding know the current system; I'm not interested in endless hours of additional studying to do something I can already do, and though I certainly don't speak for anyone else I think most probably feel exactly the same way.
 
Hi. Apologies if this has already been discussed, but I couldn't find relevant threads with the search function.

Is it possible to fix the bug affecting burst fire in Fallout2, whereby dead critters to obstruct burst fire as if they were standing up, so that if something is lying dead between you and your intended burst fire target, the corpse blocks most of your rounds, making burst fire useless in many scenarios? This bug has significant repercussions for Fallout2 combat, and fixing it would be a major improvement in the game. Interestingly enough, Fallout 1 doesn't suffer from it.
 
Last edited:
Hi. Apologies if this has already been discussed, but I couldn't find relevant threads with the search function.
Is it possible to fix the bug affecting burst fire in Fallout2, whereby dead critters to obstruct burst fire as if they were standing up, so that if something is lying dead between you and your intended burst fire target, the corpse blocks most of your rounds, making burst fire useless in many scenarios? This bug has significant repercussions for Fallout2 combat, and fixing it would be a major improvement in the game. Interestingly enough, Fallout 1 doesn't suffer from it.
Have you tried this setting?
Code:
;Adjust how corpses effect line of fire
;Set to 1 to apply the same rules to bursts as to complete misses
;Set to 2 to completely block corpses from absorbing fire
CorpseLineOfFireFix=1
 
Probably everyone already knows this, but I just found out a wonderful thing that you can do with sfall, PatchFile property in ddraw.ini can be used not only with a file name, but it also works with a folder!
For example, I have my mod which changes many files and must be installed on top of the Restoration Project, but also I want to make it easily uninstallable.
If I set

Code:
PatchFile=my_data
and create "my_data" folder, files in the folder will have precedence over both "master.dat" and "data" folder (which is defined in fallout2.cfg).

It is also more convenient for end users to see exactly which mods they have installed.

Anyway, in the next version of sfall there will be (along with previously announced stuff):
  • fully-featured power operator ^
  • a couple of math functions
  • changed behavior when multiple scripts registered to the same hook are using "set_sfall_return" - now you can safely return values in registered hooks, with some considerations
  • ability to completely customize how drugs work using updated USEOBJON hook script by overriding vanilla behavior and writing your own
  • ability to set AP cost for using items (including drugs) in inventory screen using USEOBJON/USEOBJ hook scripts
  • ability to change AP cost for using non-weapon items from the main interface using CALCAPCOST hook
  • ability to use Virtual Key Codes for keypress hook and key_pressed function (they are easier than DX codes, e.g. you can use if (key_pressed_vk('A')) - and it will work)
  • updated documentation on some of the functions, SSL language extensions, hook scripts

Latest build can be downloaded from the link in my signature, but don't use it in "production" yet!


Update:
  • added function message_str_game to get messages from MSG files in /game folder
  • added USESKILL hook that allows to override hard-coded handlers for using most skills
  • added STEAL hook that allows to override hard-coded handlers for stealing/planting individual items and forcing success or fail
 
Last edited:
Again, amazing work phobos, have had one question on my mind for a long while tho:

Why is it seemingly possible to trigger movement from a global or hookscript? If you put this in a regular script's critter_p_proc:


Code:
      foreach critter in list_as_array(LIST_CRITTERS) begin
            tile:=tile_num_in_direction(tile_num(dude_obj),random(0,5),random(1,3));
            animate_move_obj_to_tile(critter, tile, 1);
            display_msg("working");
      end

then everybody starts running around like crazy. However, put the exact same thing in a global script and all you get is the message repeated constantly and nobody moves. Any idea why that is and whether there's a way around it?
 
There is some additional check in some of the opcodes which fails on global scripts. Many functions don't work because of it, like roll_vs_skill, etc. I'm trying to fix it.

Edit: Fixed in latest revision. Finally some roll_vs_skill checks!
 
Last edited:
Back
Top