Question How to change weapon damage? (GSC)

WaRoxYtb02

Veteran
Messages
14
Reaction score
11
Points
578
Hello,

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

Is there a way to do it?
 

StupidEdits

Insane-Known Member
Messages
2
Reaction score
1
Points
353
Hello,

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

Is there a way to do it?

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.
 

TheHiddenHour

Veteran
Messages
58
Reaction score
49
Points
803
Hello,

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

Is there a way to do it?
Put level.onplayerdamage = ::onplayerdamage; in init.
Put this function somewhere in your project:
PHP:
onplayerdamage( einflictor, eattacker, idamage, idflags, smeansofdeath, sweapon, vpoint, vdir, shitloc, psoffsettime )
{
    // 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:
onplayerdamage( einflictor, eattacker, idamage, idflags, smeansofdeath, sweapon, vpoint, vdir, shitloc, psoffsettime )
{
    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
    }
}
 

NightwalkerLots

Well-Known Member
Messages
8
Reaction score
0
Points
201
Tried using this to do a damage mult, however it broke AAT effects. Not sure how to add those back into the overide
 

Cubez

Veteran
Messages
1
Reaction score
0
Points
776
Put level.onplayerdamage = ::onplayerdamage; in init.
Put this function somewhere in your project:
PHP:
onplayerdamage( einflictor, eattacker, idamage, idflags, smeansofdeath, sweapon, vpoint, vdir, shitloc, psoffsettime )
{
    // 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:
onplayerdamage( einflictor, eattacker, idamage, idflags, smeansofdeath, sweapon, vpoint, vdir, shitloc, psoffsettime )
{
    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
    }
}
i know this is old and u probably wont answer but is there any way to add multiple guns to the if(sweapon == " ")
 
Top