For a particle to be spawned you need to define a particle source (https://community.bistudio.com/wiki/ParticleTemplates) which you can do using this:
Heat = "#particlesource" createVehicleLocal getpos player;
So with this, you can put it amongst the rest of the code for the heat effect into a .sqf file which I named "HeatEffect.sqf":
Heat = "#particlesource" createVehicleLocal getpos player;
Heat setParticleCircle [0, [0, 0, 0]];
Heat setParticleRandom [0, [0.25, 0.25, 0], [0.175, 0.175, 0], 0, 0.25, [0, 0, 0, 0.1], 0, 0];
Heat setParticleParams [["\A3\data_f\ParticleEffects\Universal\Refract", 1, 0, 1], "", "Billboard", 1, 12.5, [0, 0, 0], [0, 0, 0.75], 0, 10.3, 7.8, 0.075, [1.2, 2, 4], [[0.1, 0.1, 0.1, 1], [0.25, 0.25, 0.25, 0.5], [0.5, 0.5, 0.5, 0]], [0.08], 1, 0, "", "", XXXOBJECTXXX];
Heat setDropInterval 0.05;
interval = 0.05;
CircleRadius = 0;
CircleVelocity[] = {0,0,0};
particleShape ="\A3\data_f\ParticleEffects\Universal\Refract";
particleFSNtieth =1;
particleFSIndex =0;
particleFSFrameCount =1;
particleFSLoop =0;
angle =0;
angleVar =0;
animationName = "";
particleType = "Billboard";
timerPeriod = 1 ;
lifeTime = 12.5;
moveVelocity[] = {0, 0, 0.75};
rotationVelocity = 0;
weight = 10.3;
volume = 7.8;
rubbing = 0.075;
size[] = {1,1};
animationSpeed[] = {1};
lifeTimeVar = 0;
positionVar[] = {0.25, 0.25, 0};
positionVarConst[] = {0, 0, 0};
moveVelocityVar[] = {0.175, 0.175, 0};
moveVelocityVarConst[] = {0, 0, 0};
rotationVelocityVar = 0;
sizeVar = 0.25;
colorVar[] = {0, 0, 0, 0};
randomDirectionPeriodVar = 0;
randomDirectionIntensityVar = 0;
sizeCoef = 1;
colorCoef[]={0,0,0,0.1};
animationSpeedCoef = 1;
destroyOnWaterSurface = 0;
destroyOnWaterSurfaceOffset = 0;
onSurface = true;
keepOnSurface = false;
surfaceOffset = 0;
bounceOnSurface = 0.6;
bounceOnSurfaceVar = 0.0;
postEffects = "";
particleEffects = "";
Next you can use this script (imaginatively named "Cloak.sqf"), which you can call from an AddAction, to deal with the cloaking and to spawn the heat effect on the player. I also added in a timer.
_Unit = _this select 0;
timer = 60;
_nil = [] execVM "HeatEffect.sqf";
_Unit hideObject true;
SystemChat "Cloak Active";
_Unit setCaptive true;
[timer] spawn
{
while {!(timer == -1)} do
{
Heat setpos (getpos _Unit);
sleep 0.1;
};
};
while {!(timer == -1)} do
{
SystemChat format ["%1 seconds left",timer];
timer = timer -1;
sleep 1;
};
_Unit hideObject false;
deleteVehicle Heat;
SystemChat "Cloak Deactivated";
_Unit setCaptive false;
I then added an AddAction into the player's init field such that I could call the Cloaking script.
this addaction ["Cloak", "Cloak.sqf", [], 6, false, true];
There's probably room for improvement with my code and excuse any errors because I'm new to scripting :p.
Here's a video of it in action:
Excuse the poor quality, had to compress the video or I would never have been able to upload it with my poor internet speed.