Mutators & UnrealScript

Blinding Flashlight: a Counter-Strike 1.6 Plugin and the Idea for a Killing Floor Mutator

Blinding Flashlight is a 2006-2007 AMX Mod X plugin for Counter-Strike 1.6 and Condition Zero. It turns the flashlight into a weapon: shine it into an enemy's face and their screen turns white for a moment. It is not a Killing Floor mod, but its tuning is a good template for any "light as a weapon" mechanic, and KF has flashlights on many of its weapons. This page goes through the plugin and then sketches how the idea could work in KF.

How the plugin works

The plugin waits for the game's flashlight event. When a player switches the light on, it checks who is in the beam and applies a ScreenFade (white flash) to the victim. Version 0.2.3SL (June 2007) built on VEN's original 0.2.0 and added most of the tuning:

CvarDefaultMeaning
bf_mindistance500Up to this distance the effect is at full strength
bf_maxdistance1500Beyond this the effect fades out completely, linearly from bf_mindistance
bf_maxblindtime1.5Seconds of full blindness at minimum distance (ScreenFade hold time, without fade in/out)
bf_maxblend255Opacity of the white screen at close range
bf_minblend128Opacity at maximum range
bf_hitplacebWhich body zones trigger it: a generic, b head, c chest, d stomach, e/f arms, g/h legs
bf_fxfactor4.0Multiplier for the fade in/out duration

Design decisions worth copying:

  • The victim must be looking at the attacker. v0.2.1SL added this check: you cannot blind someone from behind.
  • Head only by default. bf_hitplace=b means you have to aim the beam at the face.
  • Distance falloff for both duration and opacity, instead of an on/off effect.
  • Battery matters. The author recommends a separate plugin that drains the flashlight faster, because the stock CS battery was not balanced for a flashlight that works as a weapon. He also suggests lowering bf_mindistance to 200 for better gameplay.
  • Reset on round restart. v0.2.1SL fixed a bug where per-player timers survived a round restart and blocked the effect.

Feedback from the thread: it works on CS 1.6; Day of Defeat has no flashlight event, so it cannot work there as is; on The Specialists 3.0 it loaded but did nothing. Several people expected it to get annoying on full servers.

The idea for Killing Floor

KF is PvE, so the interesting target is zeds, not players. Many KF weapons have a flashlight with a battery, and players already use it in dark maps. Here is how the plugin's tuning could translate into a mutator. This is a design sketch, not tested code:

Plugin ruleKF version
Flashlight event triggers a checkOn the server, every 0.2-0.3 s, check players whose weapon flashlight is on (look up how the light state is stored in the KF weapon classes)
Victim must face the attackerThe zed's facing (Rotation) points at the player within a cone
Head zone onlyTrace from the player's eyes along the view direction and require a head hit (KF already has head-hit detection for headshots)
Distance falloffEffect strength from full at 5 m to zero at 15 m
ScreenFade on the victimA short stagger or slowdown for light zeds (Clot, Gorefast, Crawler, Stalker), nothing for Scrake, Fleshpound and the Patriarch
Battery drainDrain the KF flashlight battery faster while the effect is active, so it is a tool, not a permanent stun
Per-player timersKeep a cooldown per zed, and clear everything on wave end and map change

Things to watch:

  • Balance. A free stun on every Clot makes Normal and Hard trivial. Tie it to a perk (Support or Sharpshooter, depending on your server), add a cooldown, or limit it to Stalkers to reveal and slow them.
  • Performance. Do the checks on a timer, not in Tick(), and only for players whose light is on. The night vision tutorial shows how fast per-tick iteration eats FPS.
  • Feedback. Zeds have no screen to flash, so show the effect: a stagger animation, a sound, or a short hit-react.
  • Server-side only. Doing it all on the server keeps clients vanilla, so the mutator does not need to be downloaded.