Various modding questions

Discussion in 'Fallout General Modding' started by Cyrus, Sep 4, 2020.

  1. Cyrus

    Cyrus First time out of the vault

    73
    Nov 5, 2015
    I have a bunch of Qs which I'd appreciate your help with. Keeping them in one thread for cleanliness.


    1. If there is a procedure called procedure_1 in Script_1.ssl, and there is another procedure also called procedure_1 in another script file called Script_2.ssl, will they interfere with each other? What actually happens?



    2. If a procedure is registered to a given gamehook in one script file, and another procedure is registered to the same gamehook in another script file, what happens? I suppose when the hook gets "hooked" then a procedure should be called and executed. but if two different procedures in two different scripts are registered to the same hook...?

    In Fo2Tweaks for example register_hook_proc(HOOK_COMBATDAMAGE, procedure_name) is called once in gl_g_knockback.ssl and once in gl_g_damage_mod.ssl. Although the procedure name is different.

    I need to understand this so i don't make incompatible code with other people's code, in case of merging.
     
    Last edited: Sep 4, 2020
  2. NovaRain

    NovaRain Casual Modder Modder

    Mar 10, 2007
    1. No they won't, as long as you don't export/import the said procedure from the two scripts to others (i.e. mix-calling them in the same 3rd script).
    2. Check the first part in hookscript.txt if you're planning to make your hook script work with others.
     
  3. Cyrus

    Cyrus First time out of the vault

    73
    Nov 5, 2015
    Thanks NovaRain.

    3. Can I create a 2 dimensional map array and use only dots (.) to get or set the variables?

    For example:
    Code:
    Table1 = {"Gun1", "Gun2", "Gun3", "Gun4"};
    
    Table1.Gun1 = { "DMG_min": 5, "DMG_max": 10, "Range": 20};
    
    Gun1_range = Table1.Gun1.Range;
    
    Table1.Gun1.Range = Gun1_Range + 5;
    

    4. How do I add a new key to an existing map?
     
  4. Mr.Stalin

    Mr.Stalin Agent of Enclave Modder

    348
    Oct 29, 2015
    add a new key: map[key] = val

    try
     
  5. Cyrus

    Cyrus First time out of the vault

    73
    Nov 5, 2015
    Thanks for reply,

    My emphasis was more on dot usage: Var1.Var2.Var3

    sslc doc says:
    You know, I read this line and didn't understand well enough last night, but now as I read it again I think I can understand it a little better. I think I CAN use it that way.
     
    Last edited: Sep 6, 2020
  6. Cyrus

    Cyrus First time out of the vault

    73
    Nov 5, 2015
    I have written a script that reduces AP cost for unarmed special attacks (jab, palmstrike, hipkick, etc). the AP cost hookscript is triggered A LOT! so it runs very often (not my fault, nature of the hookscript). So I want to make sure I write the code as efficiently as possible to prevent excess execution time.

    I have the choice between writing it so it only applies to dude_obj, or to all critters. The thing is I don't know if other critters even have the option to use these special attacks. If they are unable to use them then there is no need to write to accommodate them. It would make the code more efficient to eliminate it for them.

    The special attacks have 3 requirements, Skill check, stat check, and level check. There are many critters that do pass the skill and stat checks, however I'm not sure if critters have a "level", or perhaps the game is designed not to require a level check for them. Because I don't know this I can't determine if critters other than dude_obj have access to special attacks.

    Does anyone know the answer to this?


    Here is the code for reference:
    Code:
    #include "headers/fo2tweaks/fo2tweaks.h"
    
    
    variable new_apcost = 0;
    variable critter_arg;
    variable atktype_arg;
    variable aimed_arg;
    
    procedure start;
    procedure apcost_handler;
    
    
    procedure start begin
      if game_loaded then begin
        register_hook_proc(HOOK_CALCAPCOST, apcost_handler);
        ndebug("initialized");
      end
    end
    
    
    procedure apcost_handler begin
      critter_arg = get_sfall_arg;
      atktype_arg = get_sfall_arg;
      if atktype_arg < 11 then return; // Not an unarmed special attack, bypassing.
    
     
      if ((atktype_arg == ATKTYPE_JAB) or (atktype_arg == ATKTYPE_PALMSTRIKE) or (atktype_arg == ATKTYPE_PIERCINGSTRIKE)) then begin
        new_apcost = 4;
      end
      else begin
        if ((atktype_arg == ATKTYPE_HIPKICK) or (atktype_arg == ATKTYPE_HOOKKICK) or (atktype_arg == ATKTYPE_PIERCINGKICK)) then begin
          new_apcost = 5;
        end
        else begin
          return; // Primary kick types. Bypassing.
        end
      end
    
      aimed_arg = get_sfall_arg;
      if aimed_arg == 1 then new_apcost = (new_apcost + 1);
    
      if (has_trait(TRAIT_PERK, critter_arg, PERK_bonus_hth_attacks)) then new_apcost = (new_apcost - 1);
    
      set_sfall_return(new_apcost);
    end
    
    Also if you know of anyway I can make the execution chain of this code more efficient please point out to me. Thank you.
     
    Last edited: Sep 17, 2020
  7. Vali

    Vali Redeemer

    217
    Apr 29, 2020

    I don't know why change the ap cost for these, you plan to add more boxing fights? Because i and i think many guys here dont use unarmed, i use this only at temple of trial and then never.

    It have a reason why special attacks have so many ap cost, with this the balance is nearly zero.
     
  8. Cyrus

    Cyrus First time out of the vault

    73
    Nov 5, 2015
    People don't use unarmed because unarmed is under powered compared to guns. If we improve unarmed then it will be more interesting. This is one of the ways you make things worthwhile and more interesting.

    Default game values are not good. Changes like this give the player the option to enjoy the game the way they want. Values can always be changed.
     
  9. Vali

    Vali Redeemer

    217
    Apr 29, 2020
    The problem is you get early a gun,and then unarmed is not useful anymore. Because you find enough stuff, and can buy and find enough ammo.

    How will you survive a early fight against 4 raiders 1 with hunting rifle other with 10 mm pistol and others with melee weapons?not with unarmed and for later game, you dont have a chance when comes stronger enemies with strong weapons.
     
  10. Cyrus

    Cyrus First time out of the vault

    73
    Nov 5, 2015
    You make valid points and I understand where you are coming from. But see that this change is still better than vanilla. There are many ways to play the game and many of those ways are less efficient than the "best ways" to play. However we do still play in less "efficient" ways because of ...fun!

    The default AP costs for unarmed special attacks are WAY too high and they make those attack options completely useless and moot. It may not be possible to get everything in the game in a really nice balance, but its still good to inch closer. I think this is a good change.

    It also allows to assign ANY number you want to those attacks in the future.
     
  11. Zorchar

    Zorchar It Wandered In From the Wastes

    194
    Jun 18, 2018
    I personally don't, but I THINK that the execution time, and the amount of "work" the CPU will have to do is negligible. A script becomes CPU intensive in other cases, such as complicated mathematical calculation. A famous example is finding the root number of a very large number: The CPU has to make many (I'm guessing much much more than a billion, depending on the number itself) of operations to calculate this.
    In your example, it looks totally negligible.

    EDIT: Also I think most (if not all) critters in use in the game are level 1, and with varying skills and stats. Many attributes and functions can only be applied to dude_obj, such as add_trait or perk.
     
    Last edited: Sep 17, 2020
  12. .Pixote.

    .Pixote. Carbon Dated and Proud
    Modder

    Sep 14, 2009
    Unarmed is for master players who want to play a finessed game, unlike those 'lowlifes' who walk around carrying cheap firearms making "pew - pew" noises every few minutes.

    :flameon:
     
    • [Rad] [Rad] x 2
  13. Vali

    Vali Redeemer

    217
    Apr 29, 2020
    Ok lets play Fallout Online you come with unarmed, and i come with Minigun.

    You maybe look to many Bruce Lee films haha.

    I will see you unarmed against a Enclave Soldier or Frank Horrigan but without Cheats.
     
  14. Lexx

    Lexx Background Radiant
    Moderator Modder

    Apr 24, 2005
    Last I checked, we were making mods for Fallout 2 and not FOnline.
     
    • [Rad] [Rad] x 1
  15. Vali

    Vali Redeemer

    217
    Apr 29, 2020
    Yes but here are guys play with cheats, and think they are pros.

    He played to many times WOW i think.
     
  16. Oracle

    Oracle Water Chip? Been There, Done That

    938
    May 19, 2003
    this guy...
     
  17. Gizmojunk

    Gizmojunk Half-way Through My Half-life

    Nov 26, 2007
    Most of my games have centered around unarmed & melee fighters... In the late game my characters would adopt a strong pistol for times when they could not reach an opponent within their turn, or could not afford to cross the field away from their immediate concerns (the directly adjacent fight).

    I do not understand lowering AP costs for advanced moves. We all know (I assume) that APs directly equate to 'use of time', and I cannot imagine that these actions take less time; and they afford greater benefits than the standard [faster/cheaper] attacks.

    I have to believe that the developers played and tested the game for years, settling upon the best costs relative to each discipline. AP changes will allow additional attacks per round to average characters—and they can be wearing a power fist when they do them.
     
    Last edited: Sep 17, 2020
    • [Rad] [Rad] x 1
  18. .Pixote.

    .Pixote. Carbon Dated and Proud
    Modder

    Sep 14, 2009
    I've never played World of Warcraft, wouldn't touch that crap with a 10ft pole...I like to play Fallout 2 solo, with a unarmed character, on the most difficult setting, and still I can wipe everything on the map, or just run away if things get too hot. Running away is also a valid method to survive the wastelands.
     
    • [Rad] [Rad] x 1
  19. Gizmojunk

    Gizmojunk Half-way Through My Half-life

    Nov 26, 2007
    I was given a 10 day free trial of WoW; I had never played. I installed it, and played it for about 15 minutes. I uninstalled it... and that was my last experience with it.
     
  20. Risewild

    Risewild Venerable Relic of the Wastes
    Modder Orderite

    Jun 14, 2014
    This is usually how I play too. Sometimes I throw the trait Jinxed to the mix just to keep things more interesting.

    Hell, I even played Fallout Tactics solo and unarmed last time I played it too. That game was going well for a while: