Jump to content
Nirrti

Having a bit of an issue with particles not showing up to all players.

Recommended Posts

second line of your script needs to be something like

_obj = player;

Share this post


Link to post
Share on other sites
3 minutes ago, Tankbuster said:

second line of your script needs to be something like

_obj = player;

Wouldn't that cause the smoke to appear on players themselves on their end when even one player is activating it? Or am I wrong.

Share this post


Link to post
Share on other sites

Er, yes. Right. 🙂

 

So where is the script being called from? The player who is operating the jetpack?

Share this post


Link to post
Share on other sites
1 minute ago, Tankbuster said:

Er, yes. Right. 🙂

 

So where is the script being called from? The player who is operating the jetpack?

Yeah, the player that has the jetpack, or has it as an addaction.

Share this post


Link to post
Share on other sites

Got it. So the script needs to send a reference to the player itself, you were closer earlier on, I think

 

[player] remotexec ["jetpacksmoke", [0,-2] select isdedicated, false];

Just to confirm, the script is compiled somewhere, ideally in CfGFunctions?

Share this post


Link to post
Share on other sites
22 minutes ago, Tankbuster said:

Got it. So the script needs to send a reference to the player itself, you were closer earlier on, I think

 


[player] remotexec ["jetpacksmoke", [0,-2] select isdedicated, false];

Just to confirm, the script is compiled somewhere, ideally in CfGFunctions?

Yeah, I can compile it in the description with cfgfunctions, I'll give that a try.

 

Edit

 

Hmm, still no errors, still not showing smoke, and the sound isn't activating, although I assume it's because it's compiled through the cfgfunctions, and the script is using another preprocessFileLineNumbers compiled call. The sound I can probably figure out later on once the smoke is actually visible properly to everyone.

 

It is compiled in the description.ext with the cfgfunctions I mentioned earlier;

class CfgFunctions
{
	class jetpacksmoke
	{
		class jetpacksmoke
		{
			class jetpacksmoke {file = "scripts\jetpacksmoke.sqf";};
		};
	};
};

 

This is the current jetpack script, it's really rather simple, and it relies on player tapping a key (user action 1 in this case), to provide lift/thrust pushing the player upwards and onwards. This is what the addaction has on it.

_vel = velocity player;
_dir = direction player;
_speed = 2;
player setVelocity [
	(_vel select 0) + (sin _dir * _speed), 
	(_vel select 1) + (cos _dir * _speed), 
	(_vel select 2) + 3
];
[player] remoteexec ["jetpacksmoke", [0,-2] select isdedicated, false];

 

if I use

nul = [player] call jetpacksmoke;

instead of 

[player] remoteexec ["jetpacksmoke", [0,-2] select isdedicated, false];

and have the jetpacksmoke compiled in the init with

jetpacksmoke = compile preprocessFileLineNumbers "scripts\jetpacksmoke.sqf"

 

That's where I was at the beginning, which is smoke shows to only to the client that is activating the script.

 

I'm somewhat close to just giving up with this damn thing since it really doesn't want to work 😞

 

This is the full jetpacksmoke currently.

private ["_obj"];

_obj = _this select 0;    //object

publicVariable "jetpacksmoke";
if (not isDedicated) then {



_smoke = "#particlesource" createVehicle getPosATL _obj;
nul = [_smoke,"jetpackthrust"] call 3Dbroadcast;
_smoke setParticleRandom [0, [0.25, 0.25, 0], [0.2, 0.2, 0], 0, 0.25, [0, 0, 0, 0.1], 0, 0];
_smoke setParticleParams [["\Ca\Data\ParticleEffects\FireAndSmokeAnim\SmokeAnim.p3d", 8, 3, 1], "", "Billboard", 1, 6, [0, 0, 0], [0, 0, 1.5], 0, 10, 7.9, 0.066, [0.25, 5], [[0.33, 0.33, 0.33, 0.8], [0.66, 0.66, 0.66, 0.4], [1, 1, 1, 0]], [0.125], 1, 0, "", "", _smoke];
_smoke setDropInterval 0.05;
_smoke attachTo [_obj, [0,-0.2,1.2],"spine2"];
sleep 0.5;
deletevehicle _smoke;
};

true

 

Share this post


Link to post
Share on other sites

The script needs to run on all players, but it has to show the particles on the player who is using the jetpack.

