weapon accuracy

Discussion in 'Fallout General Modding' started by Zorchar, May 25, 2020.

  1. Zorchar

    Zorchar It Wandered In From the Wastes

    147
    Jun 18, 2018
    What do u think the best way to make a gun more, or less accurate. I'm thinking this may be very easy to fix with a hook script. How should I approach this?

    In Fallout Nevada it says
    How is that implemented?
     
  2. Mr.Stalin

    Mr.Stalin Agent of Enclave Modder

    318
    Oct 29, 2015
    Nevada didn't use any global sfall scripts, either it's just written, or it's done directly by a hack in the engine.
     
  3. Zorchar

    Zorchar It Wandered In From the Wastes

    147
    Jun 18, 2018
    Thanks.
    Could u please direct me to a guide on hacking the engine? I just want to modify formulas and stuff for now.
     
  4. gustarballs1983

    gustarballs1983 A Smooth-Skin

    602
    Oct 28, 2009
    Your best bet would be setting STR requiremet above 10 (if it is at all possible) for example for miniguns even str 10 is too little. in reality those weapons are even to heavy to hold not to mention withstand it's recoil. hence why they are boat vehicle and aircraft mounted. even today's mock ups of PA (which are beeing designed for minigun carriage btw) don't manage to withstand the recoil of weapons such as Minigun *and* Microgun, not to mention something that packs bigger punch like GAU-19. My idea of usage of such weapons in fallout would be weapon handling perk work beyond STR 10 cap and ultra heavy weapons have a minimum STR requiremet of ST13. this way standard dude build with STR 6 or 7 before wearing sufficient level power armor and having weapon handling perk would get 100 - 120 skill points penalty to accuary with those weaons. Meaning to reach 95% cap chance to hit one would require 215% skill in big guns or advanced power armor *and* weapon handling perk.

    As a general rule of thumb all rifle strength req should be revised. I mean 6 STR for Plasma rifle ( such a big and cumbersome weapon? or Fn-Fal? Fn fal should be at least 7-8 STR to fire acurately and Plasma rifle perhaps 9 STR Just to hold it properly) those weapons were ment to be held by trained muscular soldiers, and not some weaksauce civilians without military training like stealth ad diplomat chars. sacrifice has to be made eigther You are proficient with weapons and wipe everyone out *or* You travel with NPCs to do it for you .
     
  5. Zorchar

    Zorchar It Wandered In From the Wastes

    147
    Jun 18, 2018
    I agree that weapon requirements and penalties should be buffed a bit. Thanks for your suggestion. Do u know how to change engine stuff maybe? like that penalty you were talking about?
     
  6. gustarballs1983

    gustarballs1983 A Smooth-Skin

    602
    Oct 28, 2009
    The penalty which i proposed, would be from 6-7 points difference in STR of *usual* char build with actual STR of 6-7 and a minugun with new STR req. of Minimum Strength: 13. I have no idea if any modding tool actually allows setting this value any higher than 10 but I know that Each point of STR missing to meet the criteria is -20% said weapon skill penalty (not the final to hit chance penalty). so 20%x6STRmissing=120% skill penalty, plus 95% skill investment on top to actually hit the cap= 215% effective skill to reliably use the weapon without PA + weapon Handling.

    The only thing would be enabling 'Weapon Handling' perk to be calculated also past 10 STR, and perhaps enable it to be also taken without any STR req, so that even char with STR10 could pick weapon handling.
     
  7. burn

    burn Mildly Dipped
    Modder

    550
    Apr 22, 2012
    I'm not sure whether the engine supports stats over 10, and in fact I think it's not such a good idea.
    You can, however, apply penalties when wielding heavy weapons, and remove them when PA is equipped and/or perk is taken.
     
  8. Mr.Stalin

    Mr.Stalin Agent of Enclave Modder

    318
    Oct 29, 2015
    Use HOOK_TOHIT global script.
     
  9. Zorchar

    Zorchar It Wandered In From the Wastes

    147
    Jun 18, 2018
    Yeah, thanks. I will use it.
    Thing is, I want to use the same formula as the game engine uses, only with a slight change, so I need to know the original engine formula. Plus, I might want to change other stuff. So please, any references to accessing the game engine?

    EDIT:
    My current goal is:
    1. looking at the original engine TOHIT code.
    2. Copying the code into a TOHIT hook script.
    3. changing it so it will take into account carbine accuracy penalty before normalizing 95% hit chance. (so I want the penalty not to have effect if u have high enough skill)

    For example: dude has 150% small arms. he aims with a hunting rifle on a critter. he gets 100% hit_chance. the engine says "if hit_chance>95% then hit_chance := 95%"

    now dude aims with carbine. carbine has -10% accuracy. he gets hit_chance 100%-10%penelty=90% final hit_chance. (and not 85%, which will be the case if I'll just add that same penalty with a simple TOHIT addon)

    now dude adds 10% to small arms. carbine has -10% accuracy. he gets hit_chance 110%-10%=100%, but "if hit chance >95% then hit_chance := 95%". so final hit_chance is 95%. (again, different from 85%.)

    As u can see, this is different then simply adding a -10% modifier to a HOOK_TOHIT, since the hook uses hit_chance after the 95% normalization.

    I already have a reference to the specific TOHIT code actually, given to me in this forum, but I would like to know how to access the engine code nonetheless for other stuff I might wanna do in the future, such as changing ammo stats to account for DT instead of AC and so on.
     
    Last edited: Jun 13, 2020
  10. Mr.Stalin

    Mr.Stalin Agent of Enclave Modder

    318
    Oct 29, 2015
  11. Zorchar

    Zorchar It Wandered In From the Wastes

    147
    Jun 18, 2018
    "A whole new world..."
    Thanks very much, @Mr.Stalin.
     
  12. burn

    burn Mildly Dipped
    Modder

    550
    Apr 22, 2012
    For the reference, FO2tweaks has fairly extensive damage mod, which you can use to draw examples from.
     
  13. Zorchar

    Zorchar It Wandered In From the Wastes

    147
    Jun 18, 2018
    Thanks @burn. I will definitely look into it.

    I was mentioning the AC/DT mod because of YAAM (yet another ammo mod), where it changed the DR ammo modifier to a DT ammo modifier. Do u happen to know how it was modded?
     
  14. burn

    burn Mildly Dipped
    Modder

    550
    Apr 22, 2012
    • [Rad] [Rad] x 1
  15. Zorchar

    Zorchar It Wandered In From the Wastes

    147
    Jun 18, 2018
    Cool. Thanks!
    I want to modify this (line 241)
    Code:
        int ammoDT = fo::func::item_w_dr_adjust(ctd.weapon);    // Retrieve ammo DT (well, it's really Retrieve ammo DR, but since we're treating ammo DR as ammo DT...)
    So it will take the AC modifier, instead of the DR modifer.

    1. Should i replace code to
    Code:
        int ammoDT = fo::func::item_w_ac_adjust(ctd.weapon);    // Retrieve ammo DT (well, it's really Retrieve ammo AC, but since we're treating ammo AC as ammo DT...)
    (ac_adjust instead of dr_adjust)?

    2. Once I change the code, how can I switch it with the original YAAM mod?
     
  16. burn

    burn Mildly Dipped
    Modder

    550
    Apr 22, 2012
    One does not simply make up function names and expect them to work.
    You're going in the wrong direction. Learn scripting.
     
  17. Zorchar

    Zorchar It Wandered In From the Wastes

    147
    Jun 18, 2018
    I appreciate the time you are taking to respond to my questions. Learning to script is what I am doing right now, reading your responses and all.

    This line I made up
    Code:
     
    fo::func::item_w_ac_adjust(ctd.weapon); 
    is indeed made up, but since there are working functions with the code
    Code:
     
    fo::func::item_w_dr_adjust(ctd.weapon); 
    fo::func::item_w_dam_div(ctd.weapon);  
    fo::func::item_w_dam_mult(ctd.weapon); 
    
    I thought my code might work.

    Now, it may seem silly to u, what I thought is true about scripting, but I don't know any other sources of information about the subject, so I am using trial and error, and asking questions to learn.
     
  18. burn

    burn Mildly Dipped
    Modder

    550
    Apr 22, 2012
    This is not scripting, this is sfall code, hacking the engine. You would need to learn c++, asm, debugging to do this. That is hard.
    I am talking about SSL scripting. (Also check out sfall doc in my sig).
     
  19. Zorchar

    Zorchar It Wandered In From the Wastes

    147
    Jun 18, 2018
    SSL scripting is awesome, it's the best, and I know I can use it for most, if not everything I want to mod.
    I think for what I want to do, which is what quoted, it's much easier to replace a line or two in the game engine, than making up an entire new script from scratch, especially if I don't know the original engine code. If you honestly think it's not, than please say so, and I promise I will stop asking about it:)

    EDIT: BTW, what's hard for me understanding engine code, is not the code itself. That I can figure out. Hell, I even learned assembler in high school. The problem is knowing how to access this code, how to replace it, and generally understanding the structure of the engine itself, like how does dll communicate with the EXE file and stuff like that.
    For instance: I know how to write and replace an SSL script, but I don't know how to replace a single line of code in the game engine.
     
    Last edited: Jun 15, 2020
  20. burn

    burn Mildly Dipped
    Modder

    550
    Apr 22, 2012
    If it's easier for you, then I might be wrong, you know better. Unfortunately, it's out of my area of expertise, so can't advise.