Jump to content

Recommended Posts

Hey everyone I stumbled upon a smoke script for planes. I've made some adjustments to it and was wondering if there was a way to make the smoke purely white? I'm no expert when it comes to ASL I've really only been an HTML and CSS type of guy so any help would be appreciated! Is there also a way to make the action assigned to a specific custom user action?

this addAction [ "Release Smoke Trails", { 
  params [ 
   "_target", 
   "_caller", 
   "_id" 
  ]; 
   
  _smokeOn = _target getVariable [ "smokeTrailsOn", false ]; 
   
  switch ( _smokeOn ) do { 
   case true : { 
    _target setUserActionText [ _id, "Release Smoke Trails" ]; 
    { 
     deleteVehicle _x; 
    }forEach ( _target getVariable [ "emitters", [] ] ); 
   }; 
   case false : { 
    _target setUserActionText [ _id, "Stop Smoke Trails" ]; 
    _emitters = []; 
    { 
     _x params[ "_color", "_pos" ]; 
     _color params[ "_colorRed", "_colorGreen", "_colorBlue" ]; 
      
     _emitter = "#particlesource" createVehicle ( _target modelToWorld _pos ); 
     _emitter attachTo [ _target, _pos ]; 
      
     _colorAlpha = 0.5; 
     _timeout = 0; 
     _particleLifeTime = 8; 
     _particleDensity = 100; 
     _particleSize = 1; 
     _particleSpeed = 1; 
     _particleLifting = 1; 
     _windEffect = 1; 
     _effectSize = 2; 
     _expansion = 4; 
      
     _emitter setParticleParams [ 
      ["\A3\data_f\ParticleEffects\Universal\Universal_02",8,0,40,1],"","billboard",1,_particleLifeTime,[0,0,0],[0,0,2*_particleSpeed],0,0.05,0.04*_particleLifting,0.05*_windEffect,[1 *_particleSize + 1,1.8 * _particleSize + 15], 
     [[0.7*_colorRed,0.7*_colorGreen,0.7*_colorBlue,0.7*_colorAlpha],[0.7*_colorRed,0.7*_colorGreen,0.7*_colorBlue,0.6*_colorAlpha],[0.7*_colorRed,0.7*_colorGreen,0.7*_colorBlue,0.45*_colorAlpha], 
     [0.84*_colorRed,0.84*_colorGreen,0.84*_colorBlue,0.28*_colorAlpha],[0.84*_colorRed,0.84*_colorGreen,0.84*_colorBlue,0.16*_colorAlpha],[0.84*_colorRed,0.84*_colorGreen,0.84*_colorBlue,0.09*_colorAlpha], 
     [0.84*_colorRed,0.84*_colorGreen,0.84*_colorBlue,0.06*_colorAlpha],[1*_colorRed,1*_colorGreen,1*_colorBlue,0.02*_colorAlpha],[1*_colorRed,1*_colorGreen,1*_colorBlue,0*_colorAlpha]], 
     [1,0.55,0.35], 0.1, 0.08*_expansion, "", "", ""]; 
      
     _emitter setParticleRandom [_particleLifeTime/2, [0.5*_effectSize,0.5*_effectSize,0.2*_effectSize], [0.3,0.3,0.5], 1, 0, [0,0,0,0.06], 0, 0]; 
     _emitter setDropInterval (1/_particleDensity); 
      
     _nul = _emitters pushBack _emitter; 
    }forEach [ 
     [ [ 0, 0, 0 ], [0, -8, 0] ], 
     [ [ 0, 0, 0 ], [0, -8, 0] ], 
     [ [ 0, 0, 0 ], [0, -8, 0] ], 
     [ [ 0, 0, 0 ], [0, -8, 0] ] 
    ]; 
    _target setVariable [ "emitters", _emitters ]; 
   }; 
  }; 
   
  _target setVariable [ "smokeTrailsOn", !_smokeOn ]; 
 }, 
 [], 
 1, 
 false, 
 true, 
 "", 
 "_this in crew _target" 
];

 

Share this post


Link to post
Share on other sites
3 hours ago, planelover390 said:

}forEach [ 
  [ [ 0, 0, 0 ], [0, -8, 0] ], 
  [ [ 0, 0, 0 ], [0, -8, 0] ], 
  [ [ 0, 0, 0 ], [0, -8, 0] ], 
  [ [ 0, 0, 0 ], [0, -8, 0] ] 
]; 

 

