Skip to content
/ ACS Public

Automatic Campaign Switcher for Left4Dead 2

Notifications You must be signed in to change notification settings

Chris7c0/ACS

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 

Repository files navigation

Automatic Campaign Switcher (ACS)

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 forum post corresponding to this page can be found on AlliedMods.net

Installation

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

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

Features of Automatic Campaign Switcher

  • 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)
// 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
// 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

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

About

Automatic Campaign Switcher for Left4Dead 2

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages