game start event||doc135779

September 20, 2022

Format

 GAME_START
  • The class to which the function belongs:Game

Description

This event is fired when the game starts.


Precautions

  • If the duration of other stages of the game is set in the game settings of the editor, the trigger timing of the event is after these timings are over. If not set, it will be triggered 3 seconds after the initialization is completed.

Code Samples

on the server sideglobal script, registering at the start of the gameCallback, set all player position coordinates to (0, 0, 0)

Trigger.RegisterHandler(World.cfg, "GAME_START", function()
    local players = Game.GetAllPlayers()
    for i, v in pairs(players) do
        v:setPos(Lib.v3(0, 0, 0), 0, 0)
    end
end)