Terrain Particle Handler
|
This article or section is a stub. You can help by adding to it. |
Terrain particles are material-based sprites distributed around the player. Fixed-axis sprites follow the surface orientation and point sprites face the player; the range setup controls fading and wrapping, while force and wind setup controls movement.
Contents
Before you start
- Open the map script inside your own mod. Keep its generated includes,
cScrMap : iScrMapclass and callback structure. See Add your first script if you have not edited a map script yet. - Add the helper include shown below alongside the script’s other includes.
- Read the stock example before copying its calls: named entities, voice subjects, materials and callbacks must belong to the map or resources you are using.
Use the helper
#include "helpers/helper_modules.hps"
TerrainParticles_SetupRange
Sets up the maximum and minimum distance that the particles are visible Particles also wrap around the maximum distance, coming out on the other side if they get to far away This should be called before spawning particles to get the best spread
| Parameter | Meaning |
|---|---|
afRangeMinStart |
particles closer than this value will not be visible |
afRangeMinEnd |
particles between min start and min end will fade to fully visible |
afRangeMaxStart |
particles further away then this value will start to fade out |
afRangeMaxEnd |
particles further away then this will not be visible and will be spawned on the other side of the player |
TerrainParticles_SetupParticles
Spawn particles that use the specified material There are two kind of particles. FixedAxis sprites follow the rotation of the surface. PointSprite always look at the player.
| Parameter | Meaning |
|---|---|
asMaterial |
the mat file used by the particles |
alFixedAxisCount |
the number of FixedAxis particles to spawn |
afFixedAxisSizeMin |
smallest size of a FixedAxis particle |
afFixedAxisSizeMax |
largest size of a FixedAxis particle |
avFixedColorMin |
random color bound of the FixedAxis particle |
avFixedColorMax |
random color bound of the FixedAxis particle |
alPointSpriteCount |
the number of PointSprite particles to spawn |
afPointSpriteSizeMin |
smallest size of a PointSprite particle |
afPointSpriteSizeMax |
largest size of a PointSprite particle |
avPointColorMin |
random color bound of the PointSprite particle |
avPointColorMax |
random color bound of the PointSprite particle |
TerrainParticles_SetupForces
Setup forces that affect the particles
| Parameter | Meaning |
|---|---|
avVelocityLimit |
limit to velocity of the particles |
afGravityAmount |
how much gravity should affect the particles, value between 0.0-1.0 |
afRandomDirectionForce |
the amount of random force that should be appled to the particles, the direction of this force is based on position and changes over time |
afRandomDirectionFrequency |
how fast the direction of the random force changes |
Check your change
Save the script and restart the map in development mode with F5. If the script fails, open F1 and use Show Error List or Show HPL Log. See the development loop for the launch and debugging steps.
Still to expand
The helper and module implementations define setup and motion, but a shipped campaign caller was not found. A complete map setup and visual verification are still needed.