Raised This Month: $ Target: $400
 0% 

[TF2] Random Round Modifiers [v.1.0] [5/22/2016]


Post New Thread Reply   
 
Thread Tools Display Modes
Author
Chaosxk
Veteran Member
Join Date: Aug 2010
Location: Westeros
Plugin ID:
5187
Plugin Version:
1.0
Plugin Category:
Gameplay
Plugin Game:
Team Fortress 2
Plugin Dependencies:
    Servers with this Plugin:
     
    Plugin Description:
    Make your rounds unique, randomize them!
    Old 05-13-2016 , 22:28   [TF2] Random Round Modifiers [v.1.0] [5/22/2016]
    Reply With Quote #1

    [TF2] Random Round Modifier v.1.0

    Description:
    This plugin will pick a random modifier(sub-plugin) and a random value for that modifier for each round. The possibilities are endless and every round will have a unique twist.

    What are modifiers?
    They modify/add certain effects on every player on server to make the round different and more fun.

    For example, one of the modifiers is called Random Head-shot explosion. The first round could make all head shots create an explosion. The second round could make melee damage increase to 350%. The third round could increase everyone speed to 150%. It's all random!

    There can only be 1 active modifier per round. And will work for any map.
    You can also write your own modifier!

    Modifiers:
    Note: Values are percentage, so multiply by 100 to get percent. (E.g 1.0 => 1.0x100 = 100%)
    Quote:
    Backstab Damage Modifier - (0.01-3.0)
    Plugin: rrm_backstabdamage.smx
    - Modifier that changes backstab damage.

    Critical Modifier - (0.5-1.0)
    Plugin: rrm_crits.smx
    - Modifier that changes critical chance.

    Damage Modifier - (0.5-3.0)
    Plugin: rrm_damage.smx
    - Modifier that changes damage done.

    Explosive Headshots Modifier
    Plugin: rrm_exphs.smx
    - Modifier that sets off an explosion on a headshot.

    Gravity Modifier - (0.1-0.5)
    Plugin: rrm_gravity.smx
    - Modifier that changes players' gravity.

    Heal on hit Modifier - (0.05-0.2)
    Plugin: rrm_healonhit.smx
    - Modifier that heals players by how much damage they did to others.

    Headshot Damage Modifier - (0.1-2.0)
    Plugin: rrm_hsdamage.smx
    - Modifier that changes headshot damage.

    Jump Modifier - (0.5-3.0)
    Plugin: rrm_jump.smx
    - Modifier that changes the jump height of players.

    Melee Damage Modifier - (2.0-3.5)
    Plugin: rrm_meleedamage.smx
    - Modifier that changes damage done from your melee weapon.

    Melee Only Modifier
    Plugin: rrm_meleeonly.smx
    - Modifier that force everyone to melee.

    Primary Damage Modifier - (1.5-2.5)
    Plugin: rrm_primarydamage.smx
    - Modifier that changes damage done from your primary weapon.

    Scary Bullets Modifier - (0.1-1.0)
    Plugin: rrm_scarybullets.smx
    - Modifier that grants chance of scary bullets.

    Secondary Damage Modifier - (1.5-2.5)
    Plugin: rrm_secondarydamage.smx
    - Modifier that changes damage done from your secondary weapon.

    Sentry Damage Modifier - (0.5-2.5)
    Plugin: rrm_sentrydamage.smx
    - Modifier that changes sentry damage.

    Speed Modifier - (0.5-2.0)
    Plugin: rrm_speed.smx
    - Modifier that changes the the speed of players.
    Dependency:
    Quote:
    - Sourcemod 1.7+
    - Metamod 1.10+
    - TF2Attributes
    - morecolors.inc to compile
    - rrm.inc to compile
    Installation:
    Quote:
    Download RRM.7z and unpack it. Open and place addons/ and cfg/ folder to your /tf directory
    Make sure to place rrm.smx in plugins folder and the subplugins in plugins/rrm directory
    How to remove a modifier?:
    Quote:
    Each modifier is a sub-plugin
    1. Go to addons/sourcemod/plugins/rrm folder
    2. Find the plugin of the modifier you don't want
    3. Delete it
    After doing that unload/load or restart server and that modifier will be removed from the core.
    Commands:
    Quote:
    sm_rrmroll - Rerolls the modifier
    ConVars:
    Note: These convars are located in cfg/rrm
    Spoiler


    Version Log:
    Quote:
    1.0 -
    Added 5 new modifiers (Jump, Secondary Damage, Primary Damage, Melee Damage, Gravity)
    Added cvars for each sub-plugins
    Fixed timer OnModifierUnloaded from stack error when there are 0 modifiers loaded
    Timer will additionally remove sub-plugins from core that gets unloaded
    Removed debug messages
    If plugin is late-loaded, core will automatically find a new modifier
    Clean/Tidy coding and description of core/sub-plugins
    Replace HUD messages with default color messages
    Forgot to add core source-code

    0.01 - Beta testing release
    Github source: Here

    If you encounter any bugs just report it here and i will try to fix it asap.

    Enjoy
    Attached Files
    File Type: 7z RRModifier.7z (112.7 KB, 357 views)
    __________________

    Last edited by Chaosxk; 05-22-2016 at 19:24.
    Chaosxk is offline
    Chaosxk
    Veteran Member
    Join Date: Aug 2010
    Location: Westeros
    Old 05-13-2016 , 22:28   Re: [TF2] Random Round Modifiers [1.0] [5/22/2016]
    Reply With Quote #2

    For developers:

    Natives:
    PHP Code:

    functag RRMTag 
    public(bool:enableFloat:value);

    /**
     * Registers the modifier into the core
     *
     * @char str        Name of the modifier that will be printed on round start
     * @float min        The minimum value for random number generator (Set to 0.0 to ignore, value must be positive)
     * @float max        The maximum value for random number generator (Set to 0.0 to ignore, value must be positive)
                         If min is 1.0 and max is 0.0 then the result will always be 1.0
                         If max is 2.0 and min is 0.0 then the result will always be 2.0
                         If min and max are both 0.0 then result will be 0.0
     * @negate            If true, the random value will randomly become negative
                         (E.G useful if you want to determine whether to reduce/increase something)
     * @RRMTag func       The return function callback that the core plugin will call
     * @return            Returns 1 if successful register, 0 otherwise
     */
    native int RRM_Register(char[] strfloat minfloat maxbool negateRRMTag:func);

    /**
     * Registers the modifier into the core
     *
     * @return        Returns 1 if registering is open, 0 otherwise
     */
    native int RRM_IsRegOpen(); 
    Forwards:
    PHP Code:
    /**
     * This forward will fire when RRM is ready to accept registrating
     * RRM_Register should ALWAYS be executed in this forward.
     */
    forward RRM_OnRegOpen(); 
    __________________

    Last edited by Chaosxk; 05-22-2016 at 19:12.
    Chaosxk is offline
    Chaosxk
    Veteran Member
    Join Date: Aug 2010
    Location: Westeros
    Old 05-13-2016 , 22:30   Re: [TF2] Random Round Modifiers [1.0] [5/22/2016]
    Reply With Quote #3

    For Developers:

    Example code with comments:
    PHP Code:
    #define RRM_VERSION "0.01"

    #include <sourcemod>
    #include <sdkhooks>
    #include <tf2attributes>
    #include <tf2>
    #include <tf2_stocks>
    #include <rrm>

    #pragma newdecls required

    int gEnabled 0;
    float gChance 0.0;
    ConVar cMin nullcMax null;
    float gMin 0.0gMax 0.0;

    public 
    Plugin myinfo 
    {
        
    //RRM_AUTHOR and RRM_URL is defined in .inc
        //RRM_VERSION is defined in this plugin
        
    name "[RRM] Critical Modifier Example",
        
    author RRM_AUTHOR,
        
    description "Simple example plugin that will enable/disable and modifies critical chance.",
        
    version RRM_VERSION,
        
    url RRM_URL
    };

    public 
    void OnPluginStart()
    {
        
    //These are our convars
        
    cMin CreateConVar("rrm_crits_min""0.5""Minimum value for the random number generator.");
        
    cMax CreateConVar("rrm_crits_max""1.0""Maximum value for the random number generator.");
        
        
    //We hook them if user decides to change them and forward them to OnConvarChanged
        
    cMin.AddChangeHook(OnConvarChanged);
        
    cMax.AddChangeHook(OnConvarChanged);
        
        
    //We cache the variables to gMin and gMax
        
    gMin cMin.FloatValue;
        
    gMax cMax.FloatValue;
        
        
    //RRM_IsRegOpen will return true if we can register modifiers
        //The purpose of this is to ensure we do not encounter problems on late-load
        //This must always be executed
        //If registering is open, then we run RegisterModifiers() which will run our function we defined below
        
    if(RRM_IsRegOpen())
            
    RegisterModifiers();
        
        
    //We create a config with out convars called rrm_crits.cfg to cfg/rrm folder
        
    AutoExecConfig(true"rrm_crits""rrm");
    }

    //RRM_OnRegOpen() is our forward
    //If RRM_IsRegOpen did not succeed then RRM_OnRegOpen will be forwarded to here when it does open
    public int RRM_OnRegOpen()
    {
        
    RegisterModifiers();
    }

    //On this function we register this modifier with RRM_Register
    //First parameter is the name, this will be used and printed on round start
    //gMin and gMax are the convar values, the random number generator will pick a value between them and return it to callback function
    //The 4th argument is negate which IF true will negate the random value between min and max, mostly you won't need it
    //If min = 0.5 and max is 1.0 and negate is true then results can be -1.0 to -0.5 AND 0.5 to 1.0
    //The last argument will be the callback function, it will be the function that the core will call to this plugin
    void RegisterModifiers()
    {
        
    RRM_Register("Critical hits"gMingMaxfalseRRM_Callback_Crits);
    }

    //Our convar changed callback
    //We set our cache values to the updated one whenever a convar is changed
    public void OnConvarChanged(Handle convarchar[] oldValuechar[] newValue)
    {
        if (
    StrEqual(oldValuenewValuetrue))
            return;
            
        
    float fNewValue StringToFloat(newValue);
        
        if(
    convar == cMin)
            
    gMin fNewValue;
        else if(
    convar == cMax)
            
    gMax fNewValue;
    }

    //This is our callback function that the core plugin will call
    //Parameter will be true if core is setting this modifier active, false to turn off
    //Value is return of random value between min and max values that you passed in RRM_Register
    //If value is negative that is because you passed true in the negate parameter in RRM_Register
    public int RRM_Callback_Crits(bool enablefloat value)
    {
        
    //Here we store our global enable variable to equal enable
        //enable is what the core plugin will give depending on whether or not to turn on or off
        //value will be the result between min and max
        
    gEnabled enable;
        if(
    gEnabled)
        {
            
    //we store the value to our global variable to use later
            
    gChance value;
        }
        return 
    gEnabled;
    }

    public 
    Action TF2_CalcIsAttackCritical(int clientint weaponchar[] weaponnamebool &result)
    {
        
    //If core enables plugin, this will enable
        
    if(!gEnabled)
            return 
    Plugin_Continue;
        
    //Here we use the stored variable and do some calculations to get crit chance
        
    if(gChance GetRandomFloat(GetRandomFloat(0.01.0)))
            
    result true;
        else
            
    result false;
        return 
    Plugin_Changed;

    __________________

    Last edited by Chaosxk; 05-22-2016 at 19:20.
    Chaosxk is offline
    Chaosxk
    Veteran Member
    Join Date: Aug 2010
    Location: Westeros
    Old 05-22-2016 , 19:21   Re: [TF2] Random Round Modifiers [1.0] [5/22/2016]
    Reply With Quote #4

    Update to 1.0, here are changelog:
    Also updated the O.P with better formatting, and added developer natives/forwards/example plugins for 2nd and 3rd post.

    Code:
    1.0 -
    Added 5 new modifiers (Jump, Secondary Damage, Primary Damage, Melee Damage, Gravity) (See O.P for description about them)
    Added cvars for each sub-plugins
    Fixed timer OnModifierUnloaded from stack error when there are 0 modifiers loaded
    Timer will additionally remove sub-plugins from core that gets unloaded
    Removed debug messages
    If plugin is late-loaded, core will automatically find a new modifier
    Clean/Tidy coding and description of core/sub-plugins
    Replace HUD messages with default color messages
    Forgot to add core source-code
    __________________

    Last edited by Chaosxk; 05-22-2016 at 19:22.
    Chaosxk is offline
    Jonnhy934
    New Member
    Join Date: Aug 2020
    Old 08-16-2020 , 02:18   Re: [TF2] Random Round Modifiers [v.1.0] [5/22/2016]
    Reply With Quote #5

    Hello! You think you can make a version to add the sounds / visual effect exacly like we have in the Wario Ware and Slender Fortress Special Rounds?

    here an example: https://youtu.be/hh9cCF51Sb4?t=12
    Jonnhy934 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 02:17.


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