Meteor Scripting Functions
Mission
bool getSinglePlayerRespawnEnabled()
Determine if single player respawn is enabled.

Example
if(getSinglePlayerRespawnEnabled())
{
    print("Single player respawn is enabled");
}
else
{
    print("Single player respawn is disabled");
}

See also
setSinglePlayerRespawnEnabled

void setSinglePlayerRespawnEnabled(bool enable)
Enable or disable single player respawn instead of reloading the level.

Example
// enable single player respawn
setSinglePlayerRespawnEnabled(true);

Comments
Single player respawn is disabled by default so the level reloads and restarts.
Enable single player respawn to teleport the player back to the start of the mission (player items will not be changed on restart).

See also
getSinglePlayerRespawnEnabled onPlayerSpawn

bool getSinglePlayerPowerUpsStay()
Get whether "stay in coop" power-ups also stay in single player (single player/server only).

See also
setSinglePlayerPowerUpsStay

void setSinglePlayerPowerUpsStay(bool stay)
Set whether "stay in coop" power-ups also stay in single player (single player/server only).

Comments
Set to true to keep "stay in coop" power-ups in single player.
Resets to default value (false) at the start of the next mission.

See also
getSinglePlayerPowerUpsStay

bool getAutoPlayerNightGearEnabled()
Determine whether to automatically issue players with night gear (single player/server only).

See also
setAutoPlayerNightGearEnabled

void setAutoPlayerNightGearEnabled(bool enable)
Set whether to automatically issue players with night gear (single player/server only).

Comments
Set to true to equip all players with night vision goggles and flashlights. Night vision goggles will be switched on automatically.
Resets to default (false) when starting a new mission.

See also
getAutoPlayerNightGearEnabled

void endLevel()
End the current level (server only).

Example
if(isServer())
{
    endLevel();
}

Comments
Same as typing "endlevel" in the game console.

See also
gameOver runMap

void gameOver(string message)
Kill the local player.

Example
gameOver("Why?");

Comments
Same as typing "kill" in the game console.
In single player this causes level restart, in multiplayer this prompts a respawn.
message is not net synced.

See also
gameOver runMap

void runMap(string mapFilename)
Play a map (server only).

Example
runMap("start");

Comments
Same as typing "map <filename>" in the game console.

See also
endlevel gameOver

void playMovieClip(string clipFilename, string soundName)
Play a FLC movie clip from the base folder.

Example
// example 1: intro with sound
playMovieClip("intro.flc", "intro");

// example 2: intro without sound
playMovieClip("intro.flc", "");

void setMissionMoveToPos(vector2 pos, string name="", int playerID=-1)
Display a distance and direction indicator to the specified position.

Example
setMissionMoveToPos(vector2(2000, 2000), "Objective");

Comments
name is optional, default is empty string.
playerID is optional, default is local player.
If run from a client this function can only affect the local player.
If run from a server this function can affect any player (use playerID to specifiy which player).
The move to pos does not clear after multiplayer respawn. Use the onUnitSpawned event to clear if required.
The move to pos is cleared when starting a new mission (changing map).
The move to pos and name are network synced to all players.

See also
clearMissionMoveToPos getMissionMoveToPos getMissionMoveToName

void clearMissionMoveToPos(int playerID=-1)
Clear the current mission move to position (stops displaying the distance/direction indicators).

Example
clearMissionMoveToPos();

Comments
playerID is optional, default is local player.
If run from a client this function can only affect the local player.
If run from a server this function can affect any player (use playerID to specifiy which player).

See also
setMissionMoveToPos clearMissionMoveToPos getMissionMoveToName

vector2 getMissionMoveToPos(int playerID=-1)
Get the current mission move to position.

Example
print(getMissionMoveToPos());

Comments
playerID is optional, default is local player.
Returns 0,0 if no move to pos is active.

See also
setMissionMoveToPos clearMissionMoveToPos getMissionMoveToName