Should be

}forEach [ 
//    R, G, B //Red, Green, Blue 0-1range color of particle
//    |  |  |     X,  Y, Z //xyz added to _targets position
  [ [ 1, 1, 1 ], [0, -8, 0] ], //particle emitter 1
  [ [ 1, 1, 1 ], [0, -8, 0] ], //particle emitter 2
  [ [ 1, 1, 1 ], [0, -8, 0] ], //particle emitter 3
  [ [ 1, 1, 1 ], [0, -8, 0] ]  //particle emitter 4
]; 

Change this line to effect all particles alphas, again 0-1range.

_colorAlpha = 0.5;

 

and

[[0.7*_colorRed,0.7*_colorGreen,0.7*_colorBlue,0.7*_colorAlpha],[0.7*_colorRed,0.7*_colorGreen,0.7*_colorBlue,0.6*_colorAlpha],[0.7*_colorRed,0.7*_colorGreen,0.7*_colorBlue,0.45*_colorAlpha], 
[0.84*_colorRed,0.84*_colorGreen,0.84*_colorBlue,0.28*_colorAlpha],[0.84*_colorRed,0.84*_colorGreen,0.84*_colorBlue,0.16*_colorAlpha],[0.84*_colorRed,0.84*_colorGreen,0.84*_colorBlue,0.09*_colorAlpha], 
[0.84*_colorRed,0.84*_colorGreen,0.84*_colorBlue,0.06*_colorAlpha],[1*_colorRed,1*_colorGreen,1*_colorBlue,0.02*_colorAlpha],[1*_colorRed,1*_colorGreen,1*_colorBlue,0*_colorAlpha]],

should be something like

[[_colorRed,_colorGreen,_colorBlue,_colorAlpha],[_colorRed,_colorGreen,_colorBlue,_colorAlpha]],

Think thats right, not on main pc atm.

See here for details and here.

  • Like 3

Share this post


Link to post
Share on other sites
4 hours ago, Larrow said:

Should be


}forEach [ 
//    R, G, B //Red, Green, Blue 0-1range color of particle
//    |  |  |     X,  Y, Z //xyz added to _targets position
  [ [ 1, 1, 1 ], [0, -8, 0] ], //particle emitter 1
  [ [ 1, 1, 1 ], [0, -8, 0] ], //particle emitter 2
  [ [ 1, 1, 1 ], [0, -8, 0] ], //particle emitter 3
  [ [ 1, 1, 1 ], [0, -8, 0] ]  //particle emitter 4
]; 

Change this line to effect all particles alphas, again 0-1range.


_colorAlpha = 0.5;

 

and


[[0.7*_colorRed,0.7*_colorGreen,0.7*_colorBlue,0.7*_colorAlpha],[0.7*_colorRed,0.7*_colorGreen,0.7*_colorBlue,0.6*_colorAlpha],[0.7*_colorRed,0.7*_colorGreen,0.7*_colorBlue,0.45*_colorAlpha], 
[0.84*_colorRed,0.84*_colorGreen,0.84*_colorBlue,0.28*_colorAlpha],[0.84*_colorRed,0.84*_colorGreen,0.84*_colorBlue,0.16*_colorAlpha],[0.84*_colorRed,0.84*_colorGreen,0.84*_colorBlue,0.09*_colorAlpha], 
[0.84*_colorRed,0.84*_colorGreen,0.84*_colorBlue,0.06*_colorAlpha],[1*_colorRed,1*_colorGreen,1*_colorBlue,0.02*_colorAlpha],[1*_colorRed,1*_colorGreen,1*_colorBlue,0*_colorAlpha]],

should be something like


[[_colorRed,_colorGreen,_colorBlue,_colorAlpha],[_colorRed,_colorGreen,_colorBlue,_colorAlpha]],

Think thats right, not on main pc atm.

See here for details and here.
So I've edited to code how I believe you were telling me to.
 


