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

[TF2] Jingle Bell Festives!


Post New Thread Reply   
 
Thread Tools Display Modes
Author
Matt_
Junior Member
Join Date: May 2013
Location: Michigan
Plugin ID:
3888
Plugin Version:
3.2.5
Plugin Category:
Fun Stuff
Plugin Game:
Team Fortress 2
Plugin Dependencies:
    Servers with this Plugin:
     
    Plugin Description:
    Makes festive weapons jingle when fired!
    Old 09-08-2013 , 10:16   [TF2] Jingle Bell Festives!
    Reply With Quote #1

    So, who else thought Valve missed a golden opportunity when they didn't make festive weapons jingle when shot?
    Well, for those of you who did, this plugin fixes that!
    Most of the festive weapons will work, but there are a few I had to leave out, as they either didn't work correctly, or were very loud. This may be changed in future updates.
    It requires DHooks in order to compile and run.

    Here's a list of weapons that currently won't work:
    Festive Flamethrower
    Festive Sniper Rifle
    Festive Knife
    Festive Sandvich
    Festive Wrangler
    Festive Sapper

    Cvars
    jinglebells_version - Version cvar, don't change this
    jinglebells_volume - Volume of the jingling, from 1.0 to 0.0, default is 1.0.
    jinglebells_pitch - Pitch of the jingling, from 125 to 85, default is 100.

    Changelog (M-D-Y)
    Quote:
    11-31-2013 (v3.2.5)
    Somewhat small update, added the new festive weapon indexes.
    10-09-2013 (v3.0)
    Festive Medigun and Festive Buff Banner now jingle!
    They jingle 16 times(Will hopefully be changable in future updates) when activated.
    10-06-2013 (v2.5)
    Slightly cleaned up code/reduced size
    09-18-2013 (v2.0)
    Added Volume and Pitch cvars
    09-08-2013 (v1.0)
    Initial release.

    Installation

    Quote:
    First, download and install DHooks
    Then, download the .zip file from the link provided, do NOT click "Get Plugin"
    Open the .zip, inside it you will see three folders;
    gamedata, plugins, and scripting
    Simply drag these into your sourcemod folder and restart your server
    A short video demonstrating the effect:
    http://www.youtube.com/watch?v=VQhSfIZp3is

    -------------------------
    Special Thanks
    Thrawn2, for allowing his tWeaponShootPosition code to be used, without that, this plugin wouldn't exist.
    MasterOfTheXP, for helping me understand the player_chargedeployed and deploy_buff_banner events.

    Note: After some updates, your server may crash when running this. This is caused by an outdated gamedata file. So after any updates, be sure check back here to see if you need an updated gamedata file.
    Attached Files
    File Type: sp Get Plugin or Get Source (jinglebells.sp - 421 views - 5.9 KB)
    File Type: zip JingleBells.zip (8.6 KB, 367 views)

    Last edited by Matt_; 12-31-2013 at 00:52. Reason: Updating, added new festive indexes
    Matt_ is offline
    friagram
    Veteran Member
    Join Date: Sep 2012
    Location: Silicon Valley
    Old 09-09-2013 , 04:41   Re: [TF2] Jingle Bell Festives!
    Reply With Quote #2

    You could always use events like chargedeployed, healed player, etc for mediguns
    Onconditionadded for buffbanner, probably sandvich also
    For other weapons, you can use TF2_CalcIsAttackCritical, or ontakedamage if you want to make it only go off on like headshits or backstabs, just check for damagecustom

    Also when you emit sound, you should emitsound from the weapon entity using soundchan_weapon, which will make it much quieter.. You can also tweak the volume and attenuation, just change the args.
    __________________
    Profile - Plugins
    Add me on steam if you are seeking sp/map/model commissions.

    Last edited by friagram; 09-09-2013 at 04:44.
    friagram is offline
    Matt_
    Junior Member
    Join Date: May 2013
    Location: Michigan
    Old 09-09-2013 , 07:24   Re: [TF2] Jingle Bell Festives!
    Reply With Quote #3

    I'll be sure to look into that, thanks for the information.
    As for the volume, I plan on adding a jinglebells_volume cvar once I understand hooking cvars a little more, just so people don't have to deal with a hard-coded value.
    Matt_ is offline
    Matt_
    Junior Member
    Join Date: May 2013
    Location: Michigan
    Old 10-06-2013 , 09:56   Re: [TF2] Jingle Bell Festives!
    Reply With Quote #4

    Bumping, as I've added the volume and pitch cvars , and have cleaned up the code a bit.
    Still working on how exactly use the onchargedeployed and deploy_buff_banner.
    Any help would be greatly appreciated.
    Matt_ is offline
    MasterOfTheXP
    Veteran Member
    Join Date: Aug 2011
    Location: Cloudbank
    Old 10-06-2013 , 10:28   Re: [TF2] Jingle Bell Festives!
    Reply With Quote #5

    Quote:
    Originally Posted by Matt_ View Post
    Still working on how exactly use the onchargedeployed and deploy_buff_banner.
    Something like this:
    PHP Code:
    public OnPluginStart()
    {
        
    HookEvent("player_chargedeployed"OnChargeDeployed);
        
    HookEvent("deploy_buff_banner"OnDeployBanner);
    }

    public 
    Action:OnChargeDeployed(Handle:event, const String:name[], bool:dontBroadcast)
    {
        new 
    client GetClientOfUserId(GetEventInt(event"userid"));
        
    EmitSoundClient(BellsSound[GetRandomInt(0,BellsNumber-1)], client);
    }

    public 
    Action:OnDeployBanner(Handle:event, const String:name[], bool:dontBroadcast)
    {
        new 
    client GetClientOfUserId(GetEventInt(event"buff_owner"));
        
    EmitSoundClient(BellsSound[GetRandomInt(0,BellsNumber-1)], client);

    Definitely go with deploy_buff_banner instead of OnConditionAdded for the Buff Banner, as that'll also apply to players getting buffed by the banner owner. For Sandvich...sound hook, maybe?
    __________________
    Plugins / My Steam / TF2 Sandbox (plugin beta testing!)
    MasterOfTheXP is offline
    Matt_
    Junior Member
    Join Date: May 2013
    Location: Michigan
    Old 10-10-2013 , 01:28   Re: [TF2] Jingle Bell Festives!
    Reply With Quote #6

    Plugin updated, the festive medigun and festive buff banner now jingle when activated thanks to some help from MasterOfTheXP.
    Matt_ is offline
    Matt_
    Junior Member
    Join Date: May 2013
    Location: Michigan
    Old 12-31-2013 , 01:04   Re: [TF2] Jingle Bell Festives!
    Reply With Quote #7

    Plugin updated again, added the new festive weapon indexes and did some slight cleaning up (Removed unused code).
    Currently working on getting the knife and Sandvich to work.
    Matt_ is offline
    Matt_
    Junior Member
    Join Date: May 2013
    Location: Michigan
    Old 12-14-2014 , 20:00   Re: [TF2] Jingle Bell Festives!
    Reply With Quote #8

    OK so, a recent update seems to have broken this, and I'm not entirely sure why.
    It seems to load up fine, but the second anyone fully joins the server, it crashes.
    Using DHooks 2.0 and SM 1.7
    After doing a bit of debugging it seems to crash when this is called...
    Code:
    public OnClientWeaponShootPosition(client, Float:position[3])
    Halp ;_;
    Matt_ 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 11:44.


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