AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Plugins (https://forums.alliedmods.net/forumdisplay.php?f=108)
-   -   [L4D2] Improved Automatic Campaign Switcher (ACS) [v2.3.0 (20201024)] (https://forums.alliedmods.net/showthread.php?t=308708)

rikka0w0 06-30-2018 12:38

[L4D2] Improved Automatic Campaign Switcher (ACS) [v2.3.0 (20201024)]
 
3 Attachment(s)
Automatic Campaign Switcher

Supports the Last Stand update

This version of Automatic Campaign Switcher is based on ChrisP`s original version (v1.2.2), which is available here: https://forums.alliedmods.net/showthread.php?t=156392

Introduction
Automatic Campaign Switcher, or ACS, was written as an easy way to keep the Left4Dead 2 default map rotation going on a server without people being booted because the vote to restart a campaign was not passed. I also tried to write ACS in such a way that it would be easy to change for those who wish to edit the source to have custom campaigns and maps in l4d2 as well. If you decide not to edit the files, then ACS will cycle through maps in chronological order corresponding to the L4D story timeline. ACS also includes a voting system in which people can vote for their favorite campaign/map on a finale or scavenge map. The winning campaign/map will become the next map the server loads.

Installation
This plugin requires "L4D2 Mission Manager" to work, which can be found here: http://forums.alliedmods.net/showthread.php?t=308725
There's a simple way to install, just unzip "acs_ready_to_go.zip" to your "left4dead2/addons/sourcemod" folder. "L4D2 Mission Manager" is included.

Features
The improved version inherits all features of the original version, with several advanced feature added:
1. Adding new maps no longer requires modification and recompiling of the sp file, the plugin automatically finds them. No more hard coding
2. A new map voting system is introduced, players can use "!chmap" to initiate a vote if they want to change the map immediately.
3. A new command "!chmap2" allows players to vote when they want to switch to any map available on the server, even the target map is not the first map of a campaign.

4. Better localization support, messages, menus and map names can now be displayed in client`s language
5. Bug fixes, e.g. the original version uses a wrong way to load CVars.
6. Prevent an empty server running 3-rd maps
7. [New Feature] A new admin menu for changing maps, located in Admin menu -> Server Commands (Added upon the request of Mi.Cura, file: l4d2_mm_adminmenu.smx)

Note: For security reasons, "!chmap" and "!chmap2" are disabled by default to prevent griefers' misuse, see CVar "acs_chmap_policy".

Console Variables (CVars)
Most of them have exactly the same definition as the original version, (please refer to ChrisP`s original post), except three new CVars:
1. acs_chmap_broadcast_interval, controls the frequency of the "!chmap" advertisement
2. acs_prevent_empty_server, if enabled, the server automatically switch to the first available official map when no one is playing a 3-rd map
3. acs_chmap_policy, set to 0 disables "!chmap" (by default), set to 1 enables "!chmap" and treats abstention as NO, set to 2 enables "!chmap" and treats abstention as YES. In most case, DONT set it to 2!
4. acs_next_map_menu_options: Controls the maps shown in the next map voting menu [0 = Official and addon maps(Default), 1 = Official maps only, 2 = Depending on the type of the current map ]
5. acs_next_map_menu_excludes: Excludes certain map(s) from the map voting menu [0 = Nothing(Default), 1 = Current map ]
6. acs_next_map_menu_order: Controls the order of maps shown in the next map voting menu [0 = Official then addon maps(Default), 1 = Random ]

Map/campaign List Configuration
"l4d2_mission_manager" provides information about maps and campaigns, this is fully automatic. After parsing all mission text files cached by "l4d2_mission_manager", the plugin will load "left4dead2/addons/sourcemod/configs/missioncycle.*.txt", if not exist, the plugin will create one. (* can be coop/versus/scavenge/survival) Any new installed maps will be appended to the end of "missioncycle.*.txt". The order of entries in "missioncycle.*.txt" controls the order of map cycle.
Invalid entries (e.g. removed campaign) in "missioncycle.*.txt" will be ignored and printed on the server console.
Some maps can be excluded from the map cycle, see "missioncycle.*.txt" for more information, those maps can only be loaded via "!chmap" and after the finale map the server loads the first map in the map cycle.

Map/campaign Name Localization
The localized campaign names are in "left4dead2/addons/sourcemod/translations/missions.phrases.txt" or "left4dead2/addons/sourcemod/translations/chi/missions.phrases.txt", depends on the language. If a campaign is not in "left4dead2/addons/sourcemod/translations/missions.phrases.txt", the name in "missioncycle.*.txt" will be used for display. If a campaign is listed in "left4dead2/addons/sourcemod/translations/missions.phrases.txt", the plugin will attempt to display the campaign name in the client`s language, (for Simplified Chinese, is "left4dead2/addons/sourcemod/translations/chi/missions.phrases.txt"), if fails then display the English name.

TODO & Known problems
1. Map/Campaign cycle randomizer
2. (Reported by Mr. Man) Some finale maps aren't triggering the mapvote function. (Although it does not affect default map cycle) The cause is under investigation
After including Lux's patch in the latest release, it should be fixed!

Latest source code is available on Github: https://github.com/rikka0w0/l4d2_mission_manager

This plugin has been proved stable in coop mode on my server.
nandofs's and Mr. Man's problem has been fixed, Silvers' suggestion is still under consideration.
SilentBr's suggestions were implemented by acs_next_map_menu_options, acs_next_map_menu_excludes and acs_next_map_menu_order.

Thanks 'D4rk56' for providing French translation files! French translation files can be found on the github page above.

Discord channel: https://discord.gg/8gAmutR

Latest: acs_v2.3.0.zip

nandofs 06-30-2018 15:01

Re: [L4D2] Improved Automatic Campaign Switcher (ACS) [v1.9.0 (20180701)]
 
The server I have is the VERSUS mode.
I'm testing your add-on and I found a problem
I followed all the instructions to install it correctly.
However, the problem continues.
When we reach the end of the campaign, we vote for the next campaign, but the campaign does not change and the server automatically restarts and takes us out of the server.
http://subirimagen.me/uploads/20180630140005.jpg
http://subirimagen.me/uploads/20180630140031.jpg
http://subirimagen.me/uploads/20180630140050.jpghttp://subirimagen.me/uploads/20180630140108.jpg

Psyk0tik 06-30-2018 16:16

Re: [L4D2] Improved Automatic Campaign Switcher (ACS) [v1.9.0 (20180701)]
 
I can't wait to check out the source code of this. I'll happily help you improve this plugin along the way. :D

Maybe consider making a GitHub repository for this? It'd be easier since I can make pull requests.

rikka0w0 07-01-2018 05:53

Re: [L4D2] Improved Automatic Campaign Switcher (ACS) [v1.9.0 (20180701)]
 
Quote:

Originally Posted by Crasher_3637 (Post 2600177)
I can't wait to check out the source code of this. I'll happily help you improve this plugin along the way. :D

Maybe consider making a GitHub repository for this? It'd be easier since I can make pull requests.

All contributions are welcomed!
To solve nandofs's problem, a lot of code need to be reworked. There is a design flaw in the original plugin.
Currently my plan is to make the map list parser into a separate plugin, called "L4D2 Mission Manager", github repo: https://github.com/rikka0w0/l4d2_mission_manager, it eases the maintenance of the plugin and also allows other mod to reuse the code.

It will take some time before the plugin becomes fully functional for versus and survival modes.

rikka0w0 07-01-2018 05:56

Re: [L4D2] Improved Automatic Campaign Switcher (ACS) [v1.9.0 (20180701)]
 
Quote:

Originally Posted by nandofs (Post 2600160)
The server I have is the VERSUS mode.
I'm testing your add-on and I found a problem
I followed all the instructions to install it correctly.
However, the problem continues.
When we reach the end of the campaign, we vote for the next campaign, but the campaign does not change and the server automatically restarts and takes us out of the server.

Thanks for your feedback.
Sorry I cant read Spanish, which mode are you playing? Is that the original versus mode or it is a mutation mode similar to versus mode? It will be helpful for my debugging if you can provide some segment of the server console output~:)

BTW how do you add the developer console option to the game menu?

nandofs 07-01-2018 13:24

Re: [L4D2] Improved Automatic Campaign Switcher (ACS) [v1.9.0 (20180701)]
 
Quote:

Originally Posted by rikka0w0 (Post 2600266)
Thanks for your feedback.
Sorry I cant read Spanish, which mode are you playing? Is that the original versus mode or it is a mutation mode similar to versus mode? It will be helpful for my debugging if you can provide some segment of the server console output~:)

BTW how do you add the developer console option to the game menu?

I'll tell you what the problem is, in the best possible way, since I'm not very good at English.
I am playing the original VERSUS mode, everything is fine, the voting menu of the campaigns appears, we select the campaign and we can only hope it ends until all the survivors escape or die, the rematch vote begins but nobody votes, after 5 to 10 seconds, the server votes us and restarts, without changing the campaign.
I hope you understand my explanation :P

Silvers 07-01-2018 14:38

Re: [L4D2] Improved Automatic Campaign Switcher (ACS) [v1.9.0 (20180701)]
 
Instead of FindGameMode() and hard coding gamemode strings, take a look at any one of my plugins which add "_modes_tog" cvar, simple way to detect for any mutation/mode.

nandofs 07-01-2018 23:33

Re: [L4D2] Improved Automatic Campaign Switcher (ACS) [v1.9.0 (20180701)]
 
Excellent friend with this update worked for me.
I just had to change the delay from 6 seconds to 5 seconds.
so that I can change correctly.


before
//Define the wait time after round before changing to the next map in each game mode
#define WAIT_TIME_BEFORE_SWITCH_COOP 7.0
#define WAIT_TIME_BEFORE_SWITCH_VERSUS 6.0
#define WAIT_TIME_BEFORE_SWITCH_SCAVENGE 11.0

now
//Define the wait time after round before changing to the next map in each game mode
#define WAIT_TIME_BEFORE_SWITCH_COOP 7.0
#define WAIT_TIME_BEFORE_SWITCH_VERSUS 5.0
#define WAIT_TIME_BEFORE_SWITCH_SCAVENGE 11.0

rikka0w0 07-06-2018 03:38

Re: [L4D2] Improved Automatic Campaign Switcher (ACS) [v1.9.0 (20180701)]
 
Hi everyone, the new ACS with automatic campaign/map list system is complete!

Psyk0tik 07-06-2018 03:49

Re: [L4D2] Improved Automatic Campaign Switcher (ACS) [v1.9.0 (20180706)]
 
Congrats. :)