So, when the player starts to use the jetpack, they need to tell every other player to run jetpacksmoke but reference the jetpack user object in it.

I think you might be over-complicating matters. Let's break it down .

 

Write a function which all the players have, personally, I'd make a function and compile it in CfgFunctions.

This function needs to take, as a parameter, an object which should be the person who is using the jetpack.

 

As I said earlier, remoteexec can handle this and it's how I would do it.

 

[player] remoteexec ["jetpacksmoke", [0,-2] select isdedicated, false];

 

So, player (the guy using the jetpack) is going to start the script called jetpacksmoke.

The [0,-2] select isDedicated  means that the server will run on all the clients and not the server, unless one of the players is the server too, in which case it will run there too.

false means that JIP players won't see it if they join while it's running but it also means they won't get their join slowed down with running the function for jetpack flights that have ended.

 

The remoteExec mean all players run the function because the jetpack user was sent as a parameter, they will all see the particles on him.

 

I can't see anything obviously wrong with jetpacksmoke, you don't need the not isdedicated line because remoteexec looks after that.

 

Why do you publicVariable "jetpacksmoke" in the function? It's not a variable.

 

 

Share this post


Link to post
Share on other sites
48 minutes ago, Tankbuster said:

The script needs to run on all players, but it has to show the particles on the player who is using the jetpack.

So, when the player starts to use the jetpack, they need to tell every other player to run jetpacksmoke but reference the jetpack user object in it.

I think you might be over-complicating matters. Let's break it down .

 

Write a function which all the players have, personally, I'd make a function and compile it in CfgFunctions.

This function needs to take, as a parameter, an object which should be the person who is using the jetpack.

 

As I said earlier, remoteexec can handle this and it's how I would do it.

 

[player] remoteexec ["jetpacksmoke", [0,-2] select isdedicated, false];

 

So, player (the guy using the jetpack) is going to start the script called jetpacksmoke.

The [0,-2] select isDedicated  means that the server will run on all the clients and not the server, unless one of the players is the server too, in which case it will run there too.

false means that JIP players won't see it if they join while it's running but it also means they won't get their join slowed down with running the function for jetpack flights that have ended.

 

The remoteExec mean all players run the function because the jetpack user was sent as a parameter, they will all see the particles on him.

 

I can't see anything obviously wrong with jetpacksmoke, you don't need the not isdedicated line because remoteexec looks after that.

 

Why do you publicVariable "jetpacksmoke" in the function? It's not a variable.

 

 

Oh, that's a leftover from when I tried using it with the init compile, forgot to remove that 😄

 

I'll have to test out after cleaning it soon, currently busy so will report back.

Share this post


Link to post
Share on other sites

Because \Ca\Data\ParticleEffects\FireAndSmokeAnim\SmokeAnim.p3d is an outdated p3d. It exists in Arma 2 or older. Use a proper p3d.

Share this post


Link to post
Share on other sites
25 minutes ago, POLPOX said:

Because \Ca\Data\ParticleEffects\FireAndSmokeAnim\SmokeAnim.p3d is an outdated p3d. It exists in Arma 2 or older. Use a proper p3d.

Well it sure is working as a smoke clientside, and it's referenced in the arma 3 wiki, so I don't know what to tell you. But if you wanted to be a bit more helpful, could you maybe point me at the right one then?

 

Edit

 

After cleaning up the things, the smoke still isn't showing up at all now, with the cfgfunctions compile, @Tankbuster, so I've no idea how to even fix that. Unless the cfgfuntions I've got is incorret, but I've zero experience doing those.

 

This is how it looks with the init preprocessFileLineNumbers

 

https://streamable.com/rc6m5

Share this post


Link to post
Share on other sites

Uh, sorry, I was sure it is inproper p3d and that's one of the problem. Looks like I've done another dyslexia moment and jumped to conclusion.

Anyway, I'd suggest to use these particles:

https://community.bistudio.com/wiki/User:POLPOX#Particle_effects

Which are vanilla ones.

 

PS, your video looks dope, of course in a good terms.

  • Like 1

Share this post


Link to post
Share on other sites
2 minutes ago, POLPOX said:

Uh, sorry, I was sure it is inproper p3d and that's one of the problem. Looks like I've done another dyslexia moment and jumped to conclusion.

Anyway, I'd suggest to use these particles:

https://community.bistudio.com/wiki/User:POLPOX#Particle_effects

Which are vanilla ones.

 