This addAction [ "Aerobatic Smoke On", {
		params [
			"_target",
			"_caller",
			"_id"
		];
		
		_smokeOn = _target getVariable [ "smokeTrailsOn", false ];
		
		switch ( _smokeOn ) do {
			case true : {
				_target setUserActionText [ _id, "Aerobatic Smoke On" ];
				{
					deleteVehicle _x;
				}forEach ( _target getVariable [ "emitters", [] ] );
			};
			case false : {
				_target setUserActionText [ _id, "Aerobatic Smoke Off" ];
				_emitters = [];
				{
					_x params[ "_color", "_pos" ];
					_color params[ "_colorRed", "_colorGreen", "_colorBlue" ];
					
					_emitter = "#particlesource" createVehicle ( _target modelToWorld _pos );
					_emitter attachTo [ _target, _pos ];
					
					_colorAlpha = 1;
					_timeout = 0;
					_particleLifeTime = 8;
					_particleDensity = 100;
					_particleSize = 1;
					_particleSpeed = 1;
					_particleLifting = 1;
					_windEffect = 1;
					_effectSize = 2;
					_expansion = 4;
					
					_emitter setParticleParams [
						["\A3\data_f\ParticleEffects\Universal\Universal_02",8,0,40,1],"","billboard",1,_particleLifeTime,[0,0,0],[0,0,2*_particleSpeed],0,0.05,0.04*_particleLifting,0.05*_windEffect,[1 *_particleSize + 1,1.8 * _particleSize + 15],
					[[_colorRed,_colorGreen,_colorBlue,_colorAlpha],[_colorRed,_colorGreen,_colorBlue,_colorAlpha]],
					[1,1,1], 0.1, 0.08*_expansion, "", "", ""];
					
					_emitter setParticleRandom [_particleLifeTime/2, [0.5*_effectSize,0.5*_effectSize,0.2*_effectSize], [1,1,1], 1, 0, [0,0,0,0.06], 0, 0];
					_emitter setDropInterval (1/_particleDensity);
					
					_nul = _emitters pushBack _emitter;
				}forEach [
					[ [ 1, 1, 1 ], [0, -8, 0] ],
					[ [ 1, 1, 1 ], [0, -8, 0] ],
					[ [ 1, 1, 1 ], [0, -8, 0] ],
					[ [ 1, 1, 1 ], [0, -8, 0] ]
				];
				_target setVariable [ "emitters", _emitters ];
			};
		};
		
		_target setVariable [ "smokeTrailsOn", !_smokeOn ];
	},
	[],
	1,
	false,
	true,
	"",
	"_this in crew _target"
];

And I'm getting a grey color now which is closer to the white I'm looking for, but not quite there 
20191024213721_1_zpsbb139arj.jpg

 

Share this post


