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

[TF2] Airshot Bride (v1.1.0, 03/16/2013)


Post New Thread Reply   
 
Thread Tools Display Modes
Author
J3rry
Junior Member
Join Date: Nov 2012
Plugin ID:
3367
Plugin Version:
1.1.0
Plugin Category:
Fun Stuff
Plugin Game:
Team Fortress 2
Plugin Dependencies:
    Servers with this Plugin:
     
    Plugin Description:
    Plays a sound every time a player dies to an airshot
    Old 11-14-2012 , 13:12   [TF2] Airshot Bride (v1.1.0, 03/16/2013)
    Reply With Quote #1

    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)
      • Initial release
    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.
    Attached Files
    File Type: sp Get Plugin or Get Source (airshot-bride.sp - 643 views - 13.3 KB)
    File Type: smx airshot-bride.smx (15.6 KB, 947 views)
    File Type: txt airshot-bride.sounds.txt (258 Bytes, 715 views)
    File Type: txt airshot-bride.weapons.txt (885 Bytes, 628 views)

    Last edited by J3rry; 03-16-2014 at 17:54.
    J3rry is offline
    Dispenz0r
    Senior Member
    Join Date: May 2011
    Old 11-15-2012 , 09:33   Re: [TF2] Airshot Bride (v1.0.0, 11/14/2012)
    Reply With Quote #2

    Does it also work with .wav files?
    Dispenz0r is offline
    MasterOfTheXP
    Veteran Member
    Join Date: Aug 2011
    Location: Cloudbank
    Old 11-15-2012 , 13:44   Re: [TF2] Airshot Bride (v1.0.0, 11/14/2012)
    Reply With Quote #3

    This might crash Mac clients, as I said here. Although Valve has essentially murdered the Mac client with the SF12 update, and I've switched to CrossOver, so...I don't really care anymore I do know a few other people on OS X, though, so I might do some testing with this plugin and see if they crash.

    Aside from that (since it isn't your fault at all), great work. Perhaps a cvar to make it play to only the killer, and/or only the victim. Playing sounds to all players (a la Quakesounds) irks me. Also, you should probably hook the "sound" cvar being changed, and precache/adddownload that sound, that way a map restart isn't needed.
    Quote:
    Originally Posted by Dispenz0r View Post
    Does it also work with .wav files?
    Of course. You shouldn't be having clients download big wav files, though. Unless lipsyncing, or looping.
    __________________
    Plugins / My Steam / TF2 Sandbox (plugin beta testing!)
    MasterOfTheXP is offline
    J3rry
    Junior Member
    Join Date: Nov 2012
    Old 11-15-2012 , 14:15   Re: [TF2] Airshot Bride (v1.0.0, 11/14/2012)
    Reply With Quote #4

    Quote:
    Originally Posted by Dispenz0r View Post
    Does it also work with .wav files?
    Yes, it does! Just make sure to change sm_airshot_sound accordingly.

    Quote:
    Originally Posted by MasterOfTheXP View Post
    This might crash Mac clients, as I said here. Although Valve has essentially murdered the Mac client with the SF12 update, and I've switched to CrossOver, so...I don't really care anymore I do know a few other people on OS X, though, so I might do some testing with this plugin and see if they crash.
    Thanks, it would be really nice if you could test it on OS X. Unfortunately, I don't have a Mac so I can neither test nor debug the plugin on OS X D:

    Quote:
    Originally Posted by MasterOfTheXP View Post
    Aside from that (since it isn't your fault at all), great work. Perhaps a cvar to make it play to only the killer, and/or only the victim. Playing sounds to all players (a la Quakesounds) irks me.
    Oh, that's a nice idea. I think I'm going to implement that. I had it play the sound to all players because I wanted it to resemble the Machina's penetration kill sound, but I understand that not everybody might like this, so making it configurable is my best bet, I guess.

    Quote:
    Originally Posted by MasterOfTheXP View Post
    Also, you should probably hook the "sound" cvar being changed, and precache/adddownload that sound, that way a map restart isn't needed.
    I actually thought about doing that, but I wasn't too sure whether this would work. I could only find AddFileToDownloadsTable(), no such thing as RemoveFileFromDownloadsTable(). Wouldn't this cause new players connecting to also download the old sound file, as it isn't removed from the downloads table?
    J3rry is offline
    Dispenz0r
    Senior Member
    Join Date: May 2011
    Old 11-15-2012 , 14:37   Re: [TF2] Airshot Bride (v1.0.0, 11/14/2012)
    Reply With Quote #5

    .wav files do not work for me

    EDIT: Nevermind, I made an error

    Last edited by Dispenz0r; 05-05-2015 at 15:11.
    Dispenz0r is offline
    J3rry
    Junior Member
    Join Date: Nov 2012
    Old 11-15-2012 , 14:46   Re: [TF2] Airshot Bride (v1.0.0, 11/14/2012)
    Reply With Quote #6

    Quote:
    Originally Posted by Dispenz0r View Post
    Does not work for me D:
    That's unfortunate and I'd love to help you out, but you need to provide more details.
    • What happens when you do an airshot? Nothing at all? Crashes? Other weird stuff?
    • Is there any error printed on the console?
    J3rry is offline
    Huntereb
    >:) (:<
    Join Date: Jul 2012
    Old 11-15-2012 , 15:38   Re: [TF2] Airshot Bride (v1.0.0, 11/14/2012)
    Reply With Quote #7

    Quote:
    Originally Posted by MasterOfTheXP View Post
    Although Valve has essentially murdered the Mac client with the SF12 update, and I've switched to CrossOver, so...I don't really care anymore
    30 FPS FTW!

    Now does anyone know a good airshot sound that would fit with "BOOM! HEADSHOT!!"?
    Huntereb is offline
    Powerlord
    AlliedModders Donor
    Join Date: Jun 2008
    Location: Seduce Me!
    Old 11-15-2012 , 15:48   Re: [TF2] Airshot Bride (v1.0.0, 11/14/2012)
    Reply With Quote #8

    Quote:
    Originally Posted by J3rry View Post
    I actually thought about doing that, but I wasn't too sure whether this would work. I could only find AddFileToDownloadsTable(), no such thing as RemoveFileFromDownloadsTable(). Wouldn't this cause new players connecting to also download the old sound file, as it isn't removed from the downloads table?
    StringTables are reset on every map change, which incidentally is why you need to run AddFileToDownloadsTable in OnMapStart (or OnConfigsExecuted) rather than OnPluginStart.
    __________________
    Not currently working on SourceMod plugin development.
    Powerlord is offline
    J3rry
    Junior Member
    Join Date: Nov 2012
    Old 11-16-2012 , 20:25   Re: [TF2] Airshot Bride (v1.0.0, 11/14/2012)
    Reply With Quote #9

    Quote:
    Originally Posted by Powerlord View Post
    StringTables are reset on every map change, which incidentally is why you need to run AddFileToDownloadsTable in OnMapStart (or OnConfigsExecuted) rather than OnPluginStart.
    But if I hook ConVarChanged and use AddFileToDownloadsTable() on the new file name, it wouldn't remove the old file from the downloads table, causing new players to download both the old AND the new file, would it? Also, would it force players who are already connected to download the new file? (Basically, I'm not sure whether it's possible to change the sound file without changing the map)
    J3rry is offline
    SmackDaddy
    Veteran Member
    Join Date: Oct 2009
    Old 11-16-2012 , 22:06   Re: [TF2] Airshot Bride (v1.0.0, 11/14/2012)
    Reply With Quote #10

    Is there a specific height this will be triggered on? Sometimes someone jumping gets killed (and it's registered as an airshot kill if they aren't on the ground).....just curious.

    And would love for people to share the files they use for this -- liking the idea of "Boom Headshot" but if someone made a custom "BOOM, AIRSHOT!" LOL
    SmackDaddy 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:26.


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