Meteor 2 Scripting Functions
Effects
void createExplosion(vector2 pos, float radius, float damage, float armourPenetration, int ownerID)
Create an in-game explosion (server only).

Example
if(isServer())
{
    createExplosion(getPos(PLAYER_OBJECT), 20, 100, 50, PLAYER_OBJECT);
}

Comments
Cannot run on client.
armourPenetration is 0 to 100.

void fade(string text, float fadeOutSeconds, float fadedSeconds, float fadeInSeconds)
Fades out the screen, displays a message and fades back in.

Example
// example 1: fade out over 1 seconds, show text for 3 seconds, fade in over 1 second
fade("Later that day...", 1, 3, 1);

// example 2: instantly turn screen black, wait 2 seconds, fade in over 2 seconds
fade("", 0, 2, 2);

Comments
Only affects the local computer.
Player controls are disabled while fading and while faded.

See also
getCinematicBarsEnabled setCinematicBarsEnabled

bool getCinematicBarsEnabled()
Gets whether the cinematic bars are enabled.

Example
if(getCinematicBarsEnabled())
{
    print("Cinematic bars are enabled.");
}
else
{
    print("Cinematic bars are disabled.");
}

See also
setCinematicBarsEnabled fade

void setCinematicBarsEnabled(bool enabled)
Sets whether the cinematic bars are enabled.

Example
// enable cinematic bars
setCinematicBarsEnabled(true);

Comments
Only affects the local player.
Player controls are disabled while cinematic bars are enabled.

See also
getCinematicBarsEnabled fade

bool getMaxWildlifeDistance()
Get the maximum wildlife particle distance.

Example
print(getMaxWildlifeDistance());

Comments
Wildlife particles further than this distance from the game window centre will be culled automatically.

See also
addWildlifeParticle

void addWildlifeParticle(vector2 spawnPos, uint filenameHash)
Spawn a wildlife particle (e.g. insect or bird).

Example
unsigned birdHash = createStringHashLowerCase("Wildlife_Bird01.ini");
vector2 playerPos = getPos(PLAYER_OBJECT);
for(int i=0; i<10; i++)
{
    addWildlifeParticle(playerPos, birdHash);
}

Comments
The particle filename is required as a hash for better performance. Use createStringHashLowerCase() to generate a filename hash once before any loops.

See also
getMaxWildlifeDistance createStringHashLowerCase getWildlifeParticleInstanceCount

int getWildlifeParticleInstanceCount(uint filenameHash)
Get the current particles instance count of a willife particle type.

Example
unsigned birdHash = createStringHashLowerCase("Wildlife_Bird01.ini");
int birdsCount = getWildlifeParticleInstanceCount(birdHash);
print("Birds count: " + birdsCount);

See also
addWildlifeParticle createStringHashLowerCase

void addPlantParticle(vector2 spawnPos, uint filenameHash)
Spawn a plant particle (e.g. grass or flower).

Example
unsigned grassHash = createStringHashLowerCase("Plant_Grass01.ini");
vector2 playerPos = getPos(PLAYER_OBJECT);
for(int i=0; i<10; i++)
{
    addPlantParticle(playerPos, grassHash);
}

Comments
The particle filename is required as a hash for better performance. Use createStringHashLowerCase() to generate a filename hash once before any loops.

See also
createStringHashLowerCase getPlantParticleInstanceCount

int getPlantParticleInstanceCount(uint filenameHash)
Get the current particles instance count of a plant particle type.

Example
unsigned grassHash = createStringHashLowerCase("Plant_Grass01.ini");
int grassHash = getPlantParticleInstanceCount(grassHash);
print("Grass count: " + birdsCount);

See also
addWildlifeParticle createStringHashLowerCase


Index