AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Plugins (https://forums.alliedmods.net/forumdisplay.php?f=108)
-   -   [L4D & L4D2] Game Mode Config Loader 1.6 (https://forums.alliedmods.net/showthread.php?t=93212)

Thraka 05-25-2009 18:52

[L4D & L4D2] Game Mode Config Loader 1.6
 
4 Attachment(s)
This plugin will execute a config file based on the current game play mode. Because I like Versus tweaked for a higher difficulty than a coop game, I use this to do that, but leave coop up to the lobby settings. Also, the survivor mode, I think, shouldn't have any adjustments made to it. This plugin gives me that ability.

Notes
Left 4 Dead will change the game type automatically when someone hosts a lobby for a specific game type and then ends up connecting to your server.

The z_difficulty CVAR used to determine the difficulty for co-op uses the values Easy, Normal, Hard, Impossible. While the UI in the game uses Easy, Normal, Advanced, Expert. I set the names of the config files (default) to match the z_difficulty CVAR value, while the description of the coop - difficulty script CVARs matches the UI text.

If a game mode is selected which is not used by the hardcoded cfg files (see the cvars) it will automatically look for a .cfg file that matches the game mode text. To figure this out, configure your lobby as desired, start the game in the server then check the hidden mp_gamemode cvar for the value. Then create a .cfg file with the same file name as cvar value.

Version History
1.8:
  • Created gamemode_resetconvars cvar. Defaults to on and when on, before executing the cfg file for the game mode, the reset_gameconvars console command will execute which resets all the cvars.
  • Executes a .cfg file with the same file name as the value of the mp_gamemode cvar if the mp_gamemode is not coded into the plugin directly. This is a fallback system to execute .cfg files when Valve implements new mutations or game modes.
  • Logs what it excutes.
1.6:
  • Supports modes added by L4D2
1.5:
  • Supports teamversus mode.
1.4:
  • Added suggestions\code from Dionys to re-execute the cfg when mp_gamemode and z_difficulty change mid game.
  • Added plugin version cvar for tracking.
1.3:
  • Added the ability to auto-execute a config script based on coop difficulty.
1.2:
  • Changed meta data (URL and TITLE).
1.1:
  • Removed bad code line.
  • Changed all references from survivor to survival
1.0
  • Initial release.

CVARs
gamemode_config_ver - Version of this plugin.

gamemode_resetconvars - Resets the console vars () before executing the config
gamemode_config_coop - CFG file to execute when game mode is coop - Default: coop.cfg
gamemode_config_versus - CFG file to execute when game mode is versus - Default: versus.cfg
gamemode_config_teamversus - CFG file to execute when game mode is teamversus. - Default teamversus.cfg
gamemode_config_survival - CFG file to execute when game mode is survival - Default survival.cfg
gamemode_config_realism - CFG file to execute when game mode is realism. - Default realism.cfg
gamemode_config_scavenge - CFG file to execute when game mode is scavenge. - Default scavenge.cfg
gamemode_config_teamscavenge - CFG file to execute when game mode is teamscavenge. - Default teamscavenge.cfg

gamemode_config_coop_easy - CFG file to execute when game mode is coop and the difficulty is Easy. - Default: coop_easy.cfg
gamemode_config_coop_normal - CFG file to execute when game mode is coop and the difficulty is Normal. - Default: coop_normal.cfg
gamemode_config_coop_hard - CFG file to execute when game mode is coop and the difficulty is Advanced. - Default: coop_hard.cfg
gamemode_config_coop_impossible - CFG file to execute when game mode is coop and the difficulty is Expert. - Default: coop_impossible.cfg

The values are used by the plugin to call the exec console command: exec [value].

Thanks to DJ Tsunami for getting me started. :)

Felycity 05-25-2009 20:16

Re: [L4D] Game Mode Config Loader
 
this plugin works well on my server!
good job! :up:

DJ Tsunami 05-26-2009 05:28

Re: [L4D] Game Mode Config Loader
 
Nicely done. But, are you sure it's "survivor"? I'm looking at an L4D server right now and it clearly says "survival".

Edit: also, line 26 shouldn't be there.

PStar 05-26-2009 06:39

Re: [L4D] Game Mode Config Loader
 
How does it work?

So i mean does it integrate into the admin menu or something, where i can change the game mode?
Or what?

DJ Tsunami 05-26-2009 10:38

Re: [L4D] Game Mode Config Loader
 
All this does is execute a cfg file with commands or cvars when the map starts, depending on the current game mode. L4D decides what the current game mode is, you can't change it.

Thraka 05-26-2009 11:13

Re: [L4D] Game Mode Config Loader
 
Doh! My dislexia is getting the best of me. I think I had survival and I said wait! it's survivor! .. arg. I'll fix that in a few mins :)

edit: Done!

I just thought of something too. Now that I can have different configs for each game mode, I can also change the motdfile cvar to a specific motd file for each type. Very nice!

Frozenology 05-26-2009 14:45

Re: [L4D] Game Mode Config Loader
 
Thanks for Plugins, I will dev an improve version of this.

madcap 05-27-2009 08:34

Re: [L4D] Game Mode Config Loader
 
Do the CFGs go in the left4dead/cfg/sourcemod directory?

Thraka 05-27-2009 12:18

Re: [L4D] Game Mode Config Loader
 
No just the left4dead\cfg folder. Really any location that the normal console exec [filename] would find the file.

One thing I'm going to do (perhaps today) is have it also execute a difficulty config for coop mode. Since the lobby can set easy normal hard expert, these configs would run when it was coop and right after the coop.cfg runs.

Thraka 05-28-2009 00:59

Re: [L4D] Game Mode Config Loader
 
:( It seems the server is caching the motd content for the clients. So if you change motdfile after server has started and someone has connected, it doesn't seem to load the new page content :(


All times are GMT -4. The time now is 18:40.

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