Fallout 2 mod FO2 Engine Tweaks (Sfall)

Is it customary to request more hooks or configuration to be added to sFall or it is all on the requestors? I am fine either way just don't want to invent a new process if one already exists.

Specifically, right now I am looking for following functionality/hooks:

SP awarded per level formula. It is not in Stats.ini now. Either adding configuration for it there or adding a level up hook which modders can intercept and override awarded SP should do.

Book functionality. Which skill each book affects and SP awarded computation. There is already Books.ini but it does not allow assigning multiple skills per book or select affected skill or calculate awarded SP amount, etc. The hook would be more flexible in this case.

Modifying derived stats on critters based on condition. There is CombatTurn hook but I am not sure this is the right place for it as these combat parameters are also accessible outside of combat as well.

Mass modification of items/critters parameters. I guess easiest way would be to do it in loop but when? At game creation, game load, in files? Are there any hooks for such global modification purpose?

Modifying drug effects. There is Drugs.ini but it reads "Note: for vanilla drugs, you can only override the values of NumEffect and AddictTime parameters". Any hook that I can use to customize it? UseObjOn can be used at use moment but how to control following timed effects?

Also I see Skills.ini uses the concept of "SP spent" in BasedOnPoints parameter. How does it work with skill advancement cost? Let's say initial skill 0% advanced to 125% for 150 SP (100 * 1 + 25 * 2). If BasedOnPoints=1 is it now at 125 cost thresholds based on 125% skill increase or at 150 cost threshold based on total SP spent?
Also how this "SP spent" or "skill advanced" values can be extracted in the script? Thank you.
 
Last edited:
Any way to guarantee mod execution order when they change same thing? Like if I want my mod to override everything else?
 
Is it customary to request more hooks or configuration to be added to sFall or it is all on the requestors? I am fine either way just don't want to invent a new process if one already exists.

I think the standard way is through this link:
https://github.com/phobos2077/sfall/issues

SP awarded per level formula. It is not in Stats.ini now. Either adding configuration for it there or adding a level up hook which modders can intercept and override awarded SP should do.
This is for modifying awarded sp per level:
https://sfall.bgforge.net/skills/#mod_skill_points_per_level
The formula btw is: (IN * 2) + 5
Book functionality. Which skill each book affects and SP awarded computation. There is already Books.ini but it does not allow assigning multiple skills per book or select affected skill or calculate awarded SP amount, etc. The hook would be more flexible in this case.
This can be addressed in at least 3 easy ways, which don't require any new functionality from sfall:
1. You can change the script of the particular book to add the skill you want.
2. You can change dude_obj script to add the skill points once you read a certain book.
3. You can use a use hook and check if the used item was a book, then giving skill points.
Note that some books, IIRC, have hard-coded behaviors, so you might want to create a new proto if you want to get rid of these behaviors.
Modifying derived stats on critters based on condition. There is CombatTurn hook but I am not sure this is the right place for it as these combat parameters are also accessible outside of combat as well.
What do you mean in "on condition"?
Is this what you are looking for? https://sfall.bgforge.net/stats/
Mass modification of items/critters parameters. I guess easiest way would be to do it in loop but when? At game creation, game load, in files? Are there any hooks for such global modification purpose?
https://sfall.bgforge.net/objects-and-scripts/
https://sfall.bgforge.net/other/
Check out proto_data and object_data
Modifying drug effects. There is Drugs.ini but it reads "Note: for vanilla drugs, you can only override the values of NumEffect and AddictTime parameters". Any hook that I can use to customize it? UseObjOn can be used at use moment but how to control following timed effects?
Pretty much same as books.
Also I see Skills.ini uses the concept of "SP spent" in BasedOnPoints parameter. How does it work with skill advancement cost? Let's say initial skill 0% advanced to 125% for 150 SP (100 * 1 + 25 * 2). If BasedOnPoints=1 is it now at 125 cost thresholds based on 125% skill increase or at 150 cost threshold based on total SP spent?
Also how this "SP spent" or "skill advanced" values can be extracted in the script? Thank you.
Dont know about the first part, but check out this:
https://sfall.bgforge.net/skills/
 
