Fallout 2 mod FO2 Engine Tweaks (Sfall)

Discussion in 'Fallout General Modding' started by Dude101, Jul 30, 2007.

  1. NovaRain

    NovaRain Casual Modder Modder

    Mar 10, 2007
    You need to add those Turkish characters to the fonts (fontX.fon/aaf), not something sfall can do.
     
  2. Timez

    Timez First time out of the vault

    67
    Feb 12, 2019
    Anybody can give a hint how to print text in the in game monitor/log/status information window for debug purposes?
    Any other ways for debug output?
    I have read through https://sfall.bgforge.net and didn't find reference to that.

    Never mind. Found it.
    display_msg
     
    Last edited: Nov 5, 2021
  3. Zorchar

    Zorchar Look, Ma! Two Heads!

    312
    Jun 18, 2018
    There's also "debug_msg" which can be more useful for debugging purposes.
     
  4. Timez

    Timez First time out of the vault

    67
    Feb 12, 2019
    Awesome. Thank you for hint!
     
  5. Timez

    Timez First time out of the vault

    67
    Feb 12, 2019
    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: Nov 7, 2021
  6. Timez

    Timez First time out of the vault

    67
    Feb 12, 2019
    Any way to guarantee mod execution order when they change same thing? Like if I want my mod to override everything else?
     
  7. Zorchar

    Zorchar Look, Ma! Two Heads!

    312
    Jun 18, 2018
    I think the standard way is through this link:
    https://github.com/phobos2077/sfall/issues

    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
    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.
    What do you mean in "on condition"?
    Is this what you are looking for? https://sfall.bgforge.net/stats/
    https://sfall.bgforge.net/objects-and-scripts/
    https://sfall.bgforge.net/other/
    Check out proto_data and object_data
    Pretty much same as books.
    Dont know about the first part, but check out this:
    https://sfall.bgforge.net/skills/
     
  8. NovaRain

    NovaRain Casual Modder Modder

    Mar 10, 2007
    Use mod_skill_points_per_level script function.

    It will be based on total SP spent instead.

    Use get_critter_skill_points script function to get SP spent on a skill.
     
    Last edited: Nov 7, 2021
  9. Mr.Stalin

    Mr.Stalin Agent of Enclave Modder

    522
    Oct 29, 2015
  10. Timez

    Timez First time out of the vault

    67
    Feb 12, 2019
    Thank you for response and sorry for my sometimes newbie questions.

    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?

    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
    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?

    Unfortunately, there functions do not answer "how much SP was spent on skill" or "how much skill was advanced above the initial".
     
  11. Timez

    Timez First time out of the vault

    67
    Feb 12, 2019
    RE: Skills.ini mechanics
    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: Nov 8, 2021
  12. Timez

    Timez First time out of the vault

    67
    Feb 12, 2019
    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.
     
  13. Timez

    Timez First time out of the vault

    67
    Feb 12, 2019
    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.
     
  14. NovaRain

    NovaRain Casual Modder Modder

    Mar 10, 2007
    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: Nov 8, 2021
  15. Zorchar

    Zorchar Look, Ma! Two Heads!

    312
    Jun 18, 2018
    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.)
     
  16. Timez

    Timez First time out of the vault

    67
    Feb 12, 2019
    Nothing wrong with it. I actually prefer it. Was just looking for right conditions. Thank you for pointing this out.
     
  17. Timez

    Timez First time out of the vault

    67
    Feb 12, 2019
    Make sense. Thank you.
     
  18. Timez

    Timez First time out of the vault

    67
    Feb 12, 2019
    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.
     
  19. NovaRain

    NovaRain Casual Modder Modder

    Mar 10, 2007
    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.
     
  20. Timez

    Timez First time out of the vault

    67
    Feb 12, 2019