Raised This Month: $ Target: $400
 0% 

[TF2] Roll The Dice Revamped (RTD) (v2.5.5, 1 May 2024)


Post New Thread Reply   
 
Thread Tools Display Modes
Author
Phil25
AlliedModders Donor
Join Date: Feb 2015
Plugin ID:
5030
Plugin Version:
2.5.5
Plugin Category:
Fun Stuff
Plugin Game:
Team Fortress 2
Plugin Dependencies:
Servers with this Plugin:
641 
Plugin Description:
Lets players roll for temporary benefits.
Old 02-03-2016 , 17:13   [TF2] Roll The Dice Revamped (RTD) (v2.5.5, 1 May 2024)
Reply With Quote #1

[TF2] Roll The Dice Revamped v2.5.5
Rewrite of pheadxdll's Roll The Dice. Kudos to him for a great idea.


Description:
Roll The Dice mod for Team Fortress 2. It allows players to "roll the dice" for one of 82 random effects, some good, some bad. The effect will be applied for its custom time to the player and removed afterwards.
This plugin comes with many customization options (see "ConVars" or "Customizing Perks") and developer tools (see "For developers").
Roll The Dice (Revamped) is a rewrite of pheadxdll's Roll The Dice with numerous features added, most notable of which are listed here:
  • Requires SourceMod 1.11 or higher.
  • 48 new perks added, making up a total of 82 perks.
  • (for devs) An easy way of adding completely custom perks.
  • Fixed some overpowered/broken effects.
  • Highly customizable config, with different settings for nearly each effect.
  • Added sm_rtd command for rolling, bindable for players.
  • Added sm_removertd command to force remove perks from anyone.
  • Improved sm_forcertd to include custom time.
  • HUD-based perk timer display, with ConVar-adjustable position.
  • Limiting any perk to any class(es).
  • Setting custom initiation sound to any perk.
  • Setting custom time to any perk.
  • Possibility to interchange perks' call functions.
  • Built-in perk search-up, with custom output format option.
  • Improved perk addressing, with support for adding custom target strings.
  • The original version's Legacy mode can be limited to a number of players.
  • Setting how many times a perk is not allowed to repeat per player/globally.
  • Improved the rolling algorithm.
  • (for devs) More advanced and fixed include file.
  • (for devs) Written in the new syntax.
  • More flexible way of disabling perks.
  • Other plugins can add their own perks and handle their effect themselves.
  • Other plugins can override an effect of any perk.
  • Updater support.

Perk List
Commands
ConVars
Customizing Perks
‣ For developers:

Read me if updating from before version 2.0.0

Installation:
  1. Install TF2Attributes.
  2. Download rtd-X.X.X.zip and unload the contents to the tf/addons/sourcemod/ folder, preserving the directory structure.
  3. Now, either restart the server or type "sm plugins reload rtd" in the console.
  4. Run sm_reload_translations when
    • installing for the first time or
    • updating with different translation files.
  5. OPTIONAL: Install Updater to keep this plugin automatically up to date.
    • New perks will be added automatically,
    • New features will be added automatically,
    • All your custom configs will be preserved.


Last edited by Phil25; 05-01-2024 at 12:39.
Phil25 is offline
Phil25
AlliedModders Donor
Join Date: Feb 2015
Old 02-03-2016 , 17:13   Re: [TF2] Roll The Dice (Revamped)
Reply With Quote #2

ATTENTION: These tutorials are outdated! Please review the newest API documentation and examples here.

Tutorial on Adding Custom Perks
Note: There are two types of perks - Core & External:
  • Core perks are added via editing the RTD plugin, External ones are added via a different plugin.
  • Core perks have consistent IDs specified in the config file, whereas External ones do not necessarly have a consistent ID and they are always greater than the last core perk's ID.
  • Core perks have custom settings in the config file, but External ones have to handle different perk settings themselves.
  • You will have to update your custom Core perks with new RTD releases.

External Perks:
1. Register the perk using the RTD2_RegisterPerk() native.
  • Look in the Include File under For Developers in the main post for an in-depth explanation.
  • A practical usage could be found in the example plugin attached to this post.
2. RTD2_RegisterPerk() should be used in 2 instances:
  1. In OnPluginStart(), but only when the RTD2_IsRegOpen() native returns TRUE. (to account for late load)
  2. Each time in the RTD2_OnRegOpen() forward. (regular perk registration)
3. Last parameter of RTD2_RegisterPerk() is the callback function with parameters:
  1. int client – The client index to set the perk to, guaranteed to be valid.
  2. int perk ID – Your custom perk's ID which was given to it upon registration with RTD2_RegisterPerk().
  3. bool apply - TRUE if perk should be applied, FALSE if perk should be removed; FALSE is never passed on instant perks.
4. A few notes:
  • Perks cannot be unregistered once registered. You can use the RTD2_SetPerkBy*() natives to disable them.
  • If an existent token is passed in the RTD2_RegisterPerk() native, it will override the functionality of a perk with that token. This applies to Core perks as well.
  • If a Core perk's functionality has been overriden, you can use the RTD2_DefaultCorePerk() native to set it back to default. This native should not be used on External perks.
  • If your perks hurts other players with SDKHooks_TakeDamage(), I advise you to use the RTD2_CanPlayerBeHurt() native, as it additionally checks whether the player is in Friendly Mode.

Core Perks (simple):
  1. Put your perk's .sp in the scripting/rtd/ folder.
  2. Create a function in it with parameters: (int client, char[] const sPref, bool apply)
  3. Include your perk in scripting/rtd/#perks.sp.
  4. Add your perk to the rtd2_perks.cfg and configure it, having the ID consistency in mind.
  5. Add your initialization function to the switch() statement in the ManagerPerk() function of the scripting/rtd/#manager.sp.

