<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.frictionalgames.com/page?action=history&amp;feed=atom&amp;title=HPL3%2FSOMA%2FScripting%2FTerrain_Particle_Handler</id>
	<title>HPL3/SOMA/Scripting/Terrain Particle Handler - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.frictionalgames.com/page?action=history&amp;feed=atom&amp;title=HPL3%2FSOMA%2FScripting%2FTerrain_Particle_Handler"/>
	<link rel="alternate" type="text/html" href="https://wiki.frictionalgames.com/page?title=HPL3/SOMA/Scripting/Terrain_Particle_Handler&amp;action=history"/>
	<updated>2026-10-04T04:28:11Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.34.2</generator>
	<entry>
		<id>https://wiki.frictionalgames.com/page?title=HPL3/SOMA/Scripting/Terrain_Particle_Handler&amp;diff=7226&amp;oldid=prev</id>
		<title>TiMan: Add a sourced SOMA guide with explanations and stock-script examples.</title>
		<link rel="alternate" type="text/html" href="https://wiki.frictionalgames.com/page?title=HPL3/SOMA/Scripting/Terrain_Particle_Handler&amp;diff=7226&amp;oldid=prev"/>
		<updated>2026-10-02T12:11:57Z</updated>

		<summary type="html">&lt;p&gt;Add a sourced SOMA guide with explanations and stock-script examples.&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;{{shortPageTitle}}&lt;br /&gt;
{{stub}}&lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
== Before you start ==&lt;br /&gt;
# Open the map script inside your own mod. Keep its generated includes, &amp;lt;code&amp;gt;cScrMap : iScrMap&amp;lt;/code&amp;gt; class and callback structure. See [[HPL3/SOMA/Getting Started/Add Your First Script|Add your first script]] if you have not edited a map script yet.&lt;br /&gt;
# Add the helper include shown below alongside the script’s other includes.&lt;br /&gt;
# 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.&lt;br /&gt;
&lt;br /&gt;
== Use the helper ==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
#include &amp;quot;helpers/helper_modules.hps&amp;quot;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== TerrainParticles_SetupRange ===&lt;br /&gt;
Sets up the maximum and minimum distance that the particles are visible&lt;br /&gt;
Particles also wrap around the maximum distance, coming out on the other side if they get to far away&lt;br /&gt;
This should be called before spawning particles to get the best spread&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Meaning&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;afRangeMinStart&amp;lt;/code&amp;gt; || particles closer than this value will not be visible&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;afRangeMinEnd&amp;lt;/code&amp;gt; || particles between min start and min end will fade to fully visible&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;afRangeMaxStart&amp;lt;/code&amp;gt; || particles further away then this value will start to fade out&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;afRangeMaxEnd&amp;lt;/code&amp;gt; || particles further away then this will not be visible and will be spawned on the other side of the player&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== TerrainParticles_SetupParticles ===&lt;br /&gt;
Spawn particles that use the specified material&lt;br /&gt;
There are two kind of particles. FixedAxis sprites follow the rotation of the surface. PointSprite always look at the player.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Meaning&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;asMaterial&amp;lt;/code&amp;gt; || the mat file used by the particles&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;alFixedAxisCount&amp;lt;/code&amp;gt; || the number of FixedAxis particles to spawn&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;afFixedAxisSizeMin&amp;lt;/code&amp;gt; || smallest size of a FixedAxis particle&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;afFixedAxisSizeMax&amp;lt;/code&amp;gt; || largest size of a FixedAxis particle&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;avFixedColorMin&amp;lt;/code&amp;gt; || random color bound of the FixedAxis particle&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;avFixedColorMax&amp;lt;/code&amp;gt; || random color bound of the FixedAxis particle&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;alPointSpriteCount&amp;lt;/code&amp;gt; || the number of PointSprite particles to spawn&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;afPointSpriteSizeMin&amp;lt;/code&amp;gt; || smallest size of a PointSprite particle&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;afPointSpriteSizeMax&amp;lt;/code&amp;gt; || largest size of a PointSprite particle&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;avPointColorMin&amp;lt;/code&amp;gt; || random color bound of the PointSprite particle&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;avPointColorMax&amp;lt;/code&amp;gt; || random color bound of the PointSprite particle&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== TerrainParticles_SetupForces ===&lt;br /&gt;
Setup forces that affect the particles&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Parameter !! Meaning&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;avVelocityLimit&amp;lt;/code&amp;gt; || limit to velocity of the particles&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;afGravityAmount&amp;lt;/code&amp;gt; || how much gravity should affect the particles, value between 0.0-1.0&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;afRandomDirectionForce&amp;lt;/code&amp;gt; || 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&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;afRandomDirectionFrequency&amp;lt;/code&amp;gt; || how fast the direction of the random force changes&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Check your change ==&lt;br /&gt;
Save the script and restart the map in development mode with &amp;lt;code&amp;gt;F5&amp;lt;/code&amp;gt;. If the script fails, open &amp;lt;code&amp;gt;F1&amp;lt;/code&amp;gt; and use '''Show Error List''' or '''Show HPL Log'''. See [[HPL3/SOMA/Getting Started/Test Debug and Continue|the development loop]] for the launch and debugging steps.&lt;br /&gt;
&lt;br /&gt;
== Still to expand ==&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
* [[HPL3/Scripting/User Modules Overview|User modules]]&lt;br /&gt;
* [[HPL3/SOMA/Scripting/Modules Helper|SOMA module helpers]]&lt;br /&gt;
&lt;br /&gt;
[[Category:English]]&lt;/div&gt;</summary>
		<author><name>TiMan</name></author>
		
	</entry>
</feed>