Infection Handler
The Infection Handler draws growing infection trees at screen borders. Border indices select top, bottom, left or right, and ClearTrees removes the generated trees.
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.
Follow the stock example
#include "helpers/helper_modules.hps"
Infection_CreateBorderTree
Creates an infection tree at a border of the screen
| Parameter | Meaning |
|---|---|
alBorder |
The border of the screen where it randomly appears 0=top, 1= bottom, 2=left, 3=right |
afOffset |
How much outside of the screen the tree start is offset |
avSize |
The size of the start tree segment. |
afSpeed |
The speed at which the tree grows. |
In maps/02_06_theta_tunnels_old/02_06_theta_tunnels.hps, SOMA calls Infection_CreateBorderTree as follows.
Infection_CreateBorderTree(1, 30, cVector2f(14,35), 3.0f);
| Parameter | Value in this stock call |
|---|---|
alBorder |
1
|
afOffset |
30
|
avSize |
cVector2f(14,35)
|
afSpeed |
3.0f
|
This is an excerpt from that stock script; its referenced names and variables belong to that script.
Infection_ClearTrees
Clears all created trees.
In script/modules/PlayerEnergyHandler.hps, SOMA calls Infection_ClearTrees as follows.
Infection_ClearTrees();
This is an excerpt from that stock script; its referenced names and variables belong to that script.
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.