Airshot Bride
This plugin, once installed, will play a sound every time a player kills another player while the victim is in the air (airshot). It will only work if some specific weapons have been used to kill the victim, most of them are projectile-based weapons; hitscan airshots are usually not too hard to pull off.
If you want to see it in action, I prepared a
demonstration video (make sure to watch it in "HD", the quality is unbearable otherwise).
Download the latest version of Airshot Bride (1.1.0)
Source code (Repository)
Installation instructions
This plugin has no external dependencies. Just download the .smx file, put it in your plugins/ folder, issue
sm plugins load airshot-bride.smx and you're done. Make sure to read the
Configuration section below.
If you plan to have the plugin play multiple sound files, download the attached
airshot-bride.sounds.txt (or just create your own, it's simple) and put it in
addons/sourcemod/configs/. If you changed the
sm_airshot_sound CVar, you'll need to adjust the filename and/or path to reflect that.
The plugin will only work after a map change, because it needs to precache the sound file and add it to the downloads table. You'll also need to change the map if you decide to change the sound file while the server is running.
Download
A precompiled version is attached below. It can't be compiled by the online compiler because of its dependency on SMLIB.
The source code can be found in my
Mercurial repository.
Usage
Kill players while they are in the air to have the plugin play a sound. Only certain weapons can trigger the airshot sound; by default, these include all Rocket/Grenade/Stickybomb Launchers, Sniper Rifles and Revolvers. Read the next section for instructions on how to customize this list.
Configuration
This plugin incorporates some CVars that allow you to change its behaviour. A configuration file (
tf/cfg/sourcemod/plugin.airshot-bride.cfg) will be created automatically.
- sm_airshot_sound (default: addons/sourcemod/configs/airshot-bride.sounds.txt): Path to the sound file(s) played when a player dies to an airshot.
- sm_airshot_volume (default: 1.0): Volume of the airshot sound (0.0 = completely muted, 1.0 = full volume)
- sm_airshot_playback_mode (default: 0): Playback mode (0 = random, 1 = sequential)
- sm_airshot_stopsound (default: 1): If set to 1, the airshot sound will be restarted if it's still playing while another airshot occurs.
- sm_airshot_headshot_only (default: 1): If set to 1, players using any Sniper Rifle or Revolver *will* have to do headshots for the airshot sound to play.
- sm_airshot_min_height (default: 100.0): The minimum distance above the ground a player needs to be to trigger the airshot sound. Set to 0 to disable.
- sm_airshot_play_on_suicide (default: 0): If set to 1, the sound will be played if players kill themselves while they are in the air.
Setting up multiple sound files
If you specify a text file (.txt) for
sm_airshot_sound, the plugin will read in that file and treat every line like a filename that points to a sound file.
You have to prepend the path "sound/" (i.e. if your file is
sound/misc/airshot_sound.mp3, you'll have to specify that exact path and not just
misc/airshot_sound.mp3. Of course, you can still set
sm_airshot_sound to point to a simple mp3/wav file.
Customizing the list of weapons that can trigger the airshot sound
You can create the file
addons/sourcemod/configs/airshot-bride.weapons.txt if you want to customize the list of weapons. If this file exists, the plugin will use its content over the built-in defaults. The file should contain a list of weapons, one weapon per line. Optionally, you can start the line with an asterisk (*) to mark a weapon that must do headshots if
sm_airshot_headshot_only ist set to 1. For example, you could force players to do headshots with all Sniper Rifles but ignoring this requirement for Revolvers by setting
sm_airshot_headshot_only to 1 and prefixing all Sniper Rifles with *.
The default list of weapons is attached below.
Notes- Due to copyright issues, this plugin does not come with a default sound file. You'll need to provide your own file.
- If you decide to change sm_airshot_sound while the server is running, you need to change the map for the new sound to play. An airshot sound will not be played until you change the map or revert your changes to sm_airshot_sound.
- In the demonstration video, the demonstrated CVars will notify clients when you change them. This was only to be able to better demonstrate them, and the actual plugin will not do this.
Troubleshooting
If you can't get the plugin to work, feel free to
add me on Steam so I can help you fix the problem.
Before you do, however, please answer the questions below.
- Does the plugin print any errors upon loading? (Check whether sm plugins reload airshot-bride gives you any output, as it might point out the problem)
- Does your client download the sound file you specified? (Check if it's in [Steam folder]/steamapps/common/Team Fortress 2/tf/download)
- Can you play the sound yourself by entering play [path to sound file] in the developer console?
Changelog- v1.1.0: Download (.smx); Source code (.sp)
- Made the list of weapons that can trigger the airshot sound configurable (check the Configuration section above)
- Added a CVar to control whether the sound should be played when people kill themselves in the air (sm_airshot_play_on_suicide)
- Added the Loose Cannon to the default list of weapons that can trigger the sound
- Fixed the plugin printing a warning message when reading empty lines
- v1.0.2: Download (.smx); Source code (.sp)
- Implemented a possibility to play multiple sound files
- Added a CVar to specify the order in which the sound files are played (sm_airshot_playback-mode)
- v1.0.1: Download (.smx); Source code (.sp)
- Added a CVar for a minimum height check (sm_airshot_min_height), thanks to Lange!
- Fixed a bug that would prevent the sound from being precached properly
- Fixed the sound playing when people kill themselves in the air
- Switched over to SMLIB
- Minor code optimizations
- Now with proper versioning
- v1.0.0: Download (.smx); Source code (.sp)
Planned features- A CVar that allows you to choose who should hear the airshot sound (all players, killer, victim, both)
Kudos to Hurricaaane who gave me the idea for this plugin.
Thanks to Lange whose code I borrowed from MGEMod.