[ANY] CVAR Randomizer
2 Attachment(s)
Description:
Randomizes existing cvars as defined in ...addons\sourcemod\configs\randcvars.cfg file, and then removes itself from memory. Plugin will not create new cvars at this time. I've had a need for something like this and couldn't find anything close enough worth tailoring. Installation: Installation depends on how you want to use the plugin. If you want it called for every map, just put randcvar.smx in ...addons\sourcemod\plugins and randcvars.cfg in ...\addons\sourcemod\configs. Remember that the plugin removes itself from memory after it executes. Configuration: Without a correctly configured cfg file, the plugin does nothing The plugin recognizes 3 different types of definitions in the cfg file: F (float), I (integer), and L (list). The F type returns a float between the defined low and high values, to the defined precision. The I type returns an integer between the defined low and high values. The L type returns a random string from the listed items. Example cfg file: Below is an example.cfg, which is also attached as randcvars.cfg. The first entry is for the cvar mp_roundtime. It's a type F, so it will return a float value between 2.00 (lo) and 3.50 (hi), with 2 decimal places (prec). The second entry is for the cvar bot_difficulty. It's a type I, so it will return an integer value between 0 (lo) and 3 (hi). The third and last entry is for the cvar sm_gg_cfgdirname. It's a type L, so it will return a string value from the listed item. The items are read into key values per the count, so if the count is less than the number of items, items numbered greater than count will be disregarded. In other words if you have 8 list items, but only specify a count of 2, only the first 2 items will be considered. If count is greater then the number of listed items, the returned string will either be the last listed item, or an empty string. For best results, your count should always match the number of listed items. This is just an example file to illustrate how the plugin is used. It is important to note that the plugin aborts and removes itself from memory upon the first error in the cfg file. In other words, if all of the key values are set correctly for the first cvar, but incorrect for the second (or 3rd, or 4th, etc.) cvar, the first cvar will be changed, but the second (or 3rd, or 4th, etc.) cvar won't be changed. Code:
//Rename this file to randcvars.cfg and place in ...\addons\sourcemod\configs |
Re: [ANY] CVAR Randomizer
Cool plugin! However, it seems to only do its thing if I manually load it, eg. "sm plugins load randcvar" or "sm plugins refresh" to server console. Upon a mapchange, the CVARs will remain in their default values. Is there a way around this? I'm not getting any errors logs, and am quite positive my randcvars.cfg syntax is correct.
Quote:
Code:
"Randomized_Cvars" |
Re: [ANY] CVAR Randomizer
Quote:
edit: Remember, the plugin removes itself from memory after execution. |
Re: [ANY] CVAR Randomizer
Using this with the MapCron plugin to create a timed "sm plugins load randcvar" on mapchange appears to work nicely. I'm assuming this is due to the CVAR Randomizer accessing the variables before they are read from their respective config files, which will then overwrite the randomizations. Adding a simple timer to this plugin would most likely work as well.
|
Re: [ANY] CVAR Randomizer
Quote:
|
Re: [ANY] CVAR Randomizer
Hello, Who can fix this?
Code:
File addons/sourcemod/configs/randcvars.cfg missing, aborting... |
Re: [ANY] CVAR Randomizer
Quote:
you missing a cfg :D upload the randcvars.cfg |
Re: [ANY] CVAR Randomizer
I put randcvars.cfg to addons/sourcemod/configs/randcvars.cfg from 1st post. I tried not to copy it, all plugins auto create a configuration file.
Anyway an error. |
| All times are GMT -4. The time now is 13:30. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.