Jump to content
Sign in to follow this  
Jantemplar

Slight Sand blowing effect Script v1.2

Recommended Posts

Trying to create some effects for my missions,

i decided to investigate into creating a Dust Effect, that would give of a generic rolling dust across the desert, as such here it is.

Usage:

Place the following code in a text document called

 rollingsand.sqf

_obj = _this select 0;
_radius = _this select 1;
_pos = position _obj;

//--- Sand blowing
_velocity = [1.0,1.0,0.0];
_color = [1.0, 0.9, 0.8];
_alpha = 0.02 + random 0.02;
_ps = "#particlesource" createVehicleLocal _pos;  
_ps setParticleParams [["\Ca\Data\ParticleEffects\Universal\universal.p3d", 16, 12, 48], "", "Billboard", 5, 3, [0, 0, -6], _velocity, 1, 1.275, 0.9, 15, [9], [_color + [0], _color + [_alpha], _color + [0]], [0.01], 1, 0, "", "", _obj];
_ps setParticleRandom [3, [30, 30, 0], [0, 0, 0], 1, 0, [0, 0, 0, 0.01], 0, 0];
_ps setParticleCircle [_radius, [0, 0, 0]];
_ps setDropInterval 0.001;

Place the following code in your init or in the initialization box in a unit.

nul = [unitname,radiusofeffect] execVM rollingsand.sqf

Attached is a demo mission, the effect is best seen at night.

Dusttest.takistan

The above code is a modification of BIS particle dust effect from mission CE3.

Further Applications, I am looking at furthering this code to create the dust effect seen here

and also to the point of dust storms.

Any contributions are welcome, but please remember to credit anyone's work you may base yours off, it is polite.

Anyway, have fun.

Jan Templar

Version 1.2:

_obj = _this select 0;
_radius = _this select 1;
_pos = position _obj;

//--- Dust
_velocity = [1.0,1.0,0.0];
_ps = "#particlesource" createVehicleLocal _pos;  
_ps setParticleParams [["\Ca\Data\ParticleEffects\Universal\universal.p3d", 16, 12, 48], "", "Billboard", 5, 3, [0, 0, -6], _velocity, 1, 1.275, 0.9, 15, [9], [[0.9, 0.9, 0.9 ,0.0], [224/255, 208/255, 127/255, 0.1], [0.8, 0.8, 0.8, 0.0]], [0.01], 1, 0, "", "", _obj];
_ps setParticleRandom [3, [30, 30, 0], [0, 0, 0], 1, 0, [0, 0, 0, 0.01], 0, 0];
_ps setParticleCircle [_radius, [0, 0, 0]];
_ps setDropInterval 0.001;

Same method as before, i have changed the color of the dust to make it more prominent.

Edited by Jantemplar

Share this post


Link to post
Share on other sites

Cool... i like to use Nimms dynamic weather effects sand wind together with namalsk default colour module, ... has some adverse affect at times but definitely adds atmosphere in maps like afhgan village etc

Share this post


Link to post
Share on other sites

thanks

it's for a small aera will try to find out how to make it bigger

Share this post


Link to post
Share on other sites
nul = [unitname,radiusofeffect] execVM rollingsand.sqf

The second variable is for radius,

Unless you mean the inner fill, that i have not yet figured out, so any help would be appreciated.

Share this post


Link to post
Share on other sites

i think OA has a new module that gives slight sand affects, you will find it in module, environment effects. or it might just be in the game it self

Share this post


Link to post
Share on other sites

What is the difference between this one and the existing OA module rolling dust effects? Sounds exactlly like the BIS made module. :)

Share this post


Link to post
Share on other sites

The only difference between the two, this one is more prominent, and can be seen easier, plus at the time, i still had not figured out how to activate the Sand in the environment module. Also this one allows for specific placement, i don't know if the BIS one does or not, so i cant comment there. But i am working on the Further Sand blowing effect for helicopters landing. Which may be pretty simple, the more i look at it.

Share this post


Link to post
Share on other sites
it would be great if you can get the dust the way it was shown in the youtube video : )

Ill be working on that primarily today, and will post a WIP later to give some results,

My current method is, im hoping i can find the effects produced when the helicopters land, i will most likely increase the color and amount of particles being produced, if not the size.

So ill get back to you guys later in the day on that.

Edited by Jantemplar

Share this post


Link to post
Share on other sites

WIP:

I have found the required particle emitting effects for helicopters on landing, but at this current stage am having trouble overriding them to allow for the chopper to actually use them instead of the BIS originals.

