Jump to content
Sign in to follow this  
BRPVP

Tracers without Mod

Recommended Posts

I use this code on players, in a multiplayer server, to add tracers to the fired bullets:

player addEventHandler ["FiredMan",{
	_bullet = _this select 6;
	_tracer = createSimpleObject ["a3\weapons_f\data\bullettracer\shell_tracer_green.p3d",[0,0,0]];
	_tracer attachTo [_bullet,[0,0,0]];
	_tracer setDir 180;
}];

The player that fires see the tracer "a3\weapons_f\data\bullettracer\shell_tracer_green.p3d" in his bullet, but other players don't see the tracer.

You know why?

 

Thanks.

  • Like 1

Share this post


Link to post
Share on other sites

I found the problem:

The bullet object just exist locally, so for the other machines the tracer will be attached to a objNull object.

 

Future:

I can't think in a way to put tracers without a mod, sadly.

Will end leaving tracers only for the shotting player as an helper that can be set on/off.

Share this post


Link to post
Share on other sites

This could be interesting for singleplayer, but your script doesn't delete the tracer effect, so you see the tracer effect stopped wherever it hits. It also attaches the tracer effect to anything fired by the player, secondary weapon, launcher, and grenades thrown by the player.

 

 

 

Share this post


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

This could be interesting for singleplayer, but your script doesn't delete the tracer effect, so you see the tracer effect stopped wherever it hits. It also attaches the tracer effect to anything fired by the player, secondary weapon, launcher, and grenades thrown by the player.

 

Yes stburr91,

 

I don't posted the complete script to not overcomplicate the question. You have interest in the complete script?

The script is not stand alone, it is inlet in the BRPVP code. I will need to do a version FREE of BRPVP.

 

Here is it:

//VARS
BRPVP_firedFlyingBullets = [];
BRPVP_tracerModel = "a3\weapons_f\data\bullettracer\shell_tracer_green.p3d";

//FIREDMAN EVENT HANDLER
player addEventHandler ["FiredMan",{call BRPVP_pehFiredMan;}];
BRPVP_pehFiredMan = {
	_ammo = _this select 4;
	_bullet = _this select 6;
	if (getText (configFile >> "CfgAmmo" >> _ammo >> "simulation") in ["shotBullet","shotSubmunitions"]) then {
		_tracer = createSimpleObject [BRPVP_tracerModel,[0,0,0],true];
		_tracer attachTo [_bullet,[0,0,0]];
		_tracer setDir 180;
		BRPVP_firedFlyingBullets pushBack [_bullet,_tracer];
	};
};

//EACHFRAME EVENT HANDLER
addMissionEventHandler ["EachFrame",{call BRPVP_eachFrameEH;}];
BRPVP_eachFrameEH = {
	{
		if (isNull (_x select 0)) then {
			deleteVehicle (_x select 1);
		};
	} forEach BRPVP_firedFlyingBullets;
	BRPVP_firedFlyingBullets = BRPVP_firedFlyingBullets-[objNull,objNull];
};

It's not the exact version in BRPVP but is a good one for a stand alone version. It lack some optimizations that i don't know if will worth here.

  • Like 2

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  

×