Jump to content

Lua in SpringRTS/Callins/UnitCreated()

From Wikibooks, open books for an open world

UnitCreated()

[edit | edit source]

Description

[edit | edit source]

Runs when a unit instance is being made. In practise that can be a unit that just got spawned or a unit that started being built.
In unsynced mode the callin gets invoked whenever an instance of your units is made. In synced mode it invokes for any unit in the game.

Return values

[edit | edit source]

integer unitID,
integer unitDefID,
integer unitTeamID,
integer builderID

Usage example

[edit | edit source]
function widget:UnitCreated(unitID, unitDefID, unitTeamID, builderID)
  Spring.Echo("Unit "..unitID.." from team "..unitTeamID.." just got created by "..builderID)
end


[edit | edit source]

UnitDestroyed()