PS, your video looks dope, of course in a good terms.

Okay, I'll have to see about replacing it with one of those then, thanks.

Share this post


Link to post
Share on other sites
6 hours ago, Nirrti said:

could you maybe point me at the right one then?

Universal particle

and change...

10 hours ago, Nirrti said:

["\Ca\Data\ParticleEffects\FireAndSmokeAnim\SmokeAnim.p3d", 8, 3, 1]

 

to...

["\A3\data_f\ParticleEffects\Universal\Universal",16,7,24,1]

See explanation of numbers in linked post above.

 

 

6 hours ago, Nirrti said:

Unless the cfgfuntions I've got is incorret

The first class in cfgFunctions is a tag and will be used to compile the function name. So you should be using jetpacksmoke_fnc_jetpacksmoke.

Not very friendly naming. I was suggest reading about CfgFunctions HERE.

class CfgFunctions
{
	class NTI	//tag
	{
		class jetpack	//category ( used in functions viewer ) 
		{
			class jetpacksmoke { file = "scripts\jetpacksmoke.sqf" };
		};
	};
};

//compiles the function
//NTI_fnc_jetpacksmoke

Usage...

[ player ] remoteExec[ "NTI_fnc_jetpacksmoke", 0, false ];

0 means remote execute on all connected machines.

 

Then just add to the top of jetpacksmoke.sqf

if ( isServer && { isDedicated } ) exitWith {};

//OR
//if !( hasInterface ) exitWith {};

So if the script is remoteExec'ed to the server, and the server has no client then the script exits. No need to spawn particles if no one is around to see them.

 

Think that's all correct.

  • Like 2

Share this post


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

Universal particle

and change...

to...


["\A3\data_f\ParticleEffects\Universal\Universal",16,7,24,1]

See explanation of numbers in linked post above.

 

 

The first class in cfgFunctions is a tag and will be used to compile the function name. So you should be using jetpacksmoke_fnc_jetpacksmoke.

Not very friendly naming. I was suggest reading about CfgFunctions HERE.


class CfgFunctions
{
	class NTI	//tag
	{
		class jetpack	//category ( used in functions viewer ) 
		{
			class jetpacksmoke { file = "scripts\jetpacksmoke.sqf" };
		};
	};
};

//compiles the function
//NTI_fnc_jetpacksmoke

Usage...


[ player ] remoteExec[ "NTI_fnc_jetpacksmoke", 0, false ];

0 means remote execute on all connected machines.

 

Then just add to the top of jetpacksmoke.sqf


if ( isServer && { isDedicated } ) exitWith {};

//OR
//if !( hasInterface ) exitWith {};

So if the script is remoteExec'ed to the server, and the server has no client then the script exits. No need to spawn particles if no one is around to see them.

 

Think that's all correct.

 

 

Well, I gave that a try, but the smoke still isn't showing up at all with the cfgfunctions, so I must be doing something wrong, the jetpacksmoke is currently

if ( isServer && { isDedicated } ) exitWith {};

_obj = _this select 0;    //object

private ["_obj"];

_smoke = "#particlesource" createVehicle getPosATL _obj;

_smoke setParticleRandom [0, [0.25, 0.25, 0], [0.2, 0.2, 0], 0, 0.25, [0, 0, 0, 0.1], 0, 0];
_smoke setParticleParams [["a3\data_f\particleeffects\universal\universal.p3d",16,7,48,1],"","billboard", 1, 6, [0, 0, 0], [0, 0, 1.5], 0, 10, 7.9, 0.066, [0.25, 5], [[0.33, 0.33, 0.33, 0.8], [0.66, 0.66, 0.66, 0.4], [1, 1, 1, 0]], [0.125], 1, 0, "", "", _smoke];
_smoke setDropInterval 0.05;
_smoke attachTo [_obj, [0,-0.2,1.2],"spine2"];
sleep 0.5;
deletevehicle _smoke;

The actual script that the player is activating whenever they're activating the jetpack is

_vel = velocity player;
_dir = direction player;
_speed = 2;
player setVelocity [
	(_vel select 0) + (sin _dir * _speed), 
	(_vel select 1) + (cos _dir * _speed), 
	(_vel select 2) + 3
];
[player] remoteExec[ "NTI_fnc_jetpacksmoke", 0, false ];

And I put that cfgfunctions in the description.ext

 

So I'm at a complete loss 😞

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

×