[L4D2] Chapter rotations

Post Python examples to help other users.
RenardDev
Junior Member
Posts: 5
Joined: Mon Jan 27, 2025 12:04 pm

[L4D2] Chapter rotations

Postby RenardDev » Mon Jan 27, 2025 12:17 pm

Syntax: Select all

from events.hooks import PreEvent, EventAction
from listeners.tick import Delay
from engines.server import queue_command_string

map_transitions = {
# L4D2 maps
'c1m4_atrium': 'c2m1_highway',
'c2m5_concert': 'c3m1_plankcountry',
'c3m4_plantation': 'c4m1_milltown_a',
'c4m5_milltown_escape': 'c5m1_waterfront',
'c5m5_bridge': 'c6m1_riverbank',
'c6m3_port': 'c13m1_alpinecreek',
'c13m4_cutthroatcreek': 'c1m1_hotel', # Looping back to start

# L4D maps
'c7m3_port': 'c8m1_apartment',
'c8m5_rooftop': 'c9m1_alleys',
'c9m2_lots': 'c10m1_caves',
'c10m5_houseboat': 'c11m1_greenhouse',
'c11m5_runway': 'c12m1_hilltop',
'c12m5_cornfield': 'c14m1_junkyard',
'c14m2_lighthouse': 'c7m1_docks', # Looping back to start
}

@PreEvent('finale_win')
def on_finale_win(game_event):
current_map = game_event['map_name']

next_map = map_transitions.get(current_map, None)
if next_map:
Delay(5, queue_command_string, (f'changelevel {next_map};', ), cancel_on_level_end=True)

return EventAction.CONTINUE

Return to “Code examples / Cookbook”

Who is online

Users browsing this forum: No registered users and 32 guests