Meteor Scripting Functions
Mission
bool getSinglePlayerRespawnEnabled()
Determine if single player respawn is enabled.
if(getSinglePlayerRespawnEnabled())
{
print("Single player respawn is enabled");
}
else
{
print("Single player respawn is disabled");
}
void setSinglePlayerRespawnEnabled(bool enable)
Enable or disable single player respawn instead of reloading the level.
setSinglePlayerRespawnEnabled(true);
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).
bool getSinglePlayerPowerUpsStay()
Get whether "stay in coop" power-ups also stay in single player (single player/server only).
void setSinglePlayerPowerUpsStay(bool stay)
Set whether "stay in coop" power-ups also stay in single player (single player/server only).
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.
bool getAutoPlayerNightGearEnabled()
Determine whether to automatically issue players with night gear (single player/server only).
void setAutoPlayerNightGearEnabled(bool enable)
Set whether to automatically issue players with night gear (single player/server only).
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.
void endLevel()
End the current level (server only).
if(isServer())
{
endLevel();
}
Same as typing "endlevel" in the game console.
void gameOver(string message)
Kill the local player.
gameOver("Why?");
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.
void runMap(string mapFilename)
Play a map (server only).
runMap("start");
Same as typing "map <filename>" in the game console.
void playMovieClip(string clipFilename, string soundName)
Play a FLC movie clip from the base folder.
playMovieClip("intro.flc", "intro");
playMovieClip("intro.flc", "");
void setMissionMoveToPos(vector2 pos, string name="", int playerID=-1)
Display a distance and direction indicator to the specified position.
setMissionMoveToPos(vector2(2000, 2000), "Objective");
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.
void clearMissionMoveToPos(int playerID=-1)
Clear the current mission move to position (stops displaying the distance/direction indicators).
clearMissionMoveToPos();
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).
vector2 getMissionMoveToPos(int playerID=-1)
Get the current mission move to position.
print(getMissionMoveToPos());
playerID is optional, default is local player.
Returns 0,0 if no move to pos is active.
vector2 getMissionMoveToName(int playerID=-1)
Get the current mission move to name.
print(getMissionMoveToName());
playerID is optional, default is local player.
name parameter is optional.
int createTriggerBox(vector2 pos, vector2 size, string tag)
Create a trigger box (local only).
int trigger_baseEntrance = createTriggerBox(vector2(500,500), vector2(60,20), "base_entrance");
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.
void deleteTriggerBox(int trigerBoxID)
Delete a trigger box (local only).
deleteTriggerBox(1);
The trigger box will be deleted. The ID number will not be reused.
void setTriggerBoxEnabled(int triggerBoxID)
Create a trigger box (local only).
setTriggerBoxEnabled(1, false);
bool getTriggerBoxEnabled(int triggerBoxID)
Get the enabled status of a trigger box.
print(getTriggerBoxEnabled(1));
bool getMinimapEnabled()
Get the enabled status of the minimap.
print(getMinimapEnabled());
void setMinimapEnabled(bool enable)
Set the enabled status of the minimap (server only).
setMinimapEnabled(false);
Enables or disables the minimap for the duration of the level for all players.
void skipShowPlayerLocation()
Skip the "you are here" screen when starting the mission in single player (local only).
void onWorldStart()
{
skipShowPlayerLocation();
}
Useful for helicopter insertion missions.
Add to onWorldStart() which runs on server and clients (including single player).
int getCorpseLimit()
Get the maximum number of corpses allowed on the map.
print(getCorpseLimit());
void setCorpseLimit(int count)
Set the maximum number of corpses allowed on the map (server only).
setCorpseLimit(20);
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.
int getWreckLimit()
Get the maximum number of wrecks allowed on the map.
print(getWreckLimit());
void setWreckLimit(int count)
Set the maximum number of wrecks allowed on the map (server only).
setWreckLimit(10);
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.
Index
Generated on the 15 May 2024 at 09:00:40 (UK Time)