Meteor 2 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 getSwimmingEnabled()
Determine if swimming is enabled.
if(getSwimmingEnabled())
{
print("Swimming is enabled");
}
else
{
print("Swimming is disabled");
}
void setSwimmingEnabled(bool enable)
Enable or disable swimming (server only).
if(isServer())
{
setSwimmingEnabled(true);
}
Swimming is enabled by default meaning that human characters can cross water.
Disable swimming to restore classic Meteor 2 behaviour for the duration of the mission.
Swimming can be disabled in the Map Editor without the need for scripting in "Map Properties".
If swimming is enabled:
- Human characters (including players) can cross water to get across rivers and get to islands.
- Characters can exit boats when not near a shore.
- Characters can survive if their aircraft engine stops over water.
- Human characters cannot fire weapons while in water.
If swimming is disabled:
- Human characters (including players) cannot cross water.
- Characters will not survive if their aircraft engine stops over water.
- Characters cannot exit boats if not near shore (e.g. if the boat runs out of fuel you cannot exit the boat).
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", "");
Movie clips cannot be played in multiplayer.
void setSideID(uint8 sideNumber, int sideID)
Set side ID of an entire side (faction) for the duration of the mission.
Use this function to set faction allegiances.
Sides with matching side IDs will not attack each other.
sideNumber must match the side number in game.ini, for example [side0] is 0.
sideID corresponds to SideId=? in each side's section in game.ini.
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 onObjectSpawn 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 getMinimapOpen()
Get whether the minimap is currently open on the local computer.
print(getMinimapOpen());
void setMinimapOpen(bool open)
Open or close the minimap on the local computer.
setMinimapOpen(false);
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.
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.
int getSkillLevel()
Get the game skill level.
print(getSkillLevel());
void setSkillLevel(int level)
Set the game skill level.
setSkillLevel(4);
Valid values are between 0 and 4.
The default (normal) is 2.
Changes to the skill level persist for the entire game and won't full take effect until the the next map is loaded.
In multiplayer only the server can set the skill level.
int getTimeLimit()
Get the remaining mission time limit in seconds.
print(getTimeLimit());
void setTimeLimit(int level)
Set the mission time remaining in seconds.
setTimeLimit(60);
Set to -1 to cancel the time limit.
In multiplayer only the server can set the time limit.
vector2 getFlashlightSize()
Get the current player flashlight size.
print(getFlashlightSize());
void setFlashlightSize(vector2 size)
Change the player flashlight colour.
setFlashlightSize(vector2(100, 100));
string getFlashlightColour()
Get the current player flashlight size.
print(getFlashlightColour());
colour is returned as an HTML string (e.g. red = "#ff0000").
void setFlashlightColour(string colour)
Set the player flashlight colour for the duration of the mission.
setFlashlightColour("#0000ff");
The colour parameter is passed as an HTML string (e.g. red = "#ff0000").
Index
Generated on the 23 November 2024 at 08:20:42 (UK Time)