Raised This Month: $276 Target: $400
 69% 

Solved L4D2 help on modifying weapon damage


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
gamer_kanelita
Member
Join Date: Jun 2019
Location: Peru
Old 09-14-2020 , 10:29   L4D2 help on modifying weapon damage
Reply With Quote #1

Hello gamers, does anyone know how to modify weapon damage just for the witch?
I have used this page: https://forums.alliedmods.net/showthread.php?t=116668
It works for the tank, but I wrote sm_damage_weaponmulti for all the weapons and melees, but the zombies do not die from a shot like the special ones, making it more difficult, does anyone know how to edit the damage of the weapons only for the witch?

Last edited by gamer_kanelita; 09-22-2020 at 15:14.
gamer_kanelita is online now
Marttt
Veteran Member
Join Date: Jan 2019
Old 09-14-2020 , 11:44   Re: L4D2 help on modifying weapon damage
Reply With Quote #2

If you know some coding you can hook "OnTakeDamage" when the entity is a witch
Somebody else may give you a plugin name or some snippet, I don't remember any by now.
__________________
Marttt is offline
gamer_kanelita
Member
Join Date: Jun 2019
Location: Peru
Old 09-14-2020 , 12:30   Re: L4D2 help on modifying weapon damage
Reply With Quote #3

something I found out that you can customize the damage towards the witch either melees or weapons through takedamage, but what steps should I do, I'm ignorant about that if only someone helped me how to do it
gamer_kanelita is online now
Marttt
Veteran Member
Join Date: Jan 2019
Old 09-14-2020 , 14:46   Re: L4D2 help on modifying weapon damage
Reply With Quote #4

Well here is some snippet:

Spoiler


This will kindly cut the damage to half.

Didn't test but may give you some direction.
__________________

Last edited by Marttt; 09-14-2020 at 14:47.
Marttt is offline
fbef0102
Senior Member
Join Date: Sep 2017
Location: TW
Old 09-16-2020 , 08:01   Re: L4D2 help on modifying weapon damage
Reply With Quote #5

my code example.

PHP Code:
//don't forget include sdkhooks.inc
#include <sdkhooks>

public void OnPluginStart()
{


    
//register event: witch_spawn
    //call this event when witch spawns
    
HookEvent("witch_spawn"Event_WitchSpawn);
}

public 
Action Event_WitchSpawn(Event event, const char[] namebool dontBroadcast)
{
    
//First Step, hook witch in server when spawns
    //when this witch takes damage, it calls "OnTakeDamage" function.
    
int witch event.GetInt("witchid");
    
SDKHook(witchSDKHook_OnTakeDamageOnTakeDamage);
}

//Second Step, OnTakeDamage modify
//@attacker: who does the damage
//@victim: who takes the damage
public Action OnTakeDamage(int victimint &attackerint &inflictorfloat &damageint &damagetype)
{
    
// check if attacker is survivor
    
if( attacker && attacker MaxClients && IsClientInGame(attacker) && GetClientTeam(attacker) == 
    {
        
//Get attacker's weapon name
        
char sWeaponName[64];
        
GetClientWeapon(attacker,sWeaponNamesizeof(sWeaponName));

        
//print information, useful for debug
        
PrintToChatAll("%N use %s to attack %d, damage: %f",attacker,sWeaponName,victim,damage);

        
//check if attacker holds a pistol
        
if(StrEqual(sWeaponName"weapon_pistol"))
        {
            
//if you want to change damage, then modify "damage" and return Plugin_Changed;
            
damage damage 2;
            return 
Plugin_Changed;
        }
    }
    
//Don't change anything, use Plugin_Continue
    
return Plugin_Continue;

    
//Do not take any damage, use Plugin_Handled
    //return Plugin_Handled;

And here are the list of all l4d2 survivor weapons' name.
PHP Code:
    "weapon_pistol",
    
"weapon_smg",
    
"weapon_pumpshotgun",
    
"weapon_rifle",
    
"weapon_autoshotgun",
    
"weapon_hunting_rifle",
    
"weapon_smg_silenced",
    
"weapon_smg_mp5",
    
"weapon_shotgun_chrome",
    
"weapon_pistol_magnum",
    
"weapon_rifle_ak47",
    
"weapon_rifle_desert",
    
"weapon_sniper_military",
    
"weapon_grenade_launcher",
    
"weapon_rifle_sg552",
    
"weapon_rifle_m60",
    
"weapon_sniper_awp",
    
"weapon_sniper_scout",
    
"weapon_shotgun_spas",
    
"weapon_melee" 
__________________

Last edited by fbef0102; 09-16-2020 at 08:32.
fbef0102 is offline
gamer_kanelita
Member
Join Date: Jun 2019
Location: Peru
Old 09-16-2020 , 18:39   Re: L4D2 help on modifying weapon damage
Reply With Quote #6

It worked for me thank you very much, but is there a way so that those annoying ads of the damage in the chat do not appear please?
gamer_kanelita is online now
Bacardi
Veteran Member
Join Date: Jan 2010
Location: mom's basement
Old 09-16-2020 , 19:26   Re: L4D2 help on modifying weapon damage
Reply With Quote #7

...remove line PrintToChatAll ?
__________________
Do not Private Message @me
Bacardi is offline
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 13:26.


Powered by vBulletin®
Copyright ©2000 - 2020, vBulletin Solutions, Inc.
Theme made by Freecode