View Single Post
Author Message
Mystik Spiral
Senior Member
Join Date: Oct 2020
Location: Orlando, FL
Old 12-05-2020 , 18:49   [L4D & L4D2] Reverse Friendly-Fire [v2.8.5 (07-Oct-2023)]
Reply With Quote #1

.
Reverse Friendly-Fire (l4d_reverse_ff) by Mystik Spiral

Purpose:

Left4Dead(2) SourceMod plugin that reverses friendly-fire...attacker takes damage, victim does not.


Objectives:
  • Do not allow griefers to cause friendly-fire damage to other players.
  • Incentivize all players to improve their shooting tactics and aim.

Description and options:

Reverses friendly-fire weapon damage on survivor team and claw attacks on infected team.
Does not reverse burn/blast damage, except for grenade launcher (see Suggestion section below).
Supports client language translation, currently English, French, Spanish, Russian, and Traditional Chinese.

Please note the following for the true(1) / false(0) options below:
· The victim never takes damage from the attacker.
· 1 = friendly-fire is reversed for that option and the attacker takes damage.
· 0 = friendly-fire is disabled for that option and the attacker does not take damage.
  • Option to ReverseFF when attacker is an admin. [reverseff_admin (default: 0)]
  • Option to ReverseFF when victim is a bot. [reverseff_bot (default: 0)]
  • Option to ReverseFF when victim is incapacitated. [reverseff_incapped (default: 0)]
  • Option to ReverseFF when attacker is incapacitated. [reverseff_attackerincapped (default: 0)]
  • Option to ReverseFF when damage from mounted gun. [reverseff_mountedgun (default: 1)]
  • Option to ReverseFF when damage from melee weapon. [reverseff_melee (default: 1)]
  • Option to ReverseFF when damage from chainsaw. [reverseff_chainsaw (default: 1)]
  • Option to ReverseFF during Smoker pull or Charger carry. [reverseff_pullcarry (default: 0)]
  • Option to specify extra damage if attacker used explosive/incendiary ammo. [reverseff_multiplier (default: 1.125 = 12.5%)]
  • Option to specify percentage of damage reversed for survivor (0=min, 2=max). [reverseff_dmgmodifier (default: 1.0=damage unmodified)]
  • Option to specify percentage of damage reversed for infected (0=min, 2=max). [reverseff_dmgmodinfected (default: 1.0=damage unmodified)]
  • Option to specify maximum survivor damage allowed per chapter before kick/ban (0=disable). [reverseff_survivormaxdmg (default: 200)]
  • Option to specify maximum infected damage allowed per chapter before kick/ban (0=disable). [reverseff_infectedmaxdmg (default: 50)]
  • Option to specify maximum tank damage allowed per chapter before kick/ban (0=disable). [reverseff_tankmaxdmg (default: 300)]
  • Option to specify kick/ban duration in minutes. (0=permanent ban, -1=kick instead of ban). [reverseff_banduration (default: 10)]
  • Option to specify ReverseFF based on distance between victim and attacker (0=disable). [reverseff_proximity (default: 32)]
  • Option to specify ReverseFF based on cooldown timer (0=disable). [reverseff_cooldowntime (default: 0)]
  • Option to enable/disable stumble effect from grenade launcher friendly-fire (0=disable). [reverseff_glstumble (default: 0)]
  • Option to enable/disable plugin (0=Plugin off, 1=Plugin on) [reverseff_enable (default=1)]
  • Option to enable/disable plugin by game mode. [reverseff_modes_on, reverseff_modes_off, reverseff_modes_tog]
  • Option to enable/disable plugin announcement (0=Announcement off, 1=Announcement on) [reverseff_announcement (default=1)]
  • Option to display/suppress ReverseFF chat messages (0=Suppress chat messages, 1=Display chat messages) [reverseff_chatmsg (default=1)]

Notes:

Without this plugin, if you shoot another player while they are being pulled by the Smoker (before they are choked) or while being carried by the Charger (before they are pummeled), it would trigger friendly-fire. Setting reverseff_pullcarry=0 allows you to turn this off, and is the default. If you shoot another player while they are pinned by the Hunter or Jockey, friendly-fire is blocked, regardless of the reverseff_pullcarry setting.

