Raised This Month: $32 Target: $400
 8% 

[NMRiH] Supply Chances (v1.1.2, 2018-12-31)


Post New Thread Reply   
 
Thread Tools Display Modes
Author
Ryan.
Member
Join Date: Jan 2018
Plugin ID:
6171
Plugin Version:
1.1.2
Plugin Category:
Gameplay
Plugin Game:
No More Room in Hell
Plugin Dependencies:
    Servers with this Plugin:
     
    Plugin Description:
    Adjust spawn chances of inside inventory boxes.
    Old 06-20-2018 , 00:44   [NMRiH] Supply Chances (v1.1.2, 2018-12-31)
    Reply With Quote #1

    Customize the chance for items to spawn inside a supply box. The plugin uses config files to define items spawn chances. Users can switch configs mid-game without having to restart the server.

    Supply Chance configs can define multiple "box types". When a supply box spawns, it will randomly pick one box type to use as its inventory chances. A box type has a weight (how likely it is to be picked) and can override the spawn chances for items in all three categories: weapons, gear and ammo.

    The weapon and gear categories are interchangeable; weapon and medical items can appear in either. The ammo category should just contain ammo types as it is handled differently by the game.

    The box's weight is designed to be similar NMRiH's random_spawner:
    • If the sum of all box weights is greater than 100.0, they're normalized so their sum equals 100.0
    • If the sum of all weights is less than 100.0, they're left as-is with the leftover chance being the chance for a normal item or box to spawn
    • If an item or box type has a weight of 0 then it will never be selected

    ConVars
    • sm_supply_chances_config ""
      • Name of supply chance config file (excluding extension). Configs should be placed in sourcemod/configs

    Example config
    PHP Code:
    "custom-chances"
    {
        
    "lucky loot"
        
    {
            
    "weight" "90" // Will be picked 90 out N times where N is sum of weight of all box types
            // If N is less than 100, the difference (100 - N) is the chance for a vanilla inventory box to spawn

            
    "model" "models/survival/item_safezonerepairbox.mdl" // Model to force boxes of this type to use.

            
    "weapons"
            
    {
                
    // 0.5% chance for saws to spawn
                
    "me_chainsaw" "0.5"
                "me_abrasivesaw" "0.5"

                
    // 2% chance for a particular tool
                
    "tool_extinguisher" "2"
                "tool_welder" "2"
            
    }

            
    "gear"
            
    {
                
    // 3% chance to spawn a grenade of any type
                
    "exp_molotov" "1"
                "exp_grenade" "1"
                "exp_tnt" "1"
            
    }
        }

        
    "no boards!"
        
    {
            
    // Default weight is 100

            
    "ammo"
            
    {
                
    "ammobox_board" "0"  // 0% chance to spawn boards
            
    }
        }

        
    "just .22"
        
    {
            
    "weight" "5" // This box is far less likely to be picked than a box with 100 weight

            
    "weapons"
            
    {
                
    "fa_mkiii" "60"
                "fa_1022" "30"
                "fa_1022_25mag" "10"
            
    }

            
    "ammo"
            
    {
                
    "ammobox_22lr" "100"
            
    }
        }

    Forwards
    PHP Code:
    // Return anything but Plugin_Continue to stop Supply Chances affecting the item box.
    Action OnSupplyChancesModifyBox(int item_box); 
    Changelog
    1.1.2 - 2018-12-31
    • Updated gamedata to support NMRiH version 1.10

    1.1.1
    • Fixed custom models not updating inventory boxes' collision -- Thanks Flammable

    1.1
    • Added "model" key to box type -- Thanks Flammable
    • Added OnSupplyChancesModifyBox forward
      • Third party plugins may implement this function and return Plugin_Stop to prevent Supply Chances from affecting it
    Attached Files
    File Type: zip nmrih-supply-chances-1.1.2.zip (25.1 KB, 277 views)
    __________________

    Last edited by Ryan.; 12-31-2018 at 16:07. Reason: Updated to v1.1.2
    Ryan. is offline
    Flammable
    Junior Member
    Join Date: Jun 2018
    Location: Russia
    Old 06-20-2018 , 02:12   Re: [NMRiH] Supply Chances (v1.0, 19/06/2018)
    Reply With Quote #2

    Can you write an example of using sm_supply_chances_config? I'v been trying for 15 minutes diffrent variations of using it and i did not get how to do it properly, i kept spawning regular inventory boxes, no changes applied.

    btw, how about adding custom model cvar into this plugin, like i suggested before? just imagine, you can set model of inventory box to some tool box, and iside we will only have barricades and hammers. Then set model to some huge med box, and have only medicine inside, etc.

    Last edited by Flammable; 06-20-2018 at 02:12.
    Flammable is offline
    Ryan.
    Member
    Join Date: Jan 2018
    Old 06-20-2018 , 03:04   Re: [NMRiH] Supply Chances (v1.0, 19/06/2018)
    Reply With Quote #3

    Try typing "sm_supply_chances_config supply-chances-demo" into the console to load the demo config. This file shows off some of the plugin's features like disabling lousy melee weapons, adding grenades, etc. It's located in your sourcemods/configs directory. You can make your own config in the same directory. Just be sure it ends in .cfg and has a "custom-chances" block. If you make a config called flammable.cfg you would type "sm_supply_chances_config flammable" into the console.

    Forgot to mention that changing the config cvar won't update existing inventory boxes on the level. Only the boxes that spawn after you assign the config will be affected. You can set your default config by editing plugin.supply-chances.cfg inside nmrih/cfg/sourcemod.

    Good idea about the models. I'll see to adding it.

    Last edited by Ryan.; 06-20-2018 at 03:08.
    Ryan. is offline
    Flammable
    Junior Member
    Join Date: Jun 2018
    Location: Russia
    Old 06-20-2018 , 14:29   Re: [NMRiH] Supply Chances (v1.0, 19/06/2018)
    Reply With Quote #4

    Now i get how it works, was not that hard, it's worked in the first place i just did not notice that. Waiting for model options, there is so much cool models could be used for diffrent box types. Btw, lifehack, if you want to spawn nothing, you can place fists inside of the slot and box will be empty in selected slot

    "custom-chances"
    {
    "just 4 barricades"
    {
    "weight" "100"

    "weapons"
    {
    "me_fists" "100"
    }

    "gear"
    {
    "tool_barricade" "100"
    }

    "ammo"
    {
    "me_fists" "100"
    }
    }
    }
    Flammable is offline
    Ryan.
    Member
    Join Date: Jan 2018
    Old 06-20-2018 , 22:10   Re: [NMRiH] Supply Chances (v1.1, 20/06/2018)
    Reply With Quote #5

    Updated to version 1.1. Box types can now specify custom models.
    PHP Code:
    "custom-chances"
    {
        
    "FEMA box look-alike"
        
    {
            
    "model" "models/survival/item_safezonerepairbox.mdl"
        
    }

    I also updated the Backpack plugin so it cooperates better with Supply Chances.
    __________________
    Ryan. is offline
    Flammable
    Junior Member
    Join Date: Jun 2018
    Location: Russia
    Old 06-21-2018 , 02:19   Re: [NMRiH] Supply Chances (v1.1, 20/06/2018)
    Reply With Quote #6

    I'v checked new Backpack updates, looks like everything works fine, good job.

    But update of Supply Chances is having an issue, the model is changing, and it's already better then nothing, but the physics remains the same as if it was a huge box. here is video demonstration: https://youtu.be/VIgItWY7JpM

    The only way i found to fix it, is to make inventory_box unsolid using ent_control, so players can get close to smaller boxes, but they are still huge boxes :/

    Even if i preload supply settings it's still huge box physics.
    Flammable is offline
    Ryan.
    Member
    Join Date: Jan 2018
    Old 06-21-2018 , 04:12   Re: [NMRiH] Supply Chances (v1.1.1, 21/06/2018)
    Reply With Quote #7

    Ah damn, good catch. My QOL config had inventory box collisions disabled so I didn't notice. Should be fixed in 1.1.1.
    Ryan. is offline
    Ryan.
    Member
    Join Date: Jan 2018
    Old 12-31-2018 , 16:08   Re: [NMRiH] Supply Chances (v1.1.2, 2018-12-31)
    Reply With Quote #8

    Updated plugin's gamedata to support NMRiH version 1.10.
    __________________
    Ryan. is offline
    MsDysphie
    AlliedModders Donor
    Join Date: Dec 2017
    Old 07-09-2022 , 00:59   Re: [NMRiH] Supply Chances (v1.1.2, 2018-12-31)
    Reply With Quote #9

    Fork with NMRiH 1.12.3 support:

    https://github.com/dysphie/nmrih-supply-chances-ex
    __________________
    Discord: @dysphie
    Donations: ko-fi.com/dysphie
    MsDysphie 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 11:44.


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