Core Perks (detailed):
First, to clarify, in order to add a custom Core perk, you don't need to edit the base rtd2.sp in the slightest. Everything you need to edit is in the scripting/rtd/ folder.
Before you get started, you should familiarize yourself with the Detailed Breakdown of the rtd2_perks.cfg.

Start Up
  1. Create an .sp with your desired perk's name and place it in the scripting/rtd folder.
  2. This file is where all the magic happens, you can go ahead and use this template:
    Template
  3. Create a function in that script with which you want to initiate an enable or a disable of your perk. For template, see: PerkName_Perk()
  4. Head over to scripting/rtd/#perks.sp and include your .sp.
  5. Head over to scripting/rtd/#manager.sp and add your initiation function in the switch() statement of the ManagePerk() function.

The #manager.sp
  1. This is what actualy invokes your perk, specifically the ManagePerk() function.
  2. This function is all you need for your perk to work. However, if you want to provide some more functionality, check out the forwards below.
  3. If you wish to use any forward, let's say you want to precache a sound in OnMapStart(), go to Forward_OnMapStart() and add a function corresponding to the one in your perk's .sp.
  4. You can use these forwards in any way you like, but if there's an Action type one, you won't be able to return Plugin_Handled in order to stop it.

Configure rtd2_perks.cfg
  1. Make sure that when adding your perk, its ID is greater than the previous one by 1. They have to be consistent.
  2. Configure the rest. Once more, make sure you'd understood Detailed Breakdown of the config file.

Your .sp
  1. The initiation function:
    • This function is used to enable or disable a perk on a client.
    • Parameters:
      1. (int) client - the client index. It is guaranteed to be a valid, non-bot client.
      2. (char) sPref - the perk's own settings string, found in rtd2_perks.cfg. For more info, go to "Detailed Breakdown" of the Config file.
      3. (bool) apply - Should the perk be applied (true) or removed (false)? For instant ("time" set to -1) perks, false never occures.
  2. From the initiation function, forward the functionality to the rest of the script.

Some valuable stocks:


If anything needs to be clarified, go ahead and post a comment. I'm pretty sure I'll be editing this tutorial from time to time.
Attached Files
File Type: sp Get Plugin or Get Source (rtd2_externalperks.sp - 1541 views - 3.7 KB)
File Type: smx rtd2_externalperks.smx (5.0 KB, 2051 views)

Last edited by Phil25; 09-30-2018 at 15:19.
Phil25 is offline
Hefal
Senior Member
Join Date: Jul 2015
Old 02-03-2016 , 17:18   Re: [TF2] Roll The Dice (Revamped)
Reply With Quote #3

Great job! The new perk list looks very interesting, fetching this right away and replacing the old RTD
Hefal is offline
Pala4
Senior Member
Join Date: Dec 2007
Old 02-04-2016 , 23:33   Re: [TF2] Roll The Dice (Revamped)
Reply With Quote #4

What did I do wrong? I go the error in the log.

Spoiler
Pala4 is offline
Phil25
AlliedModders Donor
Join Date: Feb 2015
Old 02-04-2016 , 23:49   Re: [TF2] Roll The Dice (Revamped)
Reply With Quote #5

Quote:
Originally Posted by Pala4 View Post
What did I do wrong? I go the error in the log.

Spoiler
I actually released a version which fixes that issue about an hour before your comment.
Phil25 is offline
Pala4
Senior Member
Join Date: Dec 2007
Old 02-05-2016 , 16:12   Re: [TF2] Roll The Dice (Revamped)
Reply With Quote #6

Quote:
Originally Posted by Phil25 View Post
I actually released a version which fixes that issue about an hour before your comment.

Thank you everything works without errors.
Pala4 is offline
Phil25
AlliedModders Donor
Join Date: Feb 2015
Old 02-06-2016 , 21:12   Re: [TF2] Roll The Dice (Revamped)
Reply With Quote #7

New version important note:
There now 2 config files: rtd2_perks.default.cfg and rtd2_perks.custom.cfg.
If you wish to override a value, you should stick to editing rtd2_perks.custom.cfg only (see examples in the file itself).
You may go ahead and delete the old rtd2_perks.cfg.
Phil25 is offline
ddhoward
Veteran Member
Join Date: May 2012
Location: California
Old 02-06-2016 , 21:29   Re: [TF2] Roll The Dice (Revamped)
Reply With Quote #8

Before this gets more popular, I'd recommend removing the "2" from the filenames and such. It's not needed, as servers should not be running both this and the other plugin.
__________________

Last edited by ddhoward; 02-06-2016 at 21:29.
ddhoward is offline
Phil25
AlliedModders Donor
Join Date: Feb 2015
Old 02-06-2016 , 22:45   Re: [TF2] Roll The Dice (Revamped)
Reply With Quote #9

Quote:
Originally Posted by ddhoward View Post
Before this gets more popular, I'd recommend removing the "2" from the filenames and such. It's not needed, as servers should not be running both this and the other plugin.
Now that... that is a very good point. I uploaded new .zip which contains rtd.smx, I'm gonna keep the config and translation files with the "2" as to differentiate between the versions.

To anyone who has installed this RTD on their server:
You must remove rtd2.smx and replace it with rtd.smx found it the newly uploaded .zip.
I apologize for the inconvenience.
Phil25 is offline
CrazyGhostRider
Member
Join Date: Apr 2014
Location: Russia
Old 03-02-2016 , 12:14   Re: [TF2] Roll The Dice (Revamped)
Reply With Quote #10

Added Russian language
Attached Files
File Type: txt rtd2.phrases.txt (6.6 KB, 1029 views)
CrazyGhostRider is offline
Reply


Thread Tools
Display Modes

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:30.


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