The current script is below,

class CfgPatches
{
class Jans_ParticleEffects
{
 units[] = {};
 weapons[] = {};
 requiredVersion = 1.02;
 requiredAddons[] = {"CA","CA_E","CAData_ParticleEffects"};
};
};
class CfgMods
{
class Jansparticles
{
 dir = "janp";
 name = "Jan Templar's Particle Effect Mod";
 picture = "ca\ui\data\logo_arma2ep1_ca.paa";
 hidePicture = "true";
 hideName = "true";
 action = "http://www.Jantemplar.com.au/";
};
};
class CfgCloudlets
{
class Default
{
 interval = "0.5 * interval + 0.5";
 circleRadius = 0;
 circleVelocity[] = {0,0,0};
 particleShape = "\ca\cl_basic.p3d";
 particleFSNtieth = 1;
 particleFSIndex = 0;
 particleFSFrameCount = 1;
 particleFSLoop = 1;
 angle = 0;
 angleVar = 0;
 animationName = "";
 particleType = "Billboard";
 timerPeriod = 1;
 lifeTime = 1;
 moveVelocity[] = {0,0,0};
 rotationVelocity = 0;
 weight = 1;
 volume = 1;
 rubbing = 0.05;
 size[] = {1,1};
 color[] = {
  { 1,1,1,1 }};
 animationSpeed[] = {1};
 randomDirectionPeriod = 0;
 randomDirectionIntensity = 0;
 onTimerScript = "";
 beforeDestroyScript = "";
 lifeTimeVar = 0;
 positionVar[] = {0,0,0};
 MoveVelocityVar[] = {0,0,0};
 rotationVelocityVar = 0;
 sizeVar = 0;
 colorVar[] = {0,0,0,0};
 randomDirectionPeriodVar = 0;
 randomDirectionIntensityVar = 0;
};

class HDust1: Default
{
 interval = "0.02 - 0.019 * density";
 circleRadius = 1.7;
 circleVelocity[] = {"speed*0.8",0,"speed*0.8"};
 particleShape = "\ca\Ca_E\data\ParticleEffects\Universal\Universal";
 particleFSNtieth = 16;
 particleFSIndex = 12;
 particleFSFrameCount = 13;
 particleFSLoop = 0;
 angleVar = 0;
 animationName = "";
 particleType = "Billboard";
 timerPeriod = 1;
 lifeTime = 1.1;
 moveVelocity[] = {0,0,0};
 rotationVelocity = 1;
 weight = 1.2;
 volume = 1;
 rubbing = 0.1;
 size[] = {5,10,15,20,25};
 sizeCoef = 1;
 color[] = {
  { 1,0,0,0.0 },
  { 1,0,0,0.1 },
  { 1,0,0,0.05 },
  { 1,0,0,0.01 },
  { 1,0,0,0.005 },
  { 1,0,0,0.001 },
  { 1,0,0,0 }};
 colorCoef[] = {1,1,1,1};
 animationSpeed[] = {1000};
 animationSpeedCoef = 1;
 randomDirectionPeriod = 0.1;
 randomDirectionIntensity = 0.05;
 onTimerScript = "";
 beforeDestroyScript = "";
 lifeTimeVar = 0.4;
 position[] = {"positionX","positionY","positionZ"};
 positionVar[] = {0,0,0};
 MoveVelocityVar[] = {0.15,0.15,0.15};
 rotationVelocityVar = 30;
 sizeVar = 0.7;
 colorVar[] = {0,0,0,0};
 randomDirectionPeriodVar = 0;
 randomDirectionIntensityVar = 0;
};
class HDust1Long: Default
{
 interval = "0.25 - 0.17 * density";
 circleRadius = 4.7;
 circleVelocity[] = {"speed*0.2",0,"speed*0.2"};
 particleShape = "\ca\Ca_E\data\ParticleEffects\Universal\Universal";
 particleFSNtieth = 16;
 particleFSIndex = 12;
 particleFSFrameCount = 13;
 particleFSLoop = 0;
 angleVar = 0.1;
 animationName = "";
 particleType = "Billboard";
 timerPeriod = 1;
 lifeTime = 60;
 moveVelocity[] = {0,0,0};
 rotationVelocity = 1;
 weight = 1.28;
 volume = 1;
 rubbing = 0.1;
 size[] = {5,10,15,20,25,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30};
 sizeCoef = 1;
 color[] = {
  { 1,0,0,0.05 },
  { 1,0,0,0.04 },
  { 1,0,0,0.03 },
  { 1,0,0,0.025 },
  { 1,0,0,0.0125 },
  { 1,0,0,0.007 },
  { 1,0,0,0 }};
 colorCoef[] = {1,1,1,1};
 animationSpeed[] = {1000};
 animationSpeedCoef = 1;
 randomDirectionPeriod = 0.1;
 randomDirectionIntensity = 0.02;
 onTimerScript = "";
 beforeDestroyScript = "";
 lifeTimeVar = 30;
 position[] = {"positionX","positionY","positionZ"};
 positionVar[] = {0.1,0,0.1};
 MoveVelocityVar[] = {1.5,0.05,1.5};
 rotationVelocityVar = 30;
 sizeVar = 0.25;
 colorVar[] = {0,0,0,0};
 randomDirectionPeriodVar = 0;
 randomDirectionIntensityVar = 0;
};
};

