Left 4 Dead 2

Left 4 Dead 2

Admin System
Help to add chat commands?
This is a great mod, I have been looking for something like this for years, but I was wondering if by any chance you would not mind giving a few pointers as to how to add some chat commands.

Let me specify. I have done some mutations but the limit with them (as well as with the option to add cvars text files that you mention) is that you cannot change the parameters on the fly once the game is started. For instance I’d like to be able to change the number of special infected and their respawn time in the middle of a game without going back to the lobby. The great advantage of the chat command system is that it offers that possibility.

However as it stands the mod has a chat command to change the max number of specials but since it does not seem to have commands to change the max number of boomers, hunters etc., it can only be used to decrease and not increase the number of SI (and, of course, there are other parameters I’d like to be able to change for which there are no chat commands as yet).

I had a look through the decompiled files but since there’s a lot of them I could not find where these chat commands are set and therefore where I could add some, hence why I’d be quite grateful for some pointers about where this is encoded.

Of course, I would not publish any modified version of this mod on the workshop without your permission, in fact it is very unlikely I will do so at all since this is to play with friends.

On a side note, I noticed your last update aimed to remove the incompatibility with your mutation mod, however for me they are still flagged as incompatible in the in-game add-ons menu, though that does not seem to prevent the admin system mod to work.
< >
Showing 1-11 of 11 comments
Quitting UberEats Soon (Banned) 12 Jul, 2017 @ 11:04am 
You can only manipulate things like spawn timer and amount through cheat codes. Host a listen server (that is not a typo of local server) in which you can then enable sv_cheats 1. Open up developer console in the main menu then type "map" which then there should be a list of map levels you can choose from. Change the numeric value after c to select a different map; c10m is Death Toll while c1m is Dead Center, etc.
Last edited by Quitting UberEats Soon; 12 Jul, 2017 @ 11:04am
Dr. Strangelove 12 Jul, 2017 @ 11:25am 
If you can manipulate the amount of SI in general through chat lines in this mod, then you should be able to manipulate similar parameters of the director's options such as the specific number of one sort of SI and their respawn time. And you can defintely manipulate them with mutations without a listen sever.
Quitting UberEats Soon (Banned) 12 Jul, 2017 @ 12:28pm 
Originally posted by Dr. Strangelove:
If you can manipulate the amount of SI in general through chat lines in this mod, then you should be able to manipulate similar parameters of the director's options such as the specific number of one sort of SI and their respawn time. And you can defintely manipulate them with mutations without a listen sever.
I'm sorry but if I wrote any mistakes then refer to the guide for this mod also created by Rayman for a full list of possible commands.
Dr. Strangelove 12 Jul, 2017 @ 1:54pm 
Dude, I appreciate you trying to help but I have gone through the list and my point is that some commands that I would like to use are currently missing. Since I do not expect the author to implement every possible command on request and since I think it should not be too hard to do it myself (though I could be wrong there) I'm asking the author for pointers as to where those are located in the files.
Rayman1103  [developer] 12 Jul, 2017 @ 8:49pm 
I believe you can change the limits of all the infected already with the mod, including Boomers, Hunters, etc. By using "!limit maxspecials 4" and "!limit boomer 4". You may have to lower some other SI limits though, but it should work.

You can add a server.nut file to your scripts/vscripts directory if you haven't already, and in that file you can add your own custom chat triggers and command. Here's a code example:

//----------------------------------------------------- Msg("Activating server.nut file\n"); // Include the VScript Library if (!("VSLib" in getroottable())) { IncludeScript("VSLib"); ::ServerLoadVSLib <- {}; } else { if ("ServerLoadVSLib" in getroottable()) { IncludeScript("VSLib"); } } ::ServerBoomerLimitCmd <- function ( player, args ) { if ( !AdminSystem.IsPrivileged( player ) ) return; local Value = GetArgument(1); if ( !Value ) return; Value = Value.tointeger(); SessionOptions.BoomerLimit <- Value; } function ChatTriggers::boomer_limit( player, args, text ) { ServerBoomerLimitCmd( player, args ); } function EasyLogic::OnUserCommand::ServerCommands( player, args, text ) { if ( !AdminSystem.IsPrivileged( player ) ) return; local Command = GetArgument(0); switch ( Command ) { case "boomer_limit": { ServerBoomerLimitCmd( player, args ); break; } default: break; } }

If that doesn't work, you may need to remove the if statement that checks if the player is an admin.

Let me know if you need anything else.
Quitting UberEats Soon (Banned) 12 Jul, 2017 @ 9:26pm 
Yesssss! I lured out the developer with my bait. :steamhappy: No not flamebait, don't be so pessimistic and paranoid.
Last edited by Quitting UberEats Soon; 12 Jul, 2017 @ 9:27pm
Dr. Strangelove 13 Jul, 2017 @ 3:33am 
@Rayman1103: thanks a bunch, I'll give it a go and see.

FYI, I had already tried the "!limit boomer" command etc... but it did not seem to work (tested by setting to 0 but some still appeared - otherwise you're right, if you raise the limit of one type but don't change the rest you might not see a difference).

I may need more time to figure it out but what puzzles me right now is that the example above looks like it is about limiting boomers, yet I don't see anywhere the text "!limit boomer" in the example so it is not clear to me how it is set that "!limit bommer" would trigger that file or that particular bit of the file to activate when used in chat. I presume this is set by the function "ChatTriggers::boomer_limit" but since the text does not exaclty correspond there must be some "translating " rule which I do not understand (or else this is specified in another file). Thus whilst I might be able to adapt this to make it work with other SI, I'm not sure I can work it out for other commands such as respawn time.

Sorry if my question is not clear in which case it is probably due to my limited experience with squirrel (I've only used simpler scripts so far, modifying basic cvars and director options) and you'd be entitled to respond I just need to get more experience to understand.
Last edited by Dr. Strangelove; 13 Jul, 2017 @ 3:50am
Rayman1103  [developer] 13 Jul, 2017 @ 7:29am 
That's because in my example above it's a new command name, it's not the "limit" one from the Admin System. With this example you would write "!boomer_limit 0" in chat for example, or "scripted_user_func boomer_limit,0" in console. That would trigger the ServerBoomerLimitCmd function.

This is an example on how you could add additional chat commands that can do whatever you want with. So you can add another command using the template above, to change respawn intervals, or whatever.

Let me know if you need any assistance.
Dr. Strangelove 13 Jul, 2017 @ 8:30am 
That explains it, thanks a lot again for taking the time to respond. I'll try when I have time and let you know.

Since you're mentionning the console, I will bother you with one further question for now although it might best belong in another thread. The alternative to chat commands is of course make changes directly through the console but the problem I ran into there is that whilst I could make it work for cvars, I could not find the proper syntax to modify the director options (which I had no problem to do with mutations). For instance, something like director_cm_MaxSpecials X (and some other variants I tried) does not work when using the console. Any idea?
It would be nice if it had the z_view distance command, allowing thirdperson in versus mod.
Quitting UberEats Soon (Banned) 24 Sep, 2017 @ 12:06pm 
Originally posted by AbeFilmMuncher:
It would be nice if it had the z_view distance command, allowing thirdperson in versus mod.
You can just use cheat codes in a listen server.
< >
Showing 1-11 of 11 comments
Per page: 1530 50