vector2 getMissionMoveToName(int playerID=-1)
Get the current mission move to name.

Example
print(getMissionMoveToName());

Comments
playerID is optional, default is local player.
name parameter is optional.

See also
setMissionMoveToPos clearMissionMoveToPos getMissionMoveToPos

int createTriggerBox(vector2 pos, vector2 size, string tag)
Create a trigger box (local only).

Example
// create a 60x30 pixels trigger box centred around position 500,500 with a tag of "base_entrance".
int trigger_baseEntrance = createTriggerBox(vector2(500,500), vector2(60,20), "base_entrance");

Comments
This function creates a trigger box locally only (not network replicated).
size is in pixels.
The returned triggerBoxID is local to this computer.
The trigger box is enabled by default.
Returns -1 if no trigger box was created (invalid size or too many triggers).
Store the returned triggerBoxID if you need to alter or delete the trigger box later on.
Use the "triggers" console command to toggle showing trigger boxes in-game.

See also
deleteTriggerBox setTriggerBoxEnabled getTriggerBoxEnabled onTriggerBoxEnter onTriggerBoxExit

void deleteTriggerBox(int trigerBoxID)
Delete a trigger box (local only).

Example
// delete trigger box ID 1
deleteTriggerBox(1);

Comments
The trigger box will be deleted. The ID number will not be reused.

See also
createTriggerBox setTriggerBoxEnabled getTriggerBoxEnabled onTriggerBoxEnter onTriggerBoxExit

void setTriggerBoxEnabled(int triggerBoxID)
Create a trigger box (local only).

Example
// disable trigger box ID 1
setTriggerBoxEnabled(1, false);

See also
createTriggerBox deleteTriggerBox getTriggerBoxEnabled onTriggerBoxEnter onTriggerBoxExit

bool getTriggerBoxEnabled(int triggerBoxID)
Get the enabled status of a trigger box.

Example
print(getTriggerBoxEnabled(1));

See also
createTriggerBox deleteTriggerBox setTriggerBoxEnabled onTriggerBoxEnter onTriggerBoxExit

bool getMinimapEnabled()
Get the enabled status of the minimap.

Example
print(getMinimapEnabled());

See also
setMinimapEnabled

void setMinimapEnabled(bool enable)
Set the enabled status of the minimap (server only).

Example
setMinimapEnabled(false);

Comments
Enables or disables the minimap for the duration of the level for all players.

See also
getMinimapEnabled

void skipShowPlayerLocation()
Skip the "you are here" screen when starting the mission in single player (local only).

Example
void onWorldStart()
{
    // skip player location
    skipShowPlayerLocation();
}

Comments
Useful for helicopter insertion missions.
Add to onWorldStart() which runs on server and clients (including single player).

See also
onWorldStart

int getCorpseLimit()
Get the maximum number of corpses allowed on the map.

Example
// display corpse limit
print(getCorpseLimit());

See also
setCorpseLimit setWreckLimit getWreckLimit

void setCorpseLimit(int count)
Set the maximum number of corpses allowed on the map (server only).

Example
// set corpse limit
setCorpseLimit(20);

Comments
Corpse sprites are deleted in creation order.
Corpses placed in the Map Editor are not deleteed.
Set count to 0 for unlimited.
Passing a negative value will be clamped to 0.

See also
getCorpseLimit setWreckLimit getWreckLimit

int getWreckLimit()
Get the maximum number of wrecks allowed on the map.

Example
// display wreck limit
print(getWreckLimit());

See also
setWreckLimit setCorpseLimit getCorpseLimit

void setWreckLimit(int count)
Set the maximum number of wrecks allowed on the map (server only).

Example
// set wreck limit
setWreckLimit(10);

Comments
Wreck sprites are deleted in creation order.
Wreck sprites placed in the Map Editor are not deleted.
Set count to 0 for unlimited.
Passing a negative value will be clamped to 0.

See also
getWreckLimit setCorpseLimit getCorpseLimit


Index