class HeliDust
{
class HDust1
{
 simulation = "particles";
 type = "HDust1";
};
class HDust1Long
{
 simulation = "particles";
 type = "HDust1Long";
};
};

Yes i have configured it so the dust particles are RED, this is too allow me to see if there is any effect, at this current stage i can even get it to work, i am compiling it in,

config.cpp

and then PBO'ing it into

Jans_ParticleEffects

Then putting it in my mod folder to run, i have been through the checks, so i will have to investigate further as to why its not working.

Edited by Jantemplar

Share this post


Link to post
Share on other sites

As it's addon based, it's probably not something I'll use. I prefer scripted approach, with full control depending on what the mission "needs" in terms of immersion. Feel free to include or change whatever needed for whatever purposes you have, but this is what I'm currently (that is, not finished, and probably never will) using in a Takistan mission.

description.ext - sounds and identities:

Sounds are two created (cond) true triggers (named tWind1 and tWind2) with trigger based sound effect. The actual soundfile "fx_windy.wss" is a copy of ArmA 2\AddOns\sounds\sfx\wind_whistle.wss btw.

class CfgSounds {
//Dummy, in case it is needed.
class NoSound {name = "NoSound";sound[] = {"", 0, 1};titles[] = {};};
};

class CfgSFX
{
sounds[] = {};
class fx_windy1
{
	name = "fx_windy1";
	sounds[]={sound1};
	sound1[]={"soundfx\fx_windy.wss",1,1.03,50,1,0,0,0};
	empty[]= {"",0,0,0,0,0,0,0};
};
class fx_windy2
{
	name = "fx_windy2";
	sounds[]={sound1};
	sound1[]={"soundfx\fx_windy.wss",1,0.97,50,1,0,0,0};
	empty[]= {"",0,0,0,0,0,0,0};
};
};

class CfgIdentities {
class idOP2 {
	name = "Nolan Whaley";
	face = "Face20_EP1";
	glasses = "None";
	speaker = "Male03EN";
	pitch = 0.98;
};
class idOP2[b]G[/b] {
	name = "Nolan Whaley";
	face = "Face20_EP1";
	glasses = "[b]LHD_glasses[/b]";
	speaker = "Male03EN";
	pitch = 0.98;
};
};

Init.sqf:

uOP2 setIdentity "idOP2"; //Let this be the player, I'm just showing one as an example.
uOP2 setVariable ["identity", "idOP2"];
[] spawn {
waitUntil {player == player};
player addAction ["Glasses On","scripts\GlassesOn.sqf",[],-10,false,false,"","_this getVariable 'identity' == 'idOP2'"];
player addAction ["Glasses Off","scripts\GlassesOff.sqf",[],-10,false,false,"","_this getVariable 'identity' == 'idOP2G'"];
};

[] spawn {
waitUntil {player == player};
ppDustBlur = ppEffectCreate ["RadialBlur", 2005];
ppDustBlur ppEffectAdjust [0,0,0,0];
ppDustBlur ppEffectCommit 0.1;
ppDustBlur ppEffectEnable true;
};

nDust = 0;
aWind = [0,10,true];

0 setOvercast 0.87;
0 setFog 0.4;
[] spawn {
private ["_amount"];
waitUntil {player == player};
while {true} do {
	0 setRain 0;
	if (player getVariable "identity" != "idOP2G" && player == vehicle player) then {
		_dir = ((wind select 0) atan2 (wind select 1)) % 360 + 180;
		_dir = (abs(180-abs(_dir - getDir vehicle player)))/180;
		_amount = _dir * nDust;
//			hintSilent format ["%1",_dir];
	} else {
		_amount = 0;
	};
	ppDustBlur ppEffectAdjust[_amount, _amount, 0, 0];
	ppDustBlur ppEffectCommit 0;
	sleep 0.1;
};
};