SP awarded per level formula. It is not in Stats.ini now. Either adding configuration for it there or adding a level up hook which modders can intercept and override awarded SP should do.
Use mod_skill_points_per_level script function.

Also I see Skills.ini uses the concept of "SP spent" in BasedOnPoints parameter. How does it work with skill advancement cost? Let's say initial skill 0% advanced to 125% for 150 SP (100 * 1 + 25 * 2). If BasedOnPoints=1 is it now at 125 cost thresholds based on 125% skill increase or at 150 cost threshold based on total SP spent?
It will be based on total SP spent instead.

Also how this "SP spent" or "skill advanced" values can be extracted in the script? Thank you.
Use get_critter_skill_points script function to get SP spent on a skill.
 
Last edited:
Thank you for response and sorry for my sometimes newbie questions.

This is for modifying awarded sp per level:
https://sfall.bgforge.net/skills/#mod_skill_points_per_level
The formula btw is: (IN * 2) + 5

Good stuff. However it is not entirely clear what it means by that.
"This is a modification of what would otherwise happen, rather than a replacement."
Does it mean that original value is passed to the function as parameter and then function may return something else if it desires?

This can be addressed in at least 3 easy ways, which don't require any new functionality from sfall:
3. You can use a use hook and check if the used item was a book, then giving skill points.
Note that some books, IIRC, have hard-coded behaviors, so you might want to create a new proto if you want to get rid of these behaviors.

Yep. I thought about this too as a last resort if Books.ini cannot do that.
Do I understand correctly that all hooks are replacing the original behavior? If not, does it happen before or after?

RE: drugs
Pretty much same as books.

Err. The problem with drugs is that they have delayed effects. I can surely hook their usage but how do I hook time delayed events?

Dont know about the first part, but check out this:
https://sfall.bgforge.net/skills/

Unfortunately, there functions do not answer "how much SP was spent on skill" or "how much skill was advanced above the initial".
 
RE: Skills.ini mechanics
It will be based on total SP spent instead.

I just set it like that and tested.

BasedOnPoints=1
SkillCost0 =25|50|75|100|125|300

First 25 spent SPs gave me +25% increase in skill level
Then SP / skill level cost changed to 2
Second 50 SPs game me +25% increase
Then SP / skill level cost changed to 3
...

So the breakdown table in Skills.ini is by additional skill level as returned get_critter_skill_points function and not by available SP spent!

I guess there is a big terminology confusion here.

SP, aka available SP, aka SP pool - is the amount of points available to be used to advance any skill. It is displayed in character interface under skills list in "skill points" counter.
This value is returned by get_available_skill_points function.

Skill level aka skill % is the actual level of certain skill.
This amount of skill level added on top of base is returned get_critter_skill_points function.

Maybe it would be better to reword it in Skills.ini like that to avoid confusion?

;Set to 1 to base skill costs on number of additional points in a skill excluding what comes from their stats and other bonuses
BasedOnPoints=1
 
Last edited:
Use the prefix 'a' in the script name of your mod. e.i. gl_a_name
or https://phobos2077.github.io/sfall/hook-functions/#register_hook_proc_spec

note: prefix z - reserved for sfall mods purposes.

Great hint. Thank you.

One thing confuses me, though. These two register methods have opposite ordering.

register_hook_proc
scripts are executed in reverse order of how they were registered

register_hook_proc_spec
All scripts hooked to a single hook point with this function are executed in exact order of how they were registered


So it seems that if I use "a" prefix and use register_hook_proc_spec it will be executed first which is the opposite of what I am looking for.
 
Is there a simple way to loop through all pids? Is there a global array of all pids?
Are all pids used without gaps? If so is there a max pid so I can loop until it?
If none of the above works how to determine that given pid does not correspond to any proto? This way I can break execution as soon as I can encounter it.
 
Is there a simple way to loop through all pids? Is there a global array of all pids?
What's wrong with using for loop?
The maximum number of protos for a type (items, critters, etc.) is 65535. You can check the return value with get_proto_data(pid, PROTO_PID), it returns -1 if the specified proto cannot be found.
Check EcCo's script source for the example.
 
