damage formula

Discussion in 'Fallout General Modding' started by Nirran, Apr 14, 2018.

  1. Nirran

    Nirran Vault Senior Citizen
    Modder

    Apr 15, 2007
    I want to fine tune my combatdamag script,who can tell me the formula of vanilla and what each separate value does ,for instance what does armor value do?i over looked this when writing my script
     
  2. Cubik2k

    Cubik2k Where'd That 6th Toe Come From?
    Modder

    484
    Nov 22, 2005
    Weapon:
    base_dmg - weapon base damage (Random (min, max) damage)

    Ammo modificators:
    DT_mod1 - Damage Treshold modificator 1
    DT_mod2 - Damage Treshold modificator 1
    DR_mod- Damage Resistance modificator

    Armor modificators:
    DT - Damage Treshold
    DR - Damage Resistance

    SIMPLE formula is:

    dmg_result = [base_dmg * (DT_mod1/DT_mod2) - DT] - [base_dmg * (DT_mod1/DT_mod2) - DT] * [DR + DR_mod]


    where:
    if
    [base_dmg * (DT_mod1/DT_mod2) - DT] < 0
    then
    [base_dmg * (DT_mod1/DT_mod2) - DT] = 0

    if
    [DR + DR_mod] <0
    then
    [DR + DR_mod] = 0

    if
    [DR + DR_mod] >1
    then
    [DR + DR_mod] =1


    Example:
    weapon Pistol 10mm with base damage 5-12, so for example random damage is
    base_dmg = 11

    Ammo JHP 2/1 +25%:
    DT_mod1 = 2
    DT_mod2 = 1
    DR_mod = 25% = 0.25

    Armor is Metal Armor 4/30%
    DT = 4
    DR = 30% = 0.30

    calculations:
    [base_dmg * (DT_mod1/DT_mod2) - DT] = 11 * (2/1) - 4 = 18
    [DR + DR_mod] = 0.30 + 0.25 = 0.55

    dmg_result = 18 - 18 * 0.55 = 18 - 9 = 9; (value 18 * 0.55 is truncated, not rounded)
     
  3. Nirran

    Nirran Vault Senior Citizen
    Modder

    Apr 15, 2007
    thnx cubic
     
  4. Glovz

    Glovz Vault Dweller
    Modder

    735
    Sep 16, 2005