GAMEMODE: Difference between revisions

From Zandronum Wiki
(Updated GAMEMODE lump information up to 3.2-alpha.)
Tag: Source edit
(Reword opening paragraph)
Tag: Source edit
Line 1: Line 1:
This special lump allows the current SkullTag game modes to be reconfigured.  Such game modes can be Deathmatch, Duel, SkullTag, Capture the Flag, Possession, etc....
'''GAMEMODE''' is a special lump that allows mods to change the attributes of [[Zandronum]]'s existing [[Game modes|game modes]], and initialise and enforce certain settings when certain game modes are in use.
The hard coded game modes internally use a bunch of flags to configure certain stuff and to share code. The GAMEMODE lump allows you to alter the flags a game mode uses so that you can combine game mode traits. The syntax for the lump is as follows:
 
The full syntax of the lump is as such:
 
  GAMEMODENAME
  GAMEMODENAME
  {
  {

Revision as of 16:03, 1 January 2023

GAMEMODE is a special lump that allows mods to change the attributes of Zandronum's existing game modes, and initialise and enforce certain settings when certain game modes are in use.

The full syntax of the lump is as such:

GAMEMODENAME
{
    RemoveFlag FLAGNAME1
    AddFlag FLAGNAME2
    Property "Value"

    GameSettings
    {
        CVar1 = <value>
        CVar2 = <value>

        offlineonly (development version 3.2-alpha and above only)
        {
            CVar3 = <value>
            CVar4 = <value>
        }
        
        onlineonly (development version 3.2-alpha and above only)
        {
            CVar5 = <value>
            CVar6 = <value>
        }
    }

    LockedGameSettings
    {
        CVar7 = <value>
    }
}

Flags

  • COOPERATIVE

Cooperative is a flag that distinguishes the coop modes (Cooperative, Survival, Invasion) from others game modes.

  • DEATHMATCH

Players are spawned at deathmatch starts (needs Zandronum 3.0 to work properly).

  • TEAMGAME

Players are spawned at team starts (needs Zandronum 3.0 to work properly).

  • USEFLAGASTEAMITEM

Forces a game mode to use a team's flag item or icon instead of their skull.

  • PLAYERSEARNKILLS

Players earn kills from monsters. This also displays their kills on the scoreboard.

  • PLAYERSEARNFRAGS

Players/teams win the game by killing enemy players.

  • PLAYERSEARNPOINTS

Players or teams win the game by earning points (e.g. capturing the flag in CTF). This also displays how many points a player or team has on the scoreboard.

  • PLAYERSEARNWINS

Players or teams win the game by winning rounds (particularly used in LMS). This also displays how many wins a player or team has on the scoreboard.

  • DONTSPAWNMAPTHINGS

Items and weapons aren't spawned (monsters are still spawned).

  • MAPRESETS

The map can be reset to the same state that it was when it was first started. The ResetMap ACS function and "ResetMap" CCMD require this flag to be added to work.

  • DEADSPECTATORS

Enables support for dead spectators, which are players that are dead and cannot rejoin until the round is over.

  • PLAYERSONTEAMS

Players are organized into teams, and displays the team selection menu when pressing the spacebar to join the game.

  • USEMAXLIVES

Players have a limited number of lives, controlled by the sv_maxlives CVar.

  • USETEAMITEM

Enables support for a team's flag or skull item in CTF and Skulltag respectively, or the white flag in 1-flag CTF.

  • MAPRESET_RESETS_MAPTIME

Resetting the map also resets the level time. This also prevents the time limit from being active while the game isn't in progress.

  • DONTPRINTPLAYERSLEFT

Prevents the "x allies/opponents left" message from being drawn on the screen.

Properties

  • Name

The name of the game mode as it appears on the scoreboard, countdown screen, and server console window.

  • ShortName

This is generally a shorter and abbreviated version of the game mode's name. This is only used in the built-in server browser.

  • F1Texture

The graphic that will be drawn in the "Read This!" menu in non-single player games if no other help page is defined.

  • WelcomeSound (development version 3.2-alpha and above only)

The announcer sound that's played at the start of a new game. For example, "welcome to capture the flag" or "welcome to Skulltag" in CTF and Skulltag respectively.

Gameplay and Compatibility Settings

You can initialize any flags belonging to gameplay or compatibility flagsets for a particular game mode. The flagsets that are currently supported are:

(development version 3.2-alpha and above only) The following CVars are also supported:

There are two different blocks that are used to initialize these flags, with different attributes:

  • GameSettings - flags can still be changed during gameplay. This is useful for mods that want to change certain flags by default but still allow the host to change as they see fit.
  • LockedGameSettings - flags can never be changed, and attempting to do so will print an error message. This is useful for mods that need certain flags enabled or disabled and don't want the host to mess with those settings.

If you want to initialize flags universally for your mod, you can add the DefaultGameSettings or DefaultLockedGameSettings blocks at the beginning of the file, which are applied across all game modes. You may then override some of these flags by also adding them to specific game modes. Additionally, if you want to remove a flag from a game mode, use RemoveGameSetting followed by the flag's name. Flags are enabled using either true or 1, or disabled using either false or 0.

Note: loading another DefaultGameSettings or DefaultLockedGameSettings block in a subsequent GAMEMODE lump will reset all the flags and their attributes back to zero.

Settings for Offline or Online Games Only

(development version 3.2-alpha and above only) By default, CVars are always initialized, for both offline (i.e. singleplayer or if multiplayer emulation is enabled) and online games. However, if a mod needs certain CVars to be set up differently for offline games or online games, then it's possible to insert two kinds of sub-blocks:

  • OfflineOnly - CVars in this block will be initialized in offline games only.
  • OnlineOnly - CVars in this block will be initialized in online games only.

The same CVar can be inserted in an OfflineOnly and OnlineOnly sub-block at the same time. It's guaranteed that the value specified in the former will be applied in offline games, while the value specified in the latter will be applied in online games. It's also possible to add these sub-blocks inside the DefaultGameSettings or DefaultLockedGameSettings blocks, which will be applied to all game modes.

Game Mode Names

Must be one of the following:

Example

For instance, if you would like to have teams in coop, the lump needs to be:

cooperative {
    addflag PLAYERSONTEAMS
}

A cooperative-based mod might want players to be able to walk and shoot through their teammates, and also prevent their attacks from pushing them around. Note that here, the server host has the option to enable or disable these flags if they feel like it.

Cooperative
{
    GameSettings
    {
        sv_unblockallies = true
        sv_shootthroughallies = true
        sv_dontpushallies = true
    }
}

This initializes some LMSFlags for the Last Man Standing game mode. By default, players can't start with a pistol or chainsaw, but they are guarantee to start with a plasma rifle. In addition, spectators are free to view and chat with live players. Note that here, the server host is allowed to modify lms_allowpistol and lms_spectatorchat, but is forbidden from changing lms_allowchainsaw, lms_allowplasma, and lms_spectatorview.

LastManStanding
{
    GameSettings
    {
        lms_allowpistol = false
        lms_spectatorchat = true
    }
	
    LockedGameSettings
    {
        lms_allowchainsaw = false
        lms_allowplasma = true
        lms_spectatorview = true
    }
}