Last edited:
Good stuff. However it is not entirely clear what it means by that.
"This is a modification of what would otherwise happen, rather than a replacement."
Does it mean that original value is passed to the function as parameter and then function may return something else if it desires?
I'm not sure. My guess is it means the final "result" is reduced or inflated to reach the replacement value, as opposed to completely ignoring the calculation process. In other words, all code is executed.

Do I understand correctly that all hooks are replacing the original behavior? If not, does it happen before or after?

Each hook has a description in which it is specified rather it is executed before or after the action. I think in general it does not replace original behavior, but read comments for each hook to be sure.

Err. The problem with drugs is that they have delayed effects. I can surely hook their usage but how do I hook time delayed events?
This is also to be scripted. For example; you want to make jet give you an additional bonus to gambling for 2 days. You keep a variable with time-when-took-jet time(the game uses 'ticks' to keep track of time), and check if two days have passed. So current_time - time-when-took-jet = 2 days (10 ticks per second, so 172800 second times 10.)
 
What's wrong with using for loop?
The maximum number of protos for a type (items, critters, etc.) is 65535. You can check the return value with get_proto_data(pid, PROTO_PID), it returns -1 if the specified proto cannot be found.
Check EcCo's script source for the example.

Nothing wrong with it. I actually prefer it. Was just looking for right conditions. Thank you for pointing this out.
 
This is also to be scripted. For example; you want to make jet give you an additional bonus to gambling for 2 days. You keep a variable with time-when-took-jet time(the game uses 'ticks' to keep track of time), and check if two days have passed. So current_time - time-when-took-jet = 2 days (10 ticks per second, so 172800 second times 10.)

Make sense. Thank you.
 
I am sorry for probably stupid question but what is SSL language and where can I get reference to it?
Internet search by "SSL" is obviously not returning what I am looking for.
 
I am sorry for probably stupid question but what is SSL language and where can I get reference to it?
Internet search by "SSL" is obviously not returning what I am looking for.
That's the scripting language specifically made for Fallout 1 and 2. Kinda weird you ask this now because you've already started working on scripting.
As for reference, you can start from the documents included in the official mapper (see Fallout Database thread for download) or the modding wiki, and check script source of UP/RP/EcCo/etc. for practical examples.
 
I'm not sure. My guess is it means the final "result" is reduced or inflated to reach the replacement value, as opposed to completely ignoring the calculation process. In other words, all code is executed.



Each hook has a description in which it is specified rather it is executed before or after the action. I think in general it does not replace original behavior, but read comments for each hook to be sure.


This is also to be scripted. For example; you want to make jet give you an additional bonus to gambling for 2 days. You keep a variable with time-when-took-jet time(the game uses 'ticks' to keep track of time), and check if two days have passed. So current_time - time-when-took-jet = 2 days (10 ticks per second, so 172800 second times 10.)
 
Any way to understand object is a book? Apparently, this is true for the books: `obj_item_subtype(object) == item_type_misc_item`. However, there are multiple other miscellaneous items there. Any sure book identification method?

The thing is I can list all of known books. There are just handful of them. However, what if some other mods adds more books? Would it be there an automatic way to detect them and especially the skill they affect?
 
Last edited:
sfall 4.3.2 and 3.8.32 are released on SourceForge, along with their respective modders packs.
Changelog said:
v4.3.2
>Changed the fix for grave type containers in 4.3.1 to an option, to fix compatibility with existing grave scripts
>Changed OverrideArtCacheSize to set the art cache size to 261 instead of 256
>Changed Enable option in the [Speed] section to no longer affect SpeedMultiInitial
>Tweaked the window title bar for DX9 windowed mode
>Optimized the calculation process in Glovz's damage formula and Haenlomal's YAAM for burst attacks
Yes, it's a relatively smaller release than the previous one. But one fix in 4.3.1 caused the player to be unable to loot existing graves (in UP/RP/Resurrection/etc.) and it's almost a month already, so we just skipped the "hotfix" versioning.
 
Back
Top