AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Plugins (https://forums.alliedmods.net/forumdisplay.php?f=108)
-   -   [NMRiH] Supply Chances (v1.1.2, 2018-12-31) (https://forums.alliedmods.net/showthread.php?t=308428)

Ryan. 06-20-2018 00:44

[NMRiH] Supply Chances (v1.1.2, 2018-12-31)
 
1 Attachment(s)
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

Flammable 06-20-2018 02:12

Re: [NMRiH] Supply Chances (v1.0, 19/06/2018)
 
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.

Ryan. 06-20-2018 03:04

Re: [NMRiH] Supply Chances (v1.0, 19/06/2018)
 
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.

Flammable 06-20-2018 14:29

Re: [NMRiH] Supply Chances (v1.0, 19/06/2018)
 
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"
}
}
}

Ryan. 06-20-2018 22:10

Re: [NMRiH] Supply Chances (v1.1, 20/06/2018)
 
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.

Flammable 06-21-2018 02:19

Re: [NMRiH] Supply Chances (v1.1, 20/06/2018)
 
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.

Ryan. 06-21-2018 04:12

Re: [NMRiH] Supply Chances (v1.1.1, 21/06/2018)
 
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. 12-31-2018 16:08

Re: [NMRiH] Supply Chances (v1.1.2, 2018-12-31)
 
Updated plugin's gamedata to support NMRiH version 1.10.

MsDysphie 07-09-2022 00:59

Re: [NMRiH] Supply Chances (v1.1.2, 2018-12-31)
 
Fork with NMRiH 1.12.3 support:

https://github.com/dysphie/nmrih-supply-chances-ex


All times are GMT -4. The time now is 11:34.

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