Link to post
Share on other sites
This addAction [ "Aerobatic Smoke On", {
		params [
			"_target",
			"_caller",
			"_id"
		];
		
		_smokeOn = _target getVariable [ "smokeTrailsOn", false ];
		
		switch ( _smokeOn ) do {
			case true : {
				_target setUserActionText [ _id, "Aerobatic Smoke On" ];
				{
					deleteVehicle _x;
				}forEach ( _target getVariable [ "emitters", [] ] );
			};
			case false : {
				_target setUserActionText [ _id, "Aerobatic Smoke Off" ];
				_emitters = [];
				{

I've also found that putting inputaction "User20"; won't activate it until I press whatever keybind is assigned to user action 20, however I'd like a way to be able to make it to where I can press the key and it'll switch between turning on and off... if that makes sense?

Share this post


Link to post
Share on other sites
10 hours ago, planelover390 said:

And I'm getting a grey color now which is closer to the white I'm looking for, but not quite there 

That is the base color of the image used. Swap..

 

10 hours ago, planelover390 said:

["\A3\data_f\ParticleEffects\Universal\Universal_02",8,0,40,1]

for

["\A3\data_f\ParticleEffects\Universal\Universal",16,12,8,1]

This I believe is the part of the image used for the smoke grenade  effects.

 

This is the image used for Universal...

600px-a3_universal_ca.jpg

Where the numbers 16, 12 ,8 ,1 mean...

16 - Image atlas size is 16 images square( 16 images across by 16 images down )

12 - The row to start on, first row is 0

8 - How many images to use to animate, so the first 8 images of row 12

1 - Means Loop animation

 

Then you may need to play with the variables _particleDensity, _particleSize etc to get it looking as you wish.

Using the pages I linked before you may want to add some rotation velocity etc

 

9 hours ago, planelover390 said:

I've also found that putting inputaction "User20"; won't activate it until I press whatever keybind is assigned to user action 20, however I'd like a way to be able to make it to where I can press the key and it'll switch between turning on and off

In this case User20 should turn it on and off. Is this not what your seeing?

  • Like 6

Share this post


Link to post
Share on other sites
2 hours ago, Larrow said:

In this case User20 should turn it on and off. Is this not what your seeing?

I am not seeing it like that. perhaps I'm putting it in the wrong spot of the script?
 

This addAction [ "Aerobatic Smoke On", {
		params [
			"_target",
			"_caller",
			"_id"
		];
		
		_smokeOn = _target getVariable [ "smokeTrailsOn", false ];
		
		switch ( _smokeOn ) do {
            inputaction "user20";
			case true : {
				_target setUserActionText [ _id, "Aerobatic Smoke On" ];
				{

and what I've found by that is I still have to scroll through the action menu and select aerobatic smoke on... and then press my keybind for user action 20 for it to activate. However I can't just press it again to turn it off. I have to scroll through the action menu again to turn it off. Basically I'm looking for a way to activate it without having to go through the action menu and again to turn it off without going through the action menu. However I'd also like to have the option in the action menu as well. As for the smoke it's finally white after I've made the adjustments you've told me to. So thank you for that!

Share this post


Link to post
Share on other sites
	},
	[],
	1,
	false,
	true,
	"User20",
	"_this in crew _target"
];

In the shortcut parameter of the addAction.

  • Like 1
  • Thanks 1

Share this post


Link to post
Share on other sites

That works perfectly thank you so much. Sorry for all the questions like I said I'm really new to all this ASL stuff... I'm more of a texture artist than anything given I am also a certified web developer.
My final code comes out as such

This addAction [ "Aerobatic Smoke On", {
		params [
			"_target",
			"_caller",
			"_id"
		];
		
		_smokeOn = _target getVariable [ "smokeTrailsOn", false ];
		
		switch ( _smokeOn ) do {
			case true : {
				_target setUserActionText [ _id, "Aerobatic Smoke On" ];
				{
					deleteVehicle _x;
				}forEach ( _target getVariable [ "emitters", [] ] );
			};
			case false : {
				_target setUserActionText [ _id, "Aerobatic Smoke Off" ];
				_emitters = [];
				{
					_x params[ "_color", "_pos" ];
					_color params[ "_colorRed", "_colorGreen", "_colorBlue" ];
					
					_emitter = "#particlesource" createVehicle ( _target modelToWorld _pos );
					_emitter attachTo [ _target, _pos ];
					
					_colorAlpha = 1;
					_timeout = 0;
					_particleLifeTime = 10;
					_particleDensity = 40;
					_particleSize = 1;
					_particleSpeed = 1;
					_particleLifting = 1;
					_windEffect = 1;
					_effectSize = 1;
					_expansion = 3;
					
					_emitter setParticleParams [
						["\A3\data_f\ParticleEffects\Universal\Universal",16,12,8,1],"","billboard",1,_particleLifeTime,[0,0,0],[0,0,2*_particleSpeed],0,0.05,0.04*_particleLifting,0.05*_windEffect,[1 *_particleSize + 1,1.8 * _particleSize + 15],
					[[_colorRed,_colorGreen,_colorBlue,_colorAlpha],[_colorRed,_colorGreen,_colorBlue,_colorAlpha]],
					[1,1,1], 0.1, 0.08*_expansion, "", "", ""];
					
					_emitter setParticleRandom [_particleLifeTime/2, [0.5*_effectSize,0.5*_effectSize,0.2*_effectSize], [1,1,1], 1, 0, [0,0,0,0.06], 0, 0];
					_emitter setDropInterval (1/_particleDensity);
					
					_nul = _emitters pushBack _emitter;
				}forEach [
					[ [ 1, 1, 1 ], [0, -8, 0] ],
					[ [ 1, 1, 1 ], [0, -8, 0] ],
					[ [ 1, 1, 1 ], [0, -8, 0] ],
					[ [ 1, 1, 1 ], [0, -8, 0] ]
				];
				_target setVariable [ "emitters", _emitters ];
			};
		};
		
		_target setVariable [ "smokeTrailsOn", !_smokeOn ];
	},
	[],
	1,
	false,
	true,
	"User20",
	"_this in crew _target"
];

20191025123110_1_zpsndp9vohz.jpg20191025122919_1_zpszk5lrasx.jpg

  • Like 5

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

×