Raised This Month: $51 Target: $400
 12% 

[L4D2] Riot Cop (and Fallen Survivor) Head Shot (Version 1.3, 2014 Oct 5)


Post New Thread Reply   
 
Thread Tools Display Modes
Author
dcx2
Senior Member
Join Date: Sep 2011
Plugin ID:
2766
Plugin Version:
1.3
Plugin Category:
General Purpose
Plugin Game:
Any
Plugin Dependencies:
    Servers with this Plugin:
     
    Plugin Description:
    Enables killing riot cops and fallen survivors more easily with head shots
    Old 01-06-2012 , 18:17   [L4D2] Riot Cop (and Fallen Survivor) Head Shot (Version 1.3, 2014 Oct 5)
    Reply With Quote #1

    I hate Riot Cops. They are way too hard to kill. No puny plastic face mask is going to stop a bullet. And armor is not invincible, so emptying a whole clip or two should bring him down. With help from Mr. Zero and McFlurry, I was able to solve this problem. It was also suggested to add Fallen Survivors and Jimmy Gibbs to this plugin, since they have an obnoxious amount of health.

    FEATURES -

    - Head shots can kill riot cops from the front (4x damage)
    - Body shots do a fraction of original damage to riot cops from the front (configurable)
    - Head shots to fallen survivors and Jimmy Gibbs do much more damage (configurable)

    CVARS -

    sm_riotcopheadshot_enable - default 1 - Enables this plugin
    sm_riotcopheadshot_riotheadenable - default 1 - 0: disabled, 1: Head shots kill riot cops, 2: Head shots do 1x to riot cops
    sm_riotcopheadshot_riotbodydivisor - default 40.0 - How much to divide riot cop body shot damage by (0 will disable)
    sm_riotcopheadshot_fallenheadmultiplier - default 12.0 - How much to multiply fallen head shots by (0 will disable)
    sm_riotcopheadshot_debug - default 0 - Print debug output to chat
    (new!) sm_riotcopheadshot_bodypenetrationdamage - default 13.0 - How much damage a penetrating weapon (magnum, military sniper, hunting rifle) should do to the body of a riot cop

    ---

    I took some time to select the defaults carefully so that this is balanced instead of completely nerfing these uncommons

    If enabled (1), head shots will always kill riot cops, no matter what weapon. If enabled (2), some weapons may need more than one bullet.

    For body shots, it takes about one full clip of a tier 2 or a shotgun, and about two clips of an smg. This makes the riot cops much tougher than common infected, but not impossible. Penetrating weapons will take four shots to kill them.

    For fallen survivors it took about 1-4 head shots with an smg and about 1-2 head shots with a tier 2 to bring down a fallen. Body damage is unaffected. Jimmy Gibbs has 3x as much health, so shots will have to scale accordingly. Since penetrating bullets to the body will kill Jimmy Gibbs, penetrating bullets to the head will do so as well.

    ---

    CHANGELOG:

    v1.3: Fixed unhooking event (thanks Mr. Zero)
    Potential stability fixes

    v1.2: Added Jimmy Gibbs head shots and penetrating body damage to riot cops (228 views!)

    ---

    This plugin requires SDKHooks! I used 2.1, but it might work with 2.0 (the version that introduced the TakeDamage native)

    To install, download the smx (SDKHooks prevents the web compiler from working)

    UPGRADING:

    If upgrading, backup any modifications made to [game]/cfg/sourcemod/L4D2RiotCopHeadShot.cfg, then delete that file and restart your server. The file will be auto-created again with the new cvars. Modify as needed.
    Attached Files
    File Type: smx l4d2_riotcopheadshot.smx (8.3 KB, 1190 views)
    File Type: sp Get Plugin or Get Source (l4d2_riotcopheadshot.sp - 877 views - 11.8 KB)

    Last edited by dcx2; 10-05-2014 at 12:55. Reason: update to 1.3
    dcx2 is offline
    McFlurry
    Veteran Member
    Join Date: Mar 2010
    Location: RemoveEdict(0);
    Old 01-06-2012 , 18:34   Re: [L4D2] Riot Cop (and Fallen Survivor) Head Shot (Version 1.0, 2012 Jan 6)
    Reply With Quote #2

    A small tip, usually it's best to minimize the number of if statements by grouping the conditions as such.
    PHP Code:
    if (g_bEnabled && isValidSurvivor(attacker) && hitgroup == 1
    Also why do you apply damage separate of the bullet for the fallen headshot? Seems a bit weird, but that's just my opinion.
    Congratulations on releasing this though.
    __________________

    Last edited by McFlurry; 01-06-2012 at 18:34.
    McFlurry is offline
    Send a message via Skype™ to McFlurry
    dcx2
    Senior Member
    Join Date: Sep 2011
    Old 01-06-2012 , 18:48   Re: [L4D2] Riot Cop (and Fallen Survivor) Head Shot (Version 1.0, 2012 Jan 6)
    Reply With Quote #3

    I saw damage and inflictor are both passed by reference into TraceAttack, but modifying them did not have any effect at all. I guess TraceAttack is called after the damage would have been done. It just doesn't work without TakeDamage.
    dcx2 is offline
    McFlurry
    Veteran Member
    Join Date: Mar 2010
    Location: RemoveEdict(0);
    Old 01-06-2012 , 18:52   Re: [L4D2] Riot Cop (and Fallen Survivor) Head Shot (Version 1.0, 2012 Jan 6)
    Reply With Quote #4

    Did you return Plugin_Changed after modifying them?
    __________________
    McFlurry is offline
    Send a message via Skype™ to McFlurry
    dcx2
    Senior Member
    Join Date: Sep 2011
    Old 01-06-2012 , 19:37   Re: [L4D2] Riot Cop (and Fallen Survivor) Head Shot (Version 1.0, 2012 Jan 6)
    Reply With Quote #5

    Well, that would explain why it wasn't working. I'll make a new version which doesn't need TakeDamage then.
    dcx2 is offline
    dcx2
    Senior Member
    Join Date: Sep 2011
    Old 02-11-2012 , 01:43   Re: [L4D2] Riot Cop (and Fallen Survivor) Head Shot (Version 1.2, 2012 Feb 11)
    Reply With Quote #6

    Version bump

    Added Jimmy Gibbs to the head shot detection, since he has 3000 health.

    Added special cvar for penetrating weapons to do extra body damage.
    dcx2 is offline
    Mr. Zero
    Veteran Member
    Join Date: Jun 2009
    Location: Denmark
    Old 04-17-2014 , 17:38   Re: [L4D2] Riot Cop (and Fallen Survivor) Head Shot (Version 1.2, 2012 Feb 11)
    Reply With Quote #7

    A small update. Hope you don't mind, dcx2. Fixed a small oversight of unhooking event.

    Code:
    [SM] Native "UnhookEvent" reported: Game event "infected_hurt" has no active hook
    [SM] Displaying call stack trace for plugin "l4d2_riotcopheadshot.smx":
    [SM]   [0]  Line 79, l4d2_riotcopheadshot.sp::OnRCHSDebugChanged()
    Attached Files
    File Type: sp Get Plugin or Get Source (l4d2_riotcopheadshot.sp - 1338 views - 11.2 KB)
    Mr. Zero is offline
    dcx2
    Senior Member
    Join Date: Sep 2011
    Old 10-05-2014 , 12:57   Re: [L4D2] Riot Cop (and Fallen Survivor) Head Shot (Version 1.3, 2014 Oct 5)
    Reply With Quote #8

    Version bump. I unhooked it slightly different than you did, by checking the Old Value in the HookConVarChange. I imagine what you did was set it to the same value 2+ times in a row.

    Also, I think I once discovered that SDKHooks_TakeDamage was causing some kind of intermittent issue. TakeDamage always makes me uncomfortable so I switched back to ragdolling the riot cops if they're supposed to die.

    v1.3: Fixed unhooking event (thanks Mr. Zero)
    Potential stability fixes
    __________________
    dcx2 is offline
    Toranks
    Senior Member
    Join Date: Dec 2021
    Location: Spain
    Old 05-29-2022 , 08:17   Re: [L4D2] Riot Cop (and Fallen Survivor) Head Shot (Version 1.3, 2014 Oct 5)
    Reply With Quote #9

    sm_riotcopheadshot_debug
    This is a very useful debug, not only for riots

    Spoiler
    Still works, and together with plugins that nerf instakills in commons, it makes Riots and uncommons more balanced with each other.
    Good plugin!

    Last edited by Toranks; 05-29-2022 at 08:22.
    Toranks is offline
    Reply



    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 12:22.


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