AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Plugins (https://forums.alliedmods.net/forumdisplay.php?f=108)
-   -   [L4D2] Automatic Campaign Switcher (ACS) [v2.0.0 (Nov 16, 2021)] - OVERHAULED! (https://forums.alliedmods.net/showthread.php?t=156392)

ChrisP 05-05-2011 19:57

[L4D2] Automatic Campaign Switcher (ACS) [v2.0.0 (Nov 16, 2021)] - OVERHAULED!
 
2 Attachment(s)
Automatic Campaign Switcher

Drag and Drop Map Cycling for Left 4 Dead 2


Automatic Campaign Switcher, or ACS, was created as an easily deployed solution to maintain a campaign/map rotation on a Left 4 Dead 2 server. This solves the problem of players returning to the lobby because the vote to restart a campaign was not passed. By default, ACS will cycle through maps in chronological order corresponding to the Left4Dead story timeline. However, this can easily be modified to run a different rotation, as well as to add custom campaigns/maps. ACS also includes a voting system in which people can vote for their favorite campaign/map if they wish to interrupt the current cycle. The winning campaign/map will become the next map the server loads once the current one has been completed. I wrote ACS in such a way that is relatively easy to understand and edit for those who wish to modify the source for their needs.


The source code can be found on my github.


Installation

Simply drag the .smx file into your plugins folder. Your plugins folder will likely be something like this:

C:\Program Files (x86)\Steam\steamapps\common\left 4 dead 2\left4dead2\addons\sourcemod\plugins\

Features

  • ACS is easy to install, there is no messing with text files, just plug and play.
  • Automatically rotates campaigns/maps in the L4D story chronological order.
  • Easily set up your own custom campaign rotation by editing a plain text config file.
  • Voting System that allows players to vote for the next campaign/map.
  • Supports every stock gamemode in L4D2:
  • coop
  • realism
  • versus
  • teamversus
  • teamscavenge
  • scavenge
  • mutation 1-20
  • community 1-5
  • Supports dynamic gamemode switching.
  • In other words, ACS will still work if the server switches to another game mode without restarting or shutting down the server.
  • You can limit the amount of failures during a Coop campaign finale map before ACS will switch to the next campaign.


Player Commands

!mapvote - Allows any player to vote and revote for the next campaign to play
!mapvotes - Displays to the player the current vote winner as well as all of the current votes

Customizing ACS

Custom Settings

If you want to disable the voting system or change other settings, then edit the cvars in the config file. This file will be located in a location similar to this:

C:\Program Files (x86)\Steam\steamapps\common\left 4 dead 2\left4dead2\cfg\sourcemod\Automatic_Campaign _Switcher_vX.X.X.cfg

Console Variables (CVars)

Code:

// Version of Automatic Campaign Switcher (ACS) on this server
acs_version

// Enables players to vote for the next map or campaign [0 = DISABLED, 1 = ENABLED]
acs_voting_system_enabled "1"

// Determines if a sound plays when a new map is winning the vote [0 = DISABLED, 1 = ENABLED]
acs_voting_sound_enabled "1"

// Sets how to advertise voting at the start of the map [0 = DISABLED, 1 = HINT TEXT, 2 = CHAT TEXT, 3 = OPEN VOTE MENU]
acs_voting_ad_mode "3"

// Time, in seconds, to wait after survivors leave the start area to advertise voting as defined in acs_voting_ad_mode
acs_voting_ad_delay_time "1.0"

// Sets how the next campaign/map is advertised during a finale or scavenge map [0 = DISABLED, 1 = HINT TEXT, 2 = CHAT TEXT]
acs_next_map_ad_mode "1"

// The time, in seconds, between advertisements for the next campaign/map on finales and scavenge maps
acs_next_map_ad_interval "600.0"

// The amount of times the survivors can fail a finale in Coop before it switches to the next campaign [0 = INFINITE FAILURES]
acs_max_coop_finale_failures "4"


Custom Campaigns/Maps

If you choose to change the default map rotation or set up a custom maps, then edit acs_map_list.txt which can be found in a location similar to this:

C:\Program Files (x86)\Steam\steamapps\common\left 4 dead 2\left4dead2\addons\sourcemod\configs\acs_map _list.txt

acs_map_list.txt

Code:

// Automatic Campaign Switcher (ACS) Map List Config File
// ======================================================
// This file was automatically generated by ACS v2.0.0
//
// USAGE
// 1) Each row represents one map for one game mode.
// 2) The order the maps are listed here controls the order in game.
// 3) Custom maps work, as long as the server can load the map.
// 4) There is a hardcoded limit of 200 maps, changeable in the source.
// 5) CAMPAIGN, SCAVENGE, and SURVIVAL are the only game modes needed.
// 6) SCAVENGE and SURVIVAL do not require a END_MAP_NAME.
// 7) Changes made while server is running will be loaded on next map change.
// 8) Check server console output to see if everything loaded into ACS properly.
//
// COLUMN HEADERS
// GAMEMODE, MAP_DESCRIPTION, START_MAP_NAME, END_MAP_NAME

// CAMPAIGN MAPS
CAMPAIGN, No Mercy, c8m1_apartment, c8m5_rooftop
CAMPAIGN, Crash Course, c9m1_alleys, c9m2_lots
CAMPAIGN, Death Toll, c10m1_caves, c10m5_houseboat
CAMPAIGN, Dead Air, c11m1_greenhouse, c11m5_runway
CAMPAIGN, Blood Harvest, c12m1_hilltop, c12m5_cornfield
CAMPAIGN, The Sacrifice, c7m1_docks, c7m3_port
CAMPAIGN, Dead Center, c1m1_hotel, c1m4_atrium
CAMPAIGN, The Passing, c6m1_riverbank, c6m3_port
CAMPAIGN, Dark Carnival, c2m1_highway, c2m5_concert
CAMPAIGN, Swamp Fever, c3m1_plankcountry, c3m4_plantation
CAMPAIGN, Hard Rain, c4m1_milltown_a, c4m5_milltown_escape
CAMPAIGN, The Parish, c5m1_waterfront, c5m5_bridge
CAMPAIGN, Cold Stream, c13m1_alpinecreek, c13m4_cutthroatcreek
CAMPAIGN, The Last Stand, c14m1_junkyard, c14m2_lighthouse

// SCAVENGE MAPS
SCAVENGE, No Mercy: The Apartments, c8m1_apartment
SCAVENGE, No Mercy: The Rooftop, c8m5_rooftop
SCAVENGE, Crash Course: The Alleys, c9m1_alleys
SCAVENGE, Death Toll: The Church, c10m3_ranchhouse
SCAVENGE, Dead Air: The Terminal, c11m4_terminal
SCAVENGE, Blood Harvest: The Farmhouse, c12m5_cornfield
SCAVENGE, The Sacrifice: Brick Factory, c7m1_docks
SCAVENGE, The Sacrifice: Barge, c7m2_barge
SCAVENGE, Dead Center: Mall Atrium, c1m4_atrium
SCAVENGE, The Passing: Riverbank, c6m1_riverbank
SCAVENGE, The Passing: Underground, c6m2_bedlam
SCAVENGE, The Passing: Port, c6m3_port
SCAVENGE, Dark Carnival: Motel, c2m1_highway
SCAVENGE, Swamp Fever: Plank Country, c3m1_plankcountry
SCAVENGE, Hard Rain: Milltown, c4m1_milltown_a
SCAVENGE, Hard Rain: Sugar Mill, c4m2_sugarmill_a
SCAVENGE, The Parish: Park, c5m2_park
SCAVENGE, The Last Stand: The Village, c14m1_junkyard
SCAVENGE, The Last Stand: The Lighthouse, c14m2_lighthouse

// SURVIVAL MAPS
SURVIVAL, No Mercy: Generator Room, c8m2_subway
SURVIVAL, No Mercy: Rooftop, c8m5_rooftop
SURVIVAL, Crash Course: Truck Depot, c9m2_lots
SURVIVAL, The Sacrifice: Train Car, c7m1_docks
SURVIVAL, The Sacrifice: Port, c7m3_port
SURVIVAL, Dead Center: Mall Atrium, c1m4_atrium
SURVIVAL, The Passing: Riverbank, c6m1_riverbank
SURVIVAL, The Passing: Underground, c6m2_bedlam
SURVIVAL, The Passing: Port, c6m3_port
SURVIVAL, Dark Carnival: Motel, c2m1_highway
SURVIVAL, Dark Carnival: Stadium Gate, c2m4_barns
SURVIVAL, Dark Carnival: Concert, c2m5_concert
SURVIVAL, Swamp Fever: Gator Village, c3m1_plankcountry
SURVIVAL, Swamp Fever: Plantation, c3m4_plantation
SURVIVAL, Hard Rain: Burger Tank, c4m1_milltown_a
SURVIVAL, Hard Rain: Sugar Mill, c4m2_sugarmill_a
SURVIVAL, The Parish: Bus Depot, c5m2_park
SURVIVAL, The Parish: Bridge, c5m5_bridge
SURVIVAL, The Last Stand: Junkyard, c14m1_junkyard
SURVIVAL, The Last Stand: Lighthouse, c14m2_lighthouse


Change Log
Code:

v2.0.0 (Nov 14, 2021)
  - Overhauled most the code, rewriting many functions to be more generic and reusable
  - Changed to a single map list array with indexes that adjust based on gamemode
  - Added a map list config file thats plain text and can be easily configured
    - This file can be edited to set up any custom map for any game mode with any order
    - Just run the plugin and this file will generate itself with the default maps
      the first time ACS is ran.
  - Added Maps Listing in console output to help with configuring custom maps
  - Updated all the default maps for every stock game mode
  - Added hook for OnPZEndGamePanelMsg that intercepts and removes the vote at the
    end of a campaign where it asks to play with the group again. This is also used
    as a better method for knowing its time to switch to next campaign.  This method
    works without the need for a separate signatures file. It works for all modes
    except for Coop and Survival that will continue forever. These modes are handled
    through event hooks.
  - Added file modified detection for Map List Config that will update ACS on map change.
  - Fixed config file not loading changes
  - Converted everything to new syntax

v1.2.4 (Dec 31, 2020)
  - Added new maps for the Last Stand Update
  - Added precache of witch models to fix bug in The Passing campaign transition crash
  - Made map comparisons case insensitive
  - Fixed several infinite loop bugs when on the last campaign
  - Changed Timer_AdvertiseNextMap to not have TIMER_REPEAT and TIMER_FLAG_NO_MAPCHANGE together
  - Removed FCVAR_PLUGIN
  - Removed global menu handle
  - Added the code from [L4D/L4D2] Return To Lobby Fix from MasterMind420. Thank you!

v1.2.3 (Jan 8, 2012)
  - Added the new L4D2 campaigns

v1.2.2 (May 21, 2011)
  - Added message for new vote winner when a player disconnects
  - Fixed the sound to play to all the players in the game
  - Added a max amount of coop finale map failures cvar
  - Changed the wait time for voting ad from round_start to the
    player_left_start_area event
  - Added the voting sound when the vote menu pops up

v1.2.1 (May 18, 2011)
  - Fixed mutation 15 (Versus Survival)

v1.2.0 (May 16, 2011)
  - Changed some of the text to be more clear
  - Added timed notifications for the next map
  - Added a cvar for how to advertise the next map
  - Added a cvar for the next map advertisement interval
  - Added a sound to help notify players of a new vote winner
  - Added a cvar to enable/disable sound notification
  - Added a custom wait time for coop game modes

v1.1.0 (May 12, 2011)
  - Added a voting system
  - Added error checks if map is not found when switching
  - Added a cvar for enabling/disabling voting system
  - Added a cvar for how to advertise the voting system
  - Added a cvar for time to wait for voting advertisement
  - Added all current Mutation and Community game modes

v1.0.0 (May 5, 2011)
  - Initial Release



The source code can be found on my github.



Enjoy!

JackieChan 05-05-2011 21:05

Re: [L4D2] Automatic Campaign Switcher (ACS)
 
Nice work!

Would it be possible to add a vote be fired at the start of the last map to choose which campaign to switch to at the end of each campaign?

DestructDez1 05-06-2011 02:32

Re: [L4D2] Automatic Campaign Switcher (ACS)
 
Fantastic job. looked for ever for something like this. FMC has too many issues and is difficult to use at times. Support for mutation12 was a dream come true when I saw this.

Tested on 6 servers. Everything works.

xindong 05-10-2011 00:57

Re: [L4D2] Automatic Campaign Switcher (ACS)
 
Very good.
But I hope can increase hints

Zbeer 05-10-2011 11:19

Re: [L4D2] Automatic Campaign Switcher (ACS)
 
Will work in mutation19?

MasterMind420 05-11-2011 23:26

Re: [L4D2] Automatic Campaign Switcher (ACS)
 
First of all, would just like to say U ARE THE MAN. Been looking for this for a long time. Now I do have one request and not sure if its possible. Can you make it so it doesn't switch until after the end campaign stats are shown, kinda sucks cuz I like being able to see how well I did compared to others. If not thats cool too, you still get mad props...thanks again.

ChrisP 05-12-2011 19:12

Re: [L4D2] Automatic Campaign Switcher (ACS)
 
Quote:

Originally Posted by JackieChan (Post 1463902)
Nice work!

Would it be possible to add a vote be fired at the start of the last map to choose which campaign to switch to at the end of each campaign?

I added a voting system with some settings to configure, if you wish.

Quote:

Originally Posted by xindong (Post 1466610)
Very good.
But I hope can increase hints

I am not sure what you mean by this. Do you mean to add text to tell players that the map will automatically change? Please elaborate.

Quote:

Originally Posted by Zbeer (Post 1466844)
Will work in mutation19?

I updated ACS to now work will all mutation and comminuty game modes.

Quote:

Originally Posted by MasterMind420 (Post 1467829)
First of all, would just like to say U ARE THE MAN. Been looking for this for a long time. Now I do have one request and not sure if its possible. Can you make it so it doesn't switch until after the end campaign stats are shown, kinda sucks cuz I like being able to see how well I did compared to others. If not thats cool too, you still get mad props...thanks again.

I could make it so that the time to switch the map matches up with the time it takes for the statistics to scroll by, but there is a problem. If you play to the end of the campaign, you will notice that the players have the option of skipping the credits. If they do this, it will automatically send them to the lobby. I am not sure that there is a way around this. If you or anyone else has a solution, post it, and I will see if I can implement it.


I am glad that you guys like the plugin. If there is anything else I can do to improve ACS more to your liking, let me know.

JackieChan 05-13-2011 05:34

Re: [L4D2] Automatic Campaign Switcher (ACS) [v1.1.0 (5/12/2011)]
 
Awesome Chris, very nice! Thanks for adding my suggestion.

xindong 05-13-2011 06:02

Re: [L4D2] Automatic Campaign Switcher (ACS) [v1.1.0 (5/12/2011)]
 
Means: in the final hurdle began hints.

MasterMind420 05-14-2011 08:56

Re: [L4D2] Automatic Campaign Switcher (ACS) [v1.1.0 (5/12/2011)]
 
ok so, I changed this in the sp file so that i could watch the end stats in Coop all the way through:

#define TIME_TO_WAIT 70.0

Could you please re-add this in the next version, i'm sticking with version 1.0.0 for now...much appreciated.


All times are GMT -4. The time now is 23:50.

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