I haven't had the time to convert the source code to the new syntax yet. I could probably shorten the code by 50-100 lines once I convert it.

And maybe we can work together to add L4D1 support.

Mr. Man 07-06-2018 04:58

Re: [L4D2] Improved Automatic Campaign Switcher (ACS) [v1.9.0 (20180706)]
 
What file am I missing here exactly:

Code:

L 07/06/2018 - 03:57:43: [L4D2_missionmanager.smx] An error occured while parsing maps.phrases.txt(English), code:1
L 07/06/2018 - 03:57:43: [L4D2_missionmanager.smx] Map name localization file addons/sourcemod/translations/maps.phrases.txt does not exist!

Was I supposed to have created one myself or?

Also would be good if you added the auto reset to defined map/change maps when server is empty for x amount of time.

rikka0w0 07-06-2018 10:05

Re: [L4D2] Improved Automatic Campaign Switcher (ACS) [v1.9.0 (20180706)]
 
Quote:

Originally Posted by Crasher_3637 (Post 2601288)
Congrats. :)

I haven't had the time to convert the source code to the new syntax yet. I could probably shorten the code by 50-100 lines once I convert it.

And maybe we can work together to add L4D1 support.

The latest version completely abandon the old syntax.
The problem is that I didn't buy L4D1, there no way for me to test it. However in theory this plugin should be compatible with L4D, as long as the campaign/map list can be correctly generated.

