Meteor 2 Scripting Functions
Effects
void createExplosion(vector2 pos, float height, float radius, float damage, float armourPenetration, int ownerID)
Create an in-game explosion.
createExplosion(getPos(PLAYER_OBJECT), 0, 20, 100, 50, PLAYER_OBJECT);
createExplosion(getPos(PLAYER_OBJECT), getAirHeight(), 20, 100, 50, PLAYER_OBJECT);
armourPenetration is 0 to 100.
Can be called from server or client.
void fade(string text, float fadeOutSeconds, float fadedSeconds, float fadeInSeconds)
Fades out the screen, displays a message and fades back in.
fade("Later that day...", 1, 3, 1);
fade("", 0, 2, 2);
Only affects the local computer.
Player controls are disabled while fading and while faded.
void flash(float lifetime, string colour)
Light up the world for a short time.
flash(1, "#FFFFFF");
Only affects the local computer.
colour is specfified in HTML style ("#RRGGBB" hex values), colours may also contain 2 additional optional characters for alpha (e.g. "#FFFFFF80" is transparent white).
Lifetime is in seconds.
bool getCinematicBarsEnabled()
Gets whether the cinematic bars are enabled.
if(getCinematicBarsEnabled())
{
print("Cinematic bars are enabled.");
}
else
{
print("Cinematic bars are disabled.");
}
void setCinematicBarsEnabled(bool enabled)
Sets whether the cinematic bars are enabled.
setCinematicBarsEnabled(true);
Only affects the local player.
Player controls are disabled while cinematic bars are enabled.
bool getMaxWildlifeDistance()
Get the maximum wildlife particle distance.
print(getMaxWildlifeDistance());
Wildlife particles further than this distance from the game window centre will be culled automatically.
void addWildlifeParticle(vector2 spawnPos, uint filenameHash)
Spawn a wildlife particle (e.g. insect or bird).
unsigned birdHash = createStringHashLowerCase("Wildlife_Bird01.ini");
vector2 playerPos = getPos(PLAYER_OBJECT);
for(int i=0; i<10; i++)
{
addWildlifeParticle(playerPos, birdHash);
}
The particle filename is required as a hash for better performance. Use createStringHashLowerCase() to generate a filename hash once before any loops.
int getWildlifeParticleInstanceCount(uint filenameHash)
Get the current particles instance count of a willife particle type.
unsigned birdHash = createStringHashLowerCase("Wildlife_Bird01.ini");
int birdsCount = getWildlifeParticleInstanceCount(birdHash);
print("Birds count: " + birdsCount);
void addPlantParticle(vector2 spawnPos, uint filenameHash)
Spawn a plant particle (e.g. grass or flower).
unsigned grassHash = createStringHashLowerCase("Plant_Grass01.ini");
vector2 playerPos = getPos(PLAYER_OBJECT);
for(int i=0; i<10; i++)
{
addPlantParticle(playerPos, grassHash);
}
The particle filename is required as a hash for better performance. Use createStringHashLowerCase() to generate a filename hash once before any loops.
int getPlantParticleInstanceCount(uint filenameHash)
Get the current particles instance count of a plant particle type.
unsigned grassHash = createStringHashLowerCase("Plant_Grass01.ini");
int grassHash = getPlantParticleInstanceCount(grassHash);
print("Grass count: " + birdsCount);
bool isAddFireFrame()
Determine if fire particles should be added this frame.
Fire particles can be added during any frame but this function provides a convenient way of timing them consistently.
void addFireParticle(vector2 pos, float maxSize, float height=0)
Add a fire particle.
void onUpdate(float deltaTime)
{
if(isAddFireFrame())
{
addFireParticle(getPos(PLAYER_OBJECT), 10);
}
}
bool isAddSmokeFrame()
Determine if smoke particles should be added this frame.
Smoke particles can be added during any frame but this function provides a convenient way of timing them consistently.
void addSmokeParticle(vector2 pos, float size, string smokeColour, float growRate=0.95, float decayRate=0.5)
Add a fire particle.
void onUpdate(float deltaTime)
{
if(isAddSmokeFrame())
{
addSmokeParticle(getPos(PLAYER_OBJECT), 10, "#A0A0A0");
}
}
smokeColour is specfified in HTML style ("#RRGGBB" hex values), colours may also contain 2 additional optional characters for alpha (e.g. "#FFFFFF80" is transparent white).
Index