Question How to change weapon damage? (GSC)

Discussion in 'Call of Duty: Black Ops 2 Scripts' started by WaRoxYtb02, Sep 26, 2018.

  1. WaRoxYtb02

    WaRoxYtb02 Member

    12
    6
    8
    Credits:
    224
    Hello,

    In my project, I need to change the damage of weapons.
    (pack a punch system)

    Is there a way to do it?
     
  2. StupidEdits

    StupidEdits New Member

    2
    1
    3
    Credits:
    56
    Wrong section - Aside from that, afaik you'd need to be able to modify weaponfiles we can't access to change the damage directly.

    An alternative is to waittill someone or something is damaged, check what weapon that damage came from, and apply extra damage on top of the weapon.
     
  3. TheHiddenHour

    TheHiddenHour Well-Known Member

    60
    49
    228
    Credits:
    279
    Put level.onplayerdamage = ::onplayerdamage; in init.
    Put this function somewhere in your project:
    PHP:
    onplayerdamageeinflictoreattackeridamageidflagssmeansofdeathsweaponvpointvdirshitlocpsoffsettime )
    {
        
    // Runs everytime something takes damage
    }
    This is an override function that the game uses in some gamemodes like One In The Chamber, so it's neater to use rather than making your own monitor using waittills. Every time something in the game takes damage, this function will be called on the entity taking damage and its contents will be executed. Here's some psuedo code that could help you with your pack a punch idea :blush::
    PHP:
    onplayerdamageeinflictoreattackeridamageidflagssmeansofdeathsweaponvpointvdirshitlocpsoffsettime )
    {
        if(
    eattacker.has_pap// If the attacker has a pack-a-punchable weapon equipped
        
    {
            if(
    sweapon == "fiveseven_mp"// If the pack-a-punched weapon is a fiveseven
                
    self.health -= 100// Subtract 100 health from the victim's health
        
    }
    }
     
    amand and WaRoxYtb02 like this.
  4. WaRoxYtb02

    WaRoxYtb02 Member

    12
    6
    8
    Credits:
    224
    Thanks, I will test that !
     

Share This Page