[] spawn {
sleep 1.234;
while {true} do {
	nWind = getPosASL player select 2;
	nWind = (nWind - 100) max 0;
	nWind = (nWind / 250) min 1.75;
	setWind [((aWind select 0) * nWind) max (aWind select 0), ((aWind select 1) * nWind) max (aWind select 1), true];
	_pos = 2 max (50 - 0.10 * ((wind select 0)^2 + (wind select 1)^2));
	tWind1 attachTo [player, [5,5,_pos]];
	tWind2 attachTo [player, [-5,5,_pos]];
	sleep 3.456;
};
};

execVM "scripts\dust.sqf";

scripts\Dust.sqf:

_obj = vehicle player;
_pos = position _obj;

_velocity = [wind select 0,wind select 2,0];
_color = [1.0, 0.9, 0.8];

_wforce = sqrt ((wind select 0)^2+(wind select 1)^2);
_wforce = _wforce / 20;
_wforce = _wforce * (1 - sqrt(rain));
_range = 0.25 * _wforce;
_alpha = _range + random _range;
nDust = _alpha/50;

_ps = "#particlesource" createVehicleLocal _pos;  
_ps setParticleParams [["\Ca\Data\ParticleEffects\Universal\universal.p3d", 16, 12, 8], "", "Billboard", 1, 3, [0, 0, -6], _velocity, 1, 1.275, 1, 0, [9], [_color + [0], _color + [_alpha], _color + [0]], [1000], 1, 0, "", "", _obj];
_ps setParticleRandom [3, [30, 30, 0], [0, 0, 0], 1, 0, [0, 0, 0, 0.01], 0, 0];
_ps setParticleCircle [0.1, [0, 0, 0]];
_ps setDropInterval 0.01;

sleep 10;
deleteVehicle _ps;
sleep 0.1;

[] execVM "scripts\Dust.sqf";

scripts\GlassesOn.sqf:

player setIdentity "idOP2G";
player setVariable ["identity", "idOP2G"];

scripts\GlassesOf.sqf:

player setIdentity "idOP2";
player setVariable ["identity", "idOP2"];

* System does not deal with vehicle updating and vehicle position. Since I'm not using any vehicles in my mission I had no use to include that. Means that you might want to use i.e. vehicle player instead of player sometimes, or reattach sound emitters to vehicle if he is in one (maybe go as far as modulate height of emitter to speed of vehicle, and/or based on vehicle position (turned in/out, gunner, open/closed vehicle etc).

* System does not yet have a glasses resource overlay (like i.e. ACE gasmask, or the new onscreen blood effects in OA). Maybe I'll throw this in later

* Wind will vary with altitude, set wind for lowest altitude and wind will be about 1.75 times stronger at (a defined) maximum altitude. Sound of wind will increase with this wind force. Note that I need plenty of overcast in my mission, but without rain, so I have to constantly set rain off to override the engine.

* Dust amount will increase with wind, and if you look into the wind (and dust) without protective glasses, you'll get a blur effect applied (sort of like tunnel vision as you have to squint in order to avoid being "hurt" by the dust).

* Amount of dust is also modulated by rain. In heavy rain, dust will bind to droplets and not fly around as much, meaning almost no dust in heavy rain.

* The actual effect might need some tweaks, as I'm not confident in this area. The effect originally came from EW, have no idea what I have changed in it.

* Some variables could be _local to script instead of global (just easier to monitor [yeah, guess I'm a bit lazy :)] this way), others could be set to missionNameSpace/setVariable'd, or at least have a tag variable used.

* It does not attempt to simulate any brownout effect. Helicopters should be dealt with outside, but might affect the post processing if needed.

* It does not counter for any variations in surface type. I assume being on ocean would be dusty as well, not tested.

The bad part naturally is how one needs to setup identities in description.ext in order to have actually working glasses.

And, I would be very interested to know if anyone knows if it is possible for us to obtain information if we are "in shelter" or not. Like, if we are inside a building, in a car, or even under a tree - rain particles are not rendered. It would have been awesome to be able to use this as a modulator for this dust thingy - go inside and the wind sound quiets down and no discomfort from dust.

Use it for whatever purposes anyone need, no credits needed. This isn't "work", this is just "messing around" :) But for me, it sure added plenty of immersion to a singleplayer mission I'm working messing with :D

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×