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

[TF2] Universal Upgrades


Post New Thread Reply   
 
Thread Tools Display Modes
Author
xkirby
Member
Join Date: Dec 2012
Location: I live somewhere.
Plugin ID:
3650
Plugin Version:
1.4
Plugin Category:
Gameplay
Plugin Game:
Team Fortress 2
Plugin Dependencies:
    Servers with this Plugin:
     
    Plugin Description:
    Like MVM's Upgrade system, but for other gamemodes.
    Unapprover:
    Reason for Unapproving:
    Requires functionality that has been removed from its dependencies
    Old 05-10-2013 , 18:25   [TF2] Universal Upgrades
    Reply With Quote #1

    -- [ UNIVERSAL UPGRADES ] --
    My first (and probably only) attempt at making a SourceMod plugin,
    this plugin allows you to purchase upgrades via an in-game currency gained by killing people.

    ::FEATURES::
    • Kill Streak: Gain bonus money based on the number of players you've killed!
    • Customizable Upgrades System: Works in non-MVM gamemodes!
    • Toggleable: Can be turned off to reset everyone's stats!
    • Purchase upgrades through a menu!
    ::REQUIREMENTS::
    TF2Attributes
    LATEST SNAPSHOT OF BOTH SOURCEMOD AND METAMOD

    ::SCREENSHOTS::
    (Old)
    http://steamcommunity.com/sharedfile.../?id=144495940
    http://steamcommunity.com/sharedfile.../?id=144496692

    ::INSTALLATION::
    Put "sm_tf2_upgrades.smx" into your server's "addons/sourcemod/plugins" folder.
    Put "uu_upgrades.txt" into your server's "addons/sourcemod/configs" folder.
    Put "sm_tf2_upgrades.phrases.txt" into your server's "addons/sourcemod/translations" folder.
    Make sure you have TF2Attributes installed as well.

    ::CVARS::
    univeralupgrades_version
    Don't change this. It's the version number of the plugin.

    sm_uu_enabled

    Enables (1) the plugin or Disables (0) it.

    sm_uu_currencystart

    How much money each player starts with. Defaults to 500.

    sm_uu_currencyonkill
    How much money you earn per kill. Defaults to 25.

    sm_uu_killstreakstart
    After so many kills, you gain a percentage of bonus money every kill! This is the kill streak requirement before you get extra money. Defaults to 2.

    sm_uu_killstreakbonus
    This is the percentage of extra money you get per kill. This gets multiplied by your kill streak, by the way. Defaults to 0.05.

    sm_uu_costincrease
    This adds so much money to each upgrade, based on the upgrade's original cost. It's disabled by default (0.0). 1.0 causes each upgrade to cost 100% more than the previous amount.

    sm_uu_currencyonassist
    The percentage of money given to people who assist in a kill. Defaults to 50% of Kill money (0.5).

    sm_uu_currencyondeath
    The percentage of money given to people who have died. Defaults to 25% of Kill money (0.25).

    sm_uu_poorkillbonus

    This is bonus money you earn from kills and assists based on how much money your opponent has compared to you. Defaults to 10% (0.1).

    sm_uu_poorcheck
    This is the percentage of total money you have compared to your opponent before you gain bonus money from killing rich people. Defaults to 75% (0.75). Setting to 1.0 will give you bonus money every kill unless your money is equivelant to your opponent's.

    ::COMMANDS::
    sm_upgrade
    Opens up the upgrade menu! Use /upgrade, !upgrade, or bind sm_upgrade to a key.

    sm_checkcurrency
    This tells you how much money you have in total. /checkcurrency, !checkcurrency, or binding works with this too.

    sm_reset
    This will reset all of your stats and refund you all of the money you spent.

    sm_uu_givecurrency <user> <amount> (ROOT ADMIN ONLY)
    This allows you to give money to 1 or more players. I recommend not using negative values for the amount.

    ::NOTES::
    • Upgrades and money are removed when using "sm_uu_enabled 0" or when the round ends and restarts.
    • When you die, your kill streak will be set back to zero, causing you to gain normal money again.
    • Upgrades can optionally NOT discriminate what they're allowed to be on. This doesn't me they'll always work, though.
    • Switching classes will give you all of your spent money back, but will reset all of your stats.
    • Read the included uu_upgrades.txt to learn how the file works. Just looking at the "Upgrade Creation" section might not be good enough.


    ::UPGRADE CREATION::

    The file "uu_upgrades.txt" is where all the upgrades are stored. Here's an example of a Weapon-Specific upgrade, a Class-specific upgrade, and a General upgrade:

    Code:
    "Upgrades" // Generic File Section Name.
    {
        "tf_weapon_scattergun" // This is a Weapon Class. To be specific, the Base Scattergun Class.
        {
            "damage bonus" // This is the name of an existing TF2 Attribute.
            {
                "menuname"    "Damage +25%" // Name that shows up in the menu.
                "cost"        "500" // The cost of the upgrade.
                "upgrade"    "0.25" // The upgrade value that gets applied to the attribute.
                "max"        "5.0" // The maximum value of the attribute.
                "start"        "1.0" // The starting position of the attribute.
                "onweapon"    "1" // 1 = On Weapon, 0 = On Player. It's a weapon upgrade.
            }
        }
        
        "scout" // This is a Player Class. To be specific, this is the Scout's Upgrade list.
        {
            "move speed bonus" // Another Attribute.
            {
                "menuname"    "Movement Speed +5%" // Display name in menu.
                "cost"        "1500" // Upgrade cost.
                "upgrade"    "0.05" // Upgrade increase value.
                "max"        "1.5" // Maximum value.
                "start"        "1.0" // Starting value.
                "onweapon"    "0" // Like above, but it's 0 (zero), so it's for the player.
            }
        }
        
        "all" // This is the Generic Upgrade list. This makes it so any weapon or player class can use it.
        {
            "max health additive bonus" // Another Attribute.
            {
                "menuname"    "Max Health +25" // Display name again.
                "cost"        "400" // Upgrade cost again.
                "upgrade"    "25.0" // Upgrade value again.
                "max"        "500.0" // Maximum value again.
                "start"        "0.0" // Starting value again.
                "onweapon"    "0" // 0 = Player Class upgrade, remember that.
            }
        }
    }
    ::FINAL NOTES::
    I honestly hope this gets used. I know there's another plugin like this that's being tested, but I had made this without actually knowing someone else was doing the same thing. Either way, whoever uses this, I hope you enjoy it.


    I have no plans on altering this any further. Someone else can pick up the source, I don't know enough about SourcePawn to maintain this any further.

    ::CHANGELOG::
    • V1.4
      • Added "sm_uu_givecurrency" as an admin command and "sm_reset" as a player command.
      • Attempted to fix bandwidth issues. (Thanks, lobnico!)
      • There is now an Upgrade Category Selection menu, which allows you to upgrade Player stats and Weapon stats more easily.
      • Added a "Translation" file, but it's not perfect.
    • V1.3
      • Added "sm_uu_currencyondeath", "sm_uu_currencyonassist", "sm_uu_poorkillbonus", and "sm_uu_poorcheck" for extra money possibilities.
      • You now start with either sm_uu_currencystart's value as money or the lowest player currency count as money.
      • You now gain all of your spent money back if you switch classes. Spent money counts towards your total money and affects poor kill bonuses.
      • Upgrades can now be in a variety of sections in uu_upgrades.txt. There's Player Class, Weapon Class, and "all". "all" is the old way it worked and will give that upgrade to either the player or their equipped weapon.
      • Current Money and Total Money are both displayed in the Upgrade Menu and with sm_checkcurrency.
      • Upgrade Menu now loops until you hit 0. This is to make upgrading faster.
    • V1.2
      • Upgrade Menu now displayers [Player] or [Weapon] and the required price for each item.
      • Panel that askes you if you want to upgrade tells you how much money you have now.
      • Upgrade Menu is created when a player opens it.
      • Added "universalupgrades_version" as a Version Tracking Cvar.
    • V1.1
      • Fixed negative-valued upgrades not getting price increases.
      • Fixed resetting of all players in a weird way. Causes respawning.
    • V1.0
      • Initial Release!
    Attached Files
    File Type: sp Get Plugin or Get Source (sm_tf2_upgrades.sp - 792 views - 27.3 KB)
    File Type: smx sm_tf2_upgrades.smx (25.6 KB, 956 views)
    File Type: txt sm_tf2_upgrades.phrases.txt (1.4 KB, 1126 views)
    File Type: txt uu_upgrades.txt (51.4 KB, 1024 views)

    Last edited by xkirby; 06-12-2013 at 18:42. Reason: Updated the plugin again, screenshots are out of date now.
    xkirby is offline
    Happy DODs player
    AlliedModders Donor
    Join Date: Sep 2009
    Old 05-11-2013 , 06:12   Re: [TF2] Universal Upgrades
    Reply With Quote #2

    Sounds pretty good must say. So i ads some money to buy.: Faster movement, faster firing speed. That sorts of stuff ?

    May i ask if you can post some screenshots from your menu's.

    Think i ll test it later this weekend on one of my gameservers.

    --------------------------

    Edit: Got it working.. Works pretty decent. Kudos.
    __________________

    Last edited by Happy DODs player; 05-11-2013 at 07:20.
    Happy DODs player is offline
    Mr. Man
    Veteran Member
    Join Date: Mar 2011
    Location: Huh?
    Old 05-11-2013 , 09:09   Re: [TF2] Universal Upgrades
    Reply With Quote #3

    Good to see someone finally ported the upgrade feature from MVM to a regular server. I will be testing this babe out!
    Mr. Man is offline
    xkirby
    Member
    Join Date: Dec 2012
    Location: I live somewhere.
    Old 05-11-2013 , 09:12   Re: [TF2] Universal Upgrades
    Reply With Quote #4

    Thanks for the replies, folks. Yeah, I wanted to have MVM-styled upgrades in normal gamemodes.

    There is a slight bug with it, though, in that I forgot to make Cost Increases work with upgrades that lower values (Firing Rate, Reload Rate, etc.), so I guess I have to fix that.

    I'll get some screenshots shown in a few minutes, after I fix that bug.

    EDIT: Fixed the bug mentioned above, as well as an item resetting bug. Item resetting is done by switching the player's class twice and removing their weapons in between both switches. I'll get to uploading the screenshots and plugin to the first post in a minute.

    Last edited by xkirby; 05-11-2013 at 10:11.
    xkirby is offline
    lobnico
    Member
    Join Date: Sep 2012
    Old 05-11-2013 , 10:24   Re: [TF2] Universal Upgrades
    Reply With Quote #5

    This is really good work and good piece of code,
    but damn,
    why not much people notice that this mod already exists ?


    https://forums.alliedmods.net/showthread.php?t=214600

    Too bad we couldn't have met our development before D:

    Gonna test this mod to see the differences with the other one.
    lobnico is offline
    xkirby
    Member
    Join Date: Dec 2012
    Location: I live somewhere.
    Old 05-11-2013 , 13:37   Re: [TF2] Universal Upgrades
    Reply With Quote #6

    I saw yours already, but I had already made mine a while ago. I just figured I'd release mine and people could have a choice.

    It's true, though, not many people noticed yours either. Hopefully a bunch of people notice both of the plugins.

    I barely know anything about SourceMod's coding, so what's in the file is pretty much trial and error as well as experimenting and reading the example file for TF2Attributes.
    xkirby is offline
    Oshizu
    Veteran Member
    Join Date: Nov 2012
    Location: Warsaw
    Old 05-11-2013 , 15:18   Re: [TF2] Universal Upgrades
    Reply With Quote #7

    Got Two Suggestions:

    Make it print instead of [P] - [Player] and instead of [W] - [Weapon]

    Add After [Weapon] or [Player] tag [XXX$] example: [Weapon] [200$] Damage 25%+
    We don't know in menu how much we lack to buy upgrade. That would be good change
    But don't forget to make [XXX$] change when price goes up due to upgrades bought by player.
    __________________
    ...

    Last edited by Oshizu; 05-11-2013 at 18:31.
    Oshizu is offline
    Happy DODs player
    AlliedModders Donor
    Join Date: Sep 2009
    Old 05-12-2013 , 08:03   Re: [TF2] Universal Upgrades
    Reply With Quote #8

    Xkirby thanks for the bug fix, uploaded the new version on a server of my n,

    further is it maybe possible that the amount of cash a player has. Is viewable without that they need to write it down in game.
    __________________
    Happy DODs player is offline
    xkirby
    Member
    Join Date: Dec 2012
    Location: I live somewhere.
    Old 05-12-2013 , 08:44   Re: [TF2] Universal Upgrades
    Reply With Quote #9

    @Happy DODs Player:
    I guess I could do that, but depending on how much time I have today it'll either be done quickly or it'll have to wait a while.

    Either way, I think it's a good idea.

    @:Oshizu
    I did add that check, but unfortunately I had no idea how to actually force it into the main menu. That's why a panel shows up once you try to buy an upgrade. It's out of my coding knowledge at this point in time, sorry.

    The [P] and [W] are part of the "uu_upgrades.txt" file, which is editable. You can freely switch those over to [Weapon] and [Player] if you choose to do so.

    Last edited by xkirby; 05-12-2013 at 08:45.
    xkirby is offline
    Oshizu
    Veteran Member
    Join Date: Nov 2012
    Location: Warsaw
    Old 05-12-2013 , 08:59   Re: [TF2] Universal Upgrades
    Reply With Quote #10

    Quote:
    Originally Posted by xkirby View Post
    @Happy DODs Player:
    I guess I could do that, but depending on how much time I have today it'll either be done quickly or it'll have to wait a while.

    Either way, I think it's a good idea.

    @:Oshizu
    I did add that check, but unfortunately I had no idea how to actually force it into the main menu. That's why a panel shows up once you try to buy an upgrade. It's out of my coding knowledge at this point in time, sorry.

    The [P] and [W] are part of the "uu_upgrades.txt" file, which is editable. You can freely switch those over to [Weapon] and [Player] if you choose to do so.
    Maybe try create menu not on mapstart but when player types !upgrade command
    Like this
    PHP Code:
    public OnPluginStart()
    {
     
    RegConsoleCmd("sm_upgrade"UpgradeMenu);
    }
     
    public 
    Action:UpgradeMenu(clientargs)
    {
     new 
    Handle:cm CreateMenu(UpgradeMenuCallback);
     
    SetMenuTitle(cm"Some STUFF.");
     
    AddMenuItem(cm"0"Some STUFF");
     DisplayMenu(cm, client, MENU_TIME_FOREVER);
     return Plugin_Handled;

    That way you can get player's id who currently is in menu (example if(Currency[client] == ???). So you can display price and raise it if player id have already increased price of it.
    If you don't know how to display stuff in menu. Read in documentation about Format function
    Something like this:
    PHP Code:
    decl String:msg[512];
    Format(msgsizeof(msg), "[%i$] %s"PriceAfterIncrease[client], NameOfAttribute);
    AddMenuItem(cm"0"msg); 
    __________________
    ...

    Last edited by Oshizu; 05-12-2013 at 09:00.
    Oshizu 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 22:18.


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