Skip to content

Lua gamemode script

Jakub Baranowski edited this page Aug 14, 2021 · 4 revisions

gamemode.script

This is where most of the magic happens. This class defines your game mode. Methods of this class are actually "overloading" the base gamemode class. This means that the game will call the methods you define here on specified events, e.g.: PlayerInsertionPointChanged will be called when a player selects an insertion point on the ops board.

PreInit()

Method called right after the mission is loaded.

PostInit()

Method called just before player gets control.

OnRoundStageSet(RoundStage)

Parameters:

  • RoundStage string named of the set round stage
    • "WaitingForReady"
    • "ReadyCountdown"
    • "PreRoundWait"
    • "InProgress"
    • "PostRoundWait"

Triggered when a round stage is set. Round stage can be anything set by the user using the gamemode.SetRoundStage(stage) function. Howver there are some predefined round stages.

OnRoundStageTimeElapsed(RoundStage)

Parameters:

  • RoundStage string Name of the elapsed round stage
    • "WaitingForReady"
    • "ReadyCountdown"
    • "PreRoundWait"
    • "InProgress"
    • "PostRoundWait"

Triggered when a round stage time elapse. Round stage can be anything set by the user using the gamemode.SetRoundStage(stage) function. However there are some predefined round stages.

OnCharacterDied(Character, CharacterController, KillerController)

Parameters:

  • Character Character Character that died.
  • CharacterController Controller Controller of the character that died.
  • KillerController Controller Controller of the character that killed the character.

Triggered whenever any character dies (player or bot).

OnGameTriggerBeginOverlap(GameTrigger, Player)

Parameters:

  • GameTrigger Actor
  • Player Player

Triggered whenever any actor ovelaps a trigger. Note: Extraction points act as triggers as well.

PlayerInsertionPointChanged(PlayerState, InsertionPoint)

Parameters:

  • PlayerState PlayerState
  • InsertionPoint InsertionPoint

Method called when a player changes the selected insertion point.

PlayerReadyStatusChanged(PlayerState, ReadyStatus)

Parameters:

  • PlayerState PlayerState
  • ReadyStatus string some possible values
    • "WaitingToReadyUp"
    • "DeclaredReady"

Method called when a player changes their ready status. If mission provides insertion points this is called at more or less the same time as PlayerInsertionPointChanged.

PlayerCanEnterPlayArea(PlayerState)

Parameters:

  • PlayerState PlayerState

Returns boolean PlayerCanEnterPlayArea whether or not should we allow users to enter play area.

Called by the game to check if the player should be allowed to enter play area.

PlayerEnteredPlayArea(PlayerState)

Parameters:

  • PlayerState PlayerState

Called when any player enters the play area.

PlayerGameModeRequest(PlayerState, Request)

Parameters:

  • PlayerState PlayerState
  • Request string some possible values
    • "join"

GetSpawnInfo(PlayerState)

Parameters:

  • PlayerState PlayerState

Returns Actor SpawnPoint the spawn point we want the user to spawn in.

Called when a player tries to enter play area in order to get a spawn point for the player. Has to return a spawn point in which the user will be spawned.

LogOut(Exiting)

Parameters:

  • Exiting any

Triggered whenever a player leaves the game.

ShouldCheckForTeamKills()

Returns boolean ShouldCheckForTeamKills should we check for team kills.

Whether or not we should check for team kills at this point.