Skip to content

Events

events are fired when the action is triggered

IsInGame

Fires when the player is in a save

Warning

This event isn't async, wait() does not work here

RegisterEvent("IsInGame", function()
    print("Joined")
end)

OnJoinGame

Fires when the player loads a save

Warning

This event isn't async, wait() does not work here

RegisterEvent("OnJoinGame", function()
    print("Joined")
end)

OnAsteroidDestroyed

Fires when the player destroy an asteroid

Args

count returns the number of asteroids destroyed since the save was created

RegisterEvent("OnAsteroidDestroyed", function(count)
    wait(1)
    print("Asteroids destroyed : " .. count)
end)

OnEnemieKilled

Fires when an enemie has been killed by the player

Args

count returns the number of enemies killed since the save was created

RegisterEvent("OnEnemieKilled", function(count)
    wait(1)
    print("Enemies killed : " .. count)
end)

OnCargoChanged

Fires when the player cargo changed

Args

count returns the current cargo that the player hold

RegisterEvent("OnCargoChanged", function(count)
    wait(1)
    print("Current cargo : " .. count)
end)

OnStationChanged

Fires when the player travels to a different station

Args

id returns the current station id

RegisterEvent("OnStationChanged", function(id)
    wait(1)
    print("Station id is " .. id)
end)

OnStationDocked

Fires when the player docked in a station

RegisterEvent("OnStationDocked", function()
    wait(1)
    print("You docked in this station " .. station.name)
end)

IsInMainMenu

Fires when the player is in the main menu

Warning

This event isn't async, wait() does not work here

RegisterEvent("IsInMainMenu", function()
    print("Main menu")
end)

OnMoneyChanged

Fires when the player money changed

Warning

This event isn't async, wait() does not work here

Args

money returns the current player money

RegisterEvent("OnMoneyChanged", function(money)
    print("Current money : " .. money)
end)

OnSystemChanged

Fires when the player travels to a different system

Args

id returns the current system id

RegisterEvent("OnSystemChanged", function(id)
    wait(1)
    print("System id : " .. id)
end)

OnUpdate

Fires every ticks

Warning

This event isn't async, wait() does not work here

RegisterEvent("OnUpdate", function()
    print("Update!")
end)

EarlyInit

Warning

This event isn't async, wait() does not work here

Args

This event is mandatory if you want to create new contents in the game such as custom ships, custom items and more

RegisterEvent("EarlyInit", function()
    print("Early init")
end)