If you set reverseff_dmgmodifier=0, it effectively disables all friendly-fire. The default setting is 1, which does not modify the damage amount, just reverses it. Setting it lower than 1 reduces the damage reversed to the attacker, and setting it higher than 1 increases the damage reversed to the attacker.

The proximity feature (reverseff_proximity) compares the distance between the attacker and victim, and if the distance is less than reverseff_proximity, ignores friendly-fire. The default value is 32, which is where players bodies are so close they begin to overlap. However, you could also set it to a lower value (more body overlap before friendly-fire is ignored) or a higher value to provide a buffer around you for griefers/idiots that run through or in front of you while you are firing. Also note this feature ignores melee weapons and chainsaw... those will always generate friendly-fire (unless you have one of the other ConVars set to negate that). You can disable this feature by setting reverseff_proximity=0. If you want the opposite effect... ignore friendly-fire when the distance is greater than reverseff_proximity (instead of less than) then set reverseff_proximity to a negative value.


Suggestion:

To minimize griefer impact, use the Reverse Friendly-Fire plugin along with...

ReverseBurn and ExplosionAnnouncer (l4d_ReverseBurn_and_ExplosionAnnouncer)
  • Smart reverse of burn damage from explodables, like gascans.
  • Option to reverse blast damage, like propane tanks.
ReverseBurn and ThrowableAnnouncer (l4d_ReverseBurn_and_ThrowableAnnouncer)
  • Smart reverse of burn damage from throwables, specifically molotovs.
  • Option to reverse blast damage, like pipe bombs.
When these three plugins are combined, griefers will usually get frustrated and leave since they cannot damage anyone other than themselves.
Although griefers will take significant damage, other players may not notice any difference in game play (except laughing at stupid griefer fails).


Credits:

CFG file requested by user2000
Victim incapacitated option requested by Shao
L4D1/2 engine check fix requested by Crasher_3637/Psyk0tik
Reverse accusation vocalizations requested by kooper990
Kick or ban option requested by Maku and Crasher_3637/Psyk0tik
ReverseFF for infected requested by Kai0205
Short FF grace immediately after killing SI requested by Kai0205
L4D1/2 specific checks fix requested by kooper990 and Marttt
Attacker incapped option and mounted gun option requested by Shao
Melee and chainsaw option requested by Shao
Charger carry and Smoker pull option requested by Shao
Chainsaw damage fix by pan0s
Damage modifier by percentage requested by TrueDarkness
Promximity option requested by Shao
Announcement option requested by tamasa1969
Chat option requested by kevinracer
Cooldown timer requested by Shao
Game modes on/off/tog by Silvers
GetClientDist adapted from UndoFF by dcx2
Traditional Chinese translation by in2002
SM 11 compile warnings fix requested by S.A.S
Grenade stumble effect option requested by Automage
Option to reverse the logic of reverseff_proximity requested by Smeraldo


Want to contribute code enhancements?
Create a pull request using this GitHub repository: https://github.com/Mystik-Spiral/l4d_reverse_ff

Plugin discussion: https://forums.alliedmods.net/showthread.php?t=329035


Most recent update:
Code:
07-Oct-2023 v2.8.5
- Modified the reverseff_proximity console variable to allow for negative values.

When reverseff_proximity is set to a negative value, ignore friendly-fire when the distance between the victim and attacker is greater than abs(reverseff_proximity), and reverseff if the distance between victim and attacker is less than abs(reverseff_proximity).

When reverseff_proximity is set to a positive value, ignore friendly-fire when the distance between the victim and attacker is less than reverseff_proximity and reverseff if the distance between victim and attacker is greater than reverseff_proximity.

Update history for older versions:
Spoiler

If you are upgrading from release 2.5 or lower, please note that you will need to manually remove the "reverseff_self" entry from the l4d_reverse_ff.cfg file, or just delete the l4d_reverse_ff.cfg file and let the plugin create a new one.

The phrases file changed in the 2.7 release, is REQUIRED, and must be downloaded/copied to the "addons\sourcemod\translations" directory.
.
Attached Files
File Type: txt l4d_reverse_ff.phrases.txt (2.7 KB, 1416 views)
File Type: sp Get Plugin or Get Source (l4d_reverse_ff.sp - 514 views - 36.7 KB)
__________________

Last edited by Mystik Spiral; 10-07-2023 at 14:29. Reason: updated version
Mystik Spiral is offline