rikka0w0 07-06-2018 10:17

Re: [L4D2] Improved Automatic Campaign Switcher (ACS) [v1.9.0 (20180706)]
 
Quote:

Originally Posted by Mr. Man (Post 2601300)
What file am I missing here exactly:

Code:

L 07/06/2018 - 03:57:43: [L4D2_missionmanager.smx] An error occured while parsing maps.phrases.txt(English), code:1
L 07/06/2018 - 03:57:43: [L4D2_missionmanager.smx] Map name localization file addons/sourcemod/translations/maps.phrases.txt does not exist!

Was I supposed to have created one myself or?

Also would be good if you added the auto reset to defined map/change maps when server is empty for x amount of time.

"maps.phrases.txt" is used for localizing individual maps, e.g. c1m1_hotel to some human-readable name. If you don't want to localize them, it's completely fine. Create a file with the following content as the "maps.phrases.txt":
PHP Code:

"Phrases"
{



As a result, the maps will be shown as names like "c1m1_hotel".
To localize map names, your "maps.phrases.txt" should be something like:
PHP Code:

"Phrases"
{
    
"c1m1_hotel"
    
{
        
"en"        "Hotel"
    
}



Sorry I forgot to mention this in the intro

Quote:

Also would be good if you added the auto reset to defined map/change maps when server is empty for x amount of time.
I had another plugin which does something similar, it switches to c1m1_hotel when the empty server is running 3-rd party maps. Some people doesn't have 3-rd maps, they cannot log on to the server and change the map if the server is already running a 3-rd map. I think it might be good to include this function into the ACS.

Psyk0tik 07-06-2018 11:08

Re: [L4D2] Improved Automatic Campaign Switcher (ACS) [v1.9.0 (20180706)]
 
2 Attachment(s)
Both .sp files failed to compile. The reason is that you didn't parenthesize the values that you were using the view_as operator for.

Before: view_as<something>something2
After: view_as<something>(something2)

I also replaced all the "FCVAR_PLUGIN" plugin stuff with an underscore since they're deprecated.

Another thing I did was add #pragma newdecls required to both plugins. For acs.sp, you didn't add "void" for the ConVar.AddChangeHook callbacks and other things like OnMapStart and OnPluginStart. You also didn't add "int" for the MenuHandler.

Before: public VoteMenuHandler
After: public int VoteMenuHandler

Aside from that, everything checks out so far, though I do see a lot of hard-coded stuff that could easily be shortened/fixed by Silvers' suggestion. I second his suggestion since it really will reduce all those mutations to like around 25-30 lines of code and will support all mutations including custom ones.

This is the one that Silvers is suggesting.

PHP Code:

int g_iCurrentMode;
bool IsAllowedGameMode()
{
    if( 
g_hCvarMPGameMode == null )
        return 
false;

    
int iCvarModesTog g_hCvarModesTog.IntValue;
    if( 
iCvarModesTog != )
    {
        
g_iCurrentMode 0;

        
int entity CreateEntityByName("info_gamemode");
        
DispatchSpawn(entity);
        
HookSingleEntityOutput(entity"OnCoop"OnGamemodetrue);
        
HookSingleEntityOutput(entity"OnSurvival"OnGamemodetrue);
        
HookSingleEntityOutput(entity"OnVersus"OnGamemodetrue);
        
HookSingleEntityOutput(entity"OnScavenge"OnGamemodetrue);
        
ActivateEntity(entity);
        
AcceptEntityInput(entity"PostSpawnActivate");
        
AcceptEntityInput(entity"Kill");

        if( 
g_iCurrentMode == )
            return 
false;

        if( !(
iCvarModesTog g_iCurrentMode) )
            return 
false;
    }

    
char sGameModes[64], sGameMode[64];
    
g_hCvarMPGameMode.GetString(sGameModesizeof(sGameMode));
    
Format(sGameModesizeof(sGameMode), ",%s,"sGameMode);

    
g_hCvarModes.GetString(sGameModessizeof(sGameModes));
    if( 
strcmp(sGameModes"") )
    {
        
Format(sGameModessizeof(sGameModes), ",%s,"sGameModes);
        if( 
StrContains(sGameModessGameModefalse) == -)
            return 
false;
    }

    
g_hCvarModesOff.GetString(sGameModessizeof(sGameModes));
    if( 
strcmp(sGameModes"") )
    {
        
Format(sGameModessizeof(sGameModes), ",%s,"sGameModes);
        if( 
StrContains(sGameModessGameModefalse) != -)
            return 
false;
    }

    return 
true;
}

public 
void OnGamemode(const char[] outputint callerint activatorfloat delay)
{
    if( 
strcmp(output"OnCoop") == )
        
g_iCurrentMode 1;
    else if( 
strcmp(output"OnSurvival") == )
        
g_iCurrentMode 2;
    else if( 
strcmp(output"OnVersus") == )
        
g_iCurrentMode 4;
    else if( 
strcmp(output"OnScavenge") == )
        
g_iCurrentMode 8;


Make sure to call it anytime after the round starts since it creates the info_gamemode entity and you'll get errors if you try to create it on OnMapStart or anything before configs are executed. I highly recommend checking out his plugins, like Mutant Zombies and Gun Cabinet since he calls the check on OnConfigsExecuted. A lot of his plugins contain code that not many users know about or tried before so maybe they can help you optimize your plugins.

rikka0w0 07-06-2018 11:56

Re: [L4D2] Improved Automatic Campaign Switcher (ACS) [v1.9.0 (20180706)]
 
Quote:

Both .sp files failed to compile. The reason is that you didn't parenthesize the values that you were using the view_as operator for.
Which version of sourcemod are you using? I use 1.7 and it compiles without any warning or error. I probably should fix them.

For transforming the syntax, the thing I did is to remove things like : and decl, and change const String:xxx[] to const char[] xxx. I forget to add return/parameter types as required by the new syntax.

I'm really appreciate that you point out these problems :)

Psyk0tik 07-06-2018 12:05

Re: [L4D2] Improved Automatic Campaign Switcher (ACS) [v1.9.0 (20180706)]
 
I use SM 1.8.0.6048 (latest stable build). I don't use the unstable builds.

Lux 07-06-2018 12:06

Re: [L4D2] Improved Automatic Campaign Switcher (ACS) [v1.9.0 (20180706)]
 
Quote:

Originally Posted by rikka0w0 (Post 2601381)
Which version of sourcemod are you using? I use 1.7 and it compiles without any warning or error. I probably should fix them.

For transforming the syntax, the thing I did is to remove things like : and decl, and change const String:xxx[] to const char[] xxx. I forget to add return/parameter types as required by the new syntax.

I'm really appreciate that you point out these problems :)

Use 1.8 compiler 1.7 you can use View_as<> without the brackets which was not ment to be

Mr. Man 07-06-2018 12:18

Re: [L4D2] Improved Automatic Campaign Switcher (ACS) [v1.9.0 (20180706)]
 
Quote:

Originally Posted by rikka0w0 (Post 2601358)
"maps.phrases.txt" is used for localizing individual maps, e.g. c1m1_hotel to some human-readable name. If you don't want to localize them, it's completely fine. Create a file with the following content as the "maps.phrases.txt":
PHP Code:

"Phrases"
{



As a result, the maps will be shown as names like "c1m1_hotel".
To localize map names, your "maps.phrases.txt" should be something like:
PHP Code:

"Phrases"
{
    
"c1m1_hotel"
    
{
        
"en"        "Hotel"
    
}


Sorry I forgot to mention this in the intro.

I have done that but the ingame still isn't parsing the menu correctly. Is it something on my end?

rikka0w0 07-06-2018 12:35

Re: [L4D2] Improved Automatic Campaign Switcher (ACS) [v1.9.0 (20180706)]
 
Quote:

Originally Posted by Mr. Man (Post 2601388)
I have done that but the ingame still isn't parsing the menu correctly. Is it something on my end?

1. Check: is there a "mission.cache" folder in "left4dead2" directory? ("left4dead2" also contains "addons" and "cfg" folder)
2. If you are using Linux, permission can cause trouble, so make sure that "mission.cache" is writable by the current user (the one you used to launch srcds). Try "chmod -R 777 mission.cache"
3. A screen shot might be helpful

Mr. Man 07-06-2018 12:54

Re: [L4D2] Improved Automatic Campaign Switcher (ACS) [v1.9.0 (20180706)]
 
Quote:

Originally Posted by rikka0w0 (Post 2601391)
1. Check: is there a "mission.cache" folder in "left4dead2" directory? ("left4dead2" also contains "addons" and "cfg" folder)
2. If you are using Linux, permission can cause trouble, so make sure that "mission.cache" is writable by the current user (the one you used to launch srcds). Try "chmod -R 777 mission.cache"
3. A screen shot might be helpful

No mission.cache file in the main directory. I'll get you a screenshot in a second. Here's what I see:

https://imgoat.com/uploads/0a080f42e6/121466.jpg

Silvers 07-06-2018 13:24

Re: [L4D2] Improved Automatic Campaign Switcher (ACS) [v1.9.0 (20180706)]
 
Quote:

Originally Posted by rikka0w0 (Post 2601381)
For transforming the syntax, the thing I did is to remove things like

ThatOneGuy's SourcePawn syntax converter works really well (VBA/VB6 in thread) and Peace-Maker's Python script that converts to new methodmaps.

Or look at Dragokas' batch converter which uses the above two.

Saves a lot of time and does nearly everything.

rikka0w0 07-06-2018 14:18

Re: [L4D2] Improved Automatic Campaign Switcher (ACS) [v1.9.0 (20180706)]
 
Quote:

Originally Posted by Mr. Man (Post 2601394)
No mission.cache file in the main directory. I'll get you a screenshot in a second. Here's what I see:

https://imgoat.com/uploads/0a080f42e6/121466.jpg

I think there should be a "mission.cache" FOLDER in your "left4dead2" directory, otherwise the menu should be empty.
Your plugin is working now, without any problems.

The plugin (not ACS, but l4d2_mission_manager handles name localization) attempts to find the localized mission(campaign) name from "translations/missions.phrases.txt". If localized name can not be found, then the plugin will directly use the name of the mission which is the names you see on the menu. (which is also used by srcds to match servers)
In your case, "Questionable Ethics 1" is localized because I have already written it into "missions.phrases.txt". You can edit "missions.phrases.txt" and append localized names for 3-rd party maps. e.g.
PHP Code:

"yomimario2"
{
"en" "Yomi Mario 2"


Be aware that "yomimario2" is case-sensitive!

Since 3-rd party map VPK does not support multi-language, the display name of the VPK can be in any language, so the plugin does NOT automatically add them to "translations/missions.phrases.txt".

Mr. Man 07-06-2018 14:50

Re: [L4D2] Improved Automatic Campaign Switcher (ACS) [v1.9.0 (20180706)]
 
I see the mission.cache folder now. Was looking for a file initially, should have looked closer. So, regardless I should edit missions.phrases.txt in order to change how the missions appear in the menu?

Mr. Man 07-06-2018 18:28

Re: [L4D2] Improved Automatic Campaign Switcher (ACS) [v1.9.0 (20180706)]
 
Just got an auto error code 6 upon mapswitch... not sure what the cause is but I timed out while loading the next campaign.

rikka0w0 07-06-2018 23:48

Re: [L4D2] Improved Automatic Campaign Switcher (ACS) [v1.9.0 (20180706)]
 
Quote:

Originally Posted by Mr. Man (Post 2601444)
Just got an auto error code 6 upon mapswitch... not sure what the cause is but I timed out while loading the next campaign.

Is the error code 6 shown on the server console? A screen shot / a segment of server console log helps me solve the problem improve the plugin :)

you can try "sm_lmm_list invalid" to see is there any invalid map on the server.

Mi.Cura 07-07-2018 15:30

Re: [L4D2] Improved Automatic Campaign Switcher (ACS) [v1.9.0 (20180706)]
 
The plugin works great, congratulations for the work.
No need to edit the .sp file anymore and extraordinary.

But unfortunately it has a serious problem for me.

Why let the player be able to open a vote to exchange maps and campaigns in any part of the game. this is a big problem.

The correct would be only automatic voting always and only in the final maps of each campaign.

And if the player wants to change his vote, also only in final campaigns.
Not in any part of the campaign.

I also think I should not have the option to change the map, it should be only campaigns.

But it's an incredible job. congratulations

Mr. Man 07-07-2018 19:54

Re: [L4D2] Improved Automatic Campaign Switcher (ACS) [v1.9.0 (20180706)]
 
Quote:

Originally Posted by Mi.Cura (Post 2601729)
The plugin works great, congratulations for the work.
No need to edit the .sp file anymore and extraordinary.

But unfortunately it has a serious problem for me.

Why let the player be able to open a vote to exchange maps and campaigns in any part of the game. this is a big problem.

The correct would be only automatic voting always and only in the final maps of each campaign.

And if the player wants to change his vote, also only in final campaigns.
Not in any part of the campaign.

I also think I should not have the option to change the map, it should be only campaigns.

But it's an incredible job. congratulations

Wanted to comment on this as well.

-Voting should be campaign finale or anytime voting but with cooldown (IE, call vote once a campaign so players actually go through it).
-There's no visibility for which campaign is winning in terms of votes. Should be able to see votes in the menu somewhere.

Psyk0tik 07-07-2018 20:25

Re: [L4D2] Improved Automatic Campaign Switcher (ACS) [v1.9.0 (20180706)]
 
I suggest adding/editing 3 commands:

acs_vote - Allow someone to start a vote on finale maps. Cool down can be determined via a cvar like "acs_vote_cooldown"
acs_votes - Allow someone to check the current campaign winner during finale maps as many times as they want. Can be enabled/disabled via a cvar like "acs_show_winner"
acs_forcevote - Allow admins to force-vote a campaign as the winner. Can be enabled/disabled via a cvar like "acs_admin_force"

As Mi.Cura and Mr. Man suggested, voting should only ever be on finales. And if players fail a map X times, even if it's not a finale, let the plugin automatically switch. Can be determined via cvars like "acs_max_failures" and "acs_auto_switch"

Mi.Cura 07-07-2018 21:04

Re: [L4D2] Improved Automatic Campaign Switcher (ACS) [v1.9.0 (20180706)]
 
I use the version Version 1.2.3 of Krufftys Killers until today. https://forums.alliedmods.net/showpo...&postcount=154. But I have to edit .sp.

And the vote only occurs only in the final maps, automatically, the vote can be reopened only to change your vote.

The Vote is only for the next Campaign in Coop mode. It should only be in the final maps.

Older commands continue to work fine:
!mapvote: Allows manual voting if the player wants to change his vote.
!mapvotes - Show the total votes.

Always on the final maps.

Mr. Man 07-08-2018 03:31

Re: [L4D2] Improved Automatic Campaign Switcher (ACS) [v1.9.0 (20180706)]
 
One more thing - the server is suddenly switching campaigns all over the place; I was on a custom map and the server suddenly switched over to Dead Center without warning. Also a big problem with ChrisP's original plugin was the lack of campaign/survival map separation, meaning it's currently unclear if switching from campaign to survival maps what the next set of choices are.

So, the logic overall should be this

For campaigns: on finale map -> initiate map vote for mode -> coop/survival -> voting is in progress -> if nobody votes, the current gamemode stays and forces change to the next mission (defined in ?)
For survival: on round start, continue playing until the max # of times the map can fail as defined in .cfg -> initiate map vote for mode the round before failure -> coop/survival -> voting in progress ->if nobody votes, the current gamemode stays and the current map is restarted.

If you want campaign to flow, you can remove the vote mode and instead vote for a new map.

rikka0w0 07-08-2018 11:21

Re: [L4D2] Improved Automatic Campaign Switcher (ACS) [v1.9.0 (20180706)]
 
Quote:

Originally Posted by Crasher_3637 (Post 2601794)
I suggest adding/editing 3 commands:

acs_vote - Allow someone to start a vote on finale maps. Cool down can be determined via a cvar like "acs_vote_cooldown"
acs_votes - Allow someone to check the current campaign winner during finale maps as many times as they want. Can be enabled/disabled via a cvar like "acs_show_winner"
acs_forcevote - Allow admins to force-vote a campaign as the winner. Can be enabled/disabled via a cvar like "acs_admin_force"

As Mi.Cura and Mr. Man suggested, voting should only ever be on finales. And if players fail a map X times, even if it's not a finale, let the plugin automatically switch. Can be determined via cvars like "acs_max_failures" and "acs_auto_switch"

Quote:

Originally Posted by Mr. Man (Post 2601787)
-There's no visibility for which campaign is winning in terms of votes. Should be able to see votes in the menu somewhere.

I will definitely think about adding this feature

Quote:

Originally Posted by Mr. Man (Post 2601848)
One more thing - the server is suddenly switching campaigns all over the place; I was on a custom map and the server suddenly switched over to Dead Center without warning. Also a big problem with ChrisP's original plugin was the lack of campaign/survival map separation, meaning it's currently unclear if switching from campaign to survival maps what the next set of choices are.

This is a new feature, the plugin checks the number of remaining human player on the server, if there's no one playing and the server is running an addon map, then switch the map to a official campaign map. This allows people without the addon map to join the server when it's empty.
To disable this feature, set "acs_prevent_empty_server" to 0. :)

Update: I forget to check the number of players when switching from an addon map, this will switch to c1m1_hotel when someone disconnects even if there are human players on the server. This problem has been fixed: https://github.com/rikka0w0/l4d2_mis...a0e494618a46e4

Mr. Man 07-08-2018 12:44

Re: [L4D2] Improved Automatic Campaign Switcher (ACS) [v1.9.0 (20180706)]
 
Thanks, will test some more. Also, what's the difference between these two commands:

2. A new map voting system is introduced, players can use "!chmap" to initiate a vote if they want to change the map immediately.
3. A new command "!chmap2" allows players to vote when they want to switch to any map available on the server, even the target map is not the first map of a campaign.

I also was able to call a vote with !chmap in the middle of a game with 2 players and force change map... without the others being able to vote (shows 100% of 1 vote right after I called it) - that isn't really voting then?

Psyk0tik 07-08-2018 17:08

Re: [L4D2] Improved Automatic Campaign Switcher (ACS) [v1.9.0 (20180706)]
 
That's dangerous since trolls and griefers can just use that command per map and force the server to change maps/campaigns whenever they want as long as nobody else votes.

Mr. Man 07-09-2018 02:54

Re: [L4D2] Improved Automatic Campaign Switcher (ACS) [v1.9.0 (20180706)]
 
Correct, so unfortunately I've had to take this version off my server and revert to ChrisP's old one.

Psyk0tik 07-09-2018 03:14

Re: [L4D2] Improved Automatic Campaign Switcher (ACS) [v1.9.0 (20180706)]
 
I haven't had time to fully read how this plugin handles map listing/naming nor look at the entire code, so please correct me if I'm wrong at any point below.

I would like to recommend creating a KeyValues file that is automatically appended with mapnames as section names, and then creating keys in each section that allow users to customize settings per map. Of course, add a default value so that not all maps would need to be configured to work. Take a look at Super Tanks++ as an example on how to create and use data from a KeyValues file. When creating an automatic campaign/map switcher plugin, it can be a delicate process to make sure that players don't have to deal with hard-coded settings. In the original version, ChrisP had users editing the source code to add campaign maps/names. It IS possible to generate the map names automatically. The only things users would have to do are to assign the Campaign names and order of maps.

Example:
PHP Code:

"c1m1_hotel"
{
     
"Campaign Name" "Dead Center"
     "Order" "1"
}
"c1m2_street"
{
     
"Campaign Name" "Dead Center"
     "Order" "2"


A file like that can be fully customizable by users and can even create a random order of maps to play through which can be fun!

The key elements to making this possible are:

1. ReadMapList()
2. KeyValues

rikka0w0 07-09-2018 10:25

Re: [L4D2] Improved Automatic Campaign Switcher (ACS) [v1.9.0 (20180706)]
 
Quote:

Originally Posted by Crasher_3637 (Post 2602110)
That's dangerous since trolls and griefers can just use that command per map and force the server to change maps/campaigns whenever they want as long as nobody else votes.

The "!chmap" and "!chmap2" is designed for my case, my friends and I play addon maps, and the vote system allow us to change map by voting. I havent thought about the misuse of these commands.

I will add a convar to control its behavior:
0 - Disable !chmap and !chmap2 (Default value)
1 - Enable, not voted is treated as NO
2 - Enable, not voted is treated as YES

rikka0w0 07-09-2018 10:37

Re: [L4D2] Improved Automatic Campaign Switcher (ACS) [v1.9.0 (20180706)]
 
Quote:

Originally Posted by Crasher_3637 (Post 2602220)
I haven't had time to fully read how this plugin handles map listing/naming nor look at the entire code, so please correct me if I'm wrong at any point below.

It IS possible to generate the map names automatically.

Currently the txt files in "translations" folder only handle localization, map names (converted to lower case only, e.g. "c1m1_hotel") are used as the key. It is the same for campaign/mission name localization, except campaign name is case-sensitive (e.g. "L4D2C1" not "l4d2c1").

The order of campaigns are controlled by missioncycle.*.txt (e.g. "missioncycle.coop.txt" for coop mode), new maps will be appended to the end of that file (AUTOMATICALLY), removed/invalid maps will be ignored and the server console prompts the admin to remove them (MANUALLY). "missioncycle.*.txt" also allow admin to exclude certain maps from the campaigns cycle.

However, currently there's no way of controlling the order of individual map. I'm thinking about introducing a "weight system" to control the order of maps. I still think altering map order is rarely required.

I think it might be a good idea to add an admin command which adds missing entries to localization text files. (for campaign and map names) :)

Mi.Cura 07-09-2018 10:47

Re: [L4D2] Improved Automatic Campaign Switcher (ACS) [v1.9.0 (20180706)]
 
Sorry but I had a question.

Now the vote for the next campaign only appears in the final maps, do you confirm?

Mi.Cura 07-09-2018 13:27

Re: [L4D2] Improved Automatic Campaign Switcher (ACS) [v1.9.0 (20180706)]
 
I dont understand.

Voting continues to appear anywhere in the game. It should only be on final maps.

The rest works well, but this option of player open the vote on any map of powers to players who should not.

This plugin would be great if it simply shows the voting for the next campaign, and only at the end of each map, and nothing else.

The fact that it automatically adds the maps is incredible, but the option of
!chmap and !campaign, I find it unnecessary, could it be removed?


Admins can manage the exchange of maps with the plugin:
l4d_campaign_manager.smx

But for the other players they must use your pluguim (ACS), just my opinion :)

Mi.Cura 07-09-2018 18:22

Re: [L4D2] Improved Automatic Campaign Switcher (ACS) [v1.9.0 (20180706)]
 
Now I'm not sure if the modification has already been made.

If it has not been done, please disregard my previous post.

And I'll wait for the new version.


All times are GMT -4. The time now is 05:47.

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