Jump to content
redleouf

Smoke script not working without any error

Recommended Posts

Hi,

 

I am working on my first mod which is supposed to add a new support module for zeus that works like the mortar or howitzer one but drop a huge smoke for cover purpose.

 

My idea was to pop a first particle effect above the module placed (40 or 20 meters above) to simulate the shell detonating and the smoke falling to the ground. Then pop up a second particle effect on the ground to simulate the smoke coming back up and creating an effective cover (a wall of smoke).

 

I used this mission and this wiki to test the different particles effects and then writing the correct "ParticleArray" in my script :

I have the first part ready, I can place the module with zeus and the script is executed without any error but no smoke is displayed at all and I can't figure out why. Can anybody please take a look at my code?

 

Config.cpp

class CfgPatches
{
	class rcdc_SmokeBarrage
	{
		name = "Smoke Barrage";
		author = "Redleouf";
		url = "https://github.com/boulayb/";
		// author[] = { "Redleouf" };
		// authorUrl = "https://github.com/boulayb/";

		// version = 1.0.0;
		// versionStr = "1.0.0";
		// versionAr[] = {1,0,0};
		
		requiredVersion = 1.60;
		requiredAddons[] = {
			"A3_Modules_F",
			"A3_Modules_F_Curator"
			};
		
		weapons[] = {};
		units[] = { "rcdc_Module_SmokeBarrage" };
	};
};

class CfgVehicles
{
	class Logic;
	
	class Module_F : Logic
	{
		class ModuleDescription
		{
			class Anything;
			class EmptyDetector;
		};
	};
	
	class rcdc_Module_SmokeBarrage : Module_F
	{
		scope = 1;
		scopeCurator = 2;
		category = "Supports";
		displayName = "Smoke Barrage";
		// icon = "\rcdc_SmokeBarrage\data\iconBarrage.paa";
		
		function = "rcdc_fnc_moduleSmokeBarrage";
		functionPriority = 1;
		isGlobal = 1;
		isTriggerActivated = 1;
		isDisposable = 1;
		is3DEN = 0;
		
		side = 7;
		
		class ModuleDescription: ModuleDescription
		{
			description = "Smoke Barrage";
		};
	};
};

class CfgFunctions
{
	class rcdc
	{
		class Supports
		{
			tag = "rcdc";
			file = "\rcdc_SmokeBarrage\functions";
			class moduleSmokeBarrage {};
		};
	};
};

fn_moduleSmokeBarrage.sqf

_logic = param[0, objNull, [objNull]];
_activated = param[2, true, [true]];

if (_activated) then
{
	hint "smoke dropped";
	_pos = [position _logic select 0, position _logic select 1, 40];
	_source = "#particlesource" createVehicleLocal _pos;
	_source setParticleCircle [
	0,					// circle radius
	[0, 0, 0]			// x y z velocity
	];
	_source setParticleRandom [
	0,					// lifetime 0 for no random
	[0.25, 0.25, 0],	// x y z position
	[0.175, 0.175, 0],	// x y z velocity
	0,					// rotation velocity
	0.5,				// scale
	[0, 0, 0, 0],		// r g b a color
	0,					// direction period
	0,					// direction intensity
	0					// angle
	];
	_source setParticleParams [
	["\A3\data_f\cl_basic.p3d", 1, 0, 1, 1],	// sprite, scale, anim start, nb of frames to play, loop
	"",					// deprecated anim name
	"Billboard",		// particle type
	1,					// timer period for onTimer script
	5,					// particle lifetime
	_pos,				// x y z position
	[0, 0, 0],			// x y z velocity
	0,					// rotation velocity
	1, 					// weight
	-1,					// volume (-1 makes the smoke go down without velocity)
	0.1,				// rubbing (bigger value makes the smoke move more)
	[2, 10, 4],			// scale
	[[1, 1, 1, 1]],		// r g b a color changing along the lifetime
	[0.08],				// animation speed for each anim state
	1,					// random direction period
	0,					// random direction intensity
	"",					// onTimerScript
	"",					// DestroyScript
	_logic,				// follow
	0,					// angle
	true,				// on surface
	-1,					// bounce on surface (disabled to save performance)
	[[0, 0, 0, 0]]		// emissive color
	];
	_source setDropInterval 0.05;
	_source attachto [_logic, [0,0,0]];
	hint "done";
};

true

 

Share this post


Link to post
Share on other sites

If you don't find any help here, I would suggest posting this over at the Armaholic forums and let the good folks over there take a look,  

 

I looked at your code and personally don't see any issue.  I sure I'm missing something. 

 

Share this post


Link to post
Share on other sites

i have not made a module myself yet, but i worked with effects quite often and there is 2 rules i know about #particlesource effects so far:

 

1. there is a bug i found after quite some time when i had some issues, that setParticleCircle is bugged (when >0),if you attach the particlesource to an object, specially moving objects. the Z axis then randomly spawns at 0, sometimes at the vehicle. specially in dedicated server very unreliable.(since you are using 0 in this command, should be not the problem)

2. Execute and manage effects on the server, when they should be called for example. But try to always only create them locally for the players. I noticed heavy fps probs if you started spawning effects on serverside aswell. Might be just a myth but i had bad experience with it.

(3. i had very bad experience with attachTo and effects. very laggy and unreliable.)

 

example how i do attach a particlesource to an object:

 

called on clients only:

 

_object = *yourobjectvariable*;

 

_smoke = "#particlesource" createVehicleLocal getpos _object;
_smoke setParticleRandom [0, [0.25, 0.25, 0], [0.175, 0.175, 0], 0, 0.25, [1, 1, 1, 1], 0, 0];
_smoke setParticleParams [["\A3\data_f\cl_basic", 1, 0, 1], "", "Billboard", 1, 1, [0,0,0.7], [0, 0, 0], 50, 10, 7.9, 0.1, [15], [[0, 0, 0, 1], [1, 1, 1, 1]], [0.08], 1, 0, "", "", _object];

_smoke setDropInterval 0.4;

 

try it out and let me know if you got any troubles.

 

edit: one thing just came to my mind. i think AI wont react on particlesource smoke afaik, so they just will see through. when you call it on client only its obvious, but i had same issue when called on server...

 

Share this post


Link to post
Share on other sites

Thank you for all those tips!

 

It seems to work without the attachto, I just need to figure a way to delete it after a certain amount of time now.

Share this post


Link to post
Share on other sites
53 minutes ago, redleouf said:

Thank you for all those tips!

 

It seems to work without the attachto, I just need to figure a way to delete it after a certain amount of time now.

 

 

deleteVehicle _smoke;

 

or what do you mean?

 

_future = time + 30; waitUntil {time >= _future};  

 

taken from the official wiki

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

×