Jump to content

LSValmont

Changing all regular ammo to Tracer ammunition

Recommended Posts

Dear follow Arma addicts, can anyone point me towards a performance conscious script for:

 

1) Replacing all the non tracer ammunition from both player and ai with tracer ammunition, both at their weapons and inventories.

2) I believe tracer ammunition effects only happens when the magazine is almost empty. Is there any way to make every round have (or simulate) tracer effects?

 

 Basically I want to simulate old school battlefield games (BF2, BF3) were all rounds have tracer like effects that help players identify the origin and location that fire is coming from. (I need to up the feedback and gameplay friendliness of my mission while compromising some realism).

 

Thank you in advanced!

Share this post


Link to post
Share on other sites

This is by no means an easy task, especially considering that magazine classes not always have a tracer version, nor are the classnames consistent enough to make a reliable script without thorough error checking (gets into nightmare territory if you want to include compatibility to other mods).

You can check for tracer mags like this:

_allMagazines = "getNumber (_x >> 'scope') >=  2" configClasses (configFile >> "CfgMagazines") apply {configName _x};
_allTracers  = "getNumber (_x >> 'tracersEvery') > 0" configClasses (configFile >> "CfgMagazines") apply {configName _x};

Magazines that act like tracers have the tracerEvery value above 0.

Sometimes tracer magazine classnames include the name of the color, sometimes it's simply named with a "tracer" suffix.

A solution would be  to compare magazines by iterating through the (at most 3 deep from what I can tell) getUnitLoadout nested array, and replace it with a similar named mag from the tracer array, like this:

//while iterating over getUnitLoadout array
_allValidTracers = _allTracers select {toUpper _x find toUpper _mag >= 0};
if (count _allValidTracers > 0) then {/*replace element*/};//might pick a random one or the first element, should be a tracer in any case

It's probably faster and more fool proof to make 4-5 custom unit loadouts using tracers to achieve what you want.

 

Cheers

  • Like 4

Share this post


Link to post
Share on other sites

If you are not in a hurry, I'll give you (end of March) a little script adding light on each bullets. I'm not at home and far from Arma. On the other hand, I remember some FPS drops in intense battle. But the effects are fun by night, bullets enlightening the landscape.

  • Like 4

Share this post


Link to post
Share on other sites
  On 3/10/2020 at 7:31 PM, pierremgi said:

If you are not in a hurry, I'll give you (end of March) a little script adding light on each bullets. I'm not at home and far from Arma. On the other hand, I remember some FPS drops in intense battle. But the effects are fun by night, bullets enlightening the landscape.

Thank you @pierremgi I am not in a hurry since I am waiting for OLD MAN (The mission, not @Grumpy Old Man) to be integrated into Arma 3 (it is already integrated in the Dev Versions).

 

  On 3/10/2020 at 6:33 PM, Grumpy Old Man said:

This is by no means an easy task, especially considering that magazine classes not always have a tracer version, nor are the classnames consistent enough to make a reliable script without thorough error checking (gets into nightmare territory if you want to include compatibility to other mods).

You can check for tracer mags like this:

_allMagazines = "getNumber (_x >> 'scope') >=  2" configClasses (configFile >> "CfgMagazines") apply {configName _x};
_allTracers  = "getNumber (_x >> 'tracersEvery') > 0" configClasses (configFile >> "CfgMagazines") apply {configName _x};

Magazines that act like tracers have the tracerEvery value above 0.

Sometimes tracer magazine classnames include the name of the color, sometimes it's simply named with a "tracer" suffix.

A solution would be  to compare magazines by iterating through the (at most 3 deep from what I can tell) getUnitLoadout nested array, and replace it with a similar named mag from the tracer array, like this:

//while iterating over getUnitLoadout array
_allValidTracers = _allTracers select {toUpper _x find toUpper _mag >= 0};
if (count _allValidTracers > 0) then {/*replace element*/};//might pick a random one or the first element, should be a tracer in any case

It's probably faster and more fool proof to make 4-5 custom unit loadouts using tracers to achieve what you want.

 

Cheers

 

Thank you @Grumpy Old Man, I agree about making custom loadouts being the best option other than @pierremgi 's. I will be using that until  @pierremgi can share his script 😉

Share this post


Link to post
Share on other sites

Well, still stuck 17,000 km far from my home...

I decided to shift on another PC. As I have plenty of time these ugly days, here is a brand new script:

 

  Reveal hidden contents

 

The best way is to run it, independently on each played PC, say like inside  initPlayerLocal.sqf  (I can't imagine any sync/broadcast for all that stuff! Avoid any remote execution)

 

There are 2 parameters:

MGI_LIMITTRACERS (boolean) :   If you set it to FALSE, all bullets/shells/missiles will have an attached light. That could be enchanting but not very realistic... and resource consuming.

If you let it to TRUE, you will force all end of magazines for custom tracers (set to 5 here);

 

MGI_FORCESOMETRACERS (number):   if set to zero, no extra thing. If you set it >O, 2 cases:

  - the current magazine is already able to fire a tracer regularly (say every 5 bullets): The vanilla parameter is taken into account and the script adds a light on these tracers only;

  - there is no tracer supposed to be fired regularly : in this case, your parameter will add tracers every interval you set.

 

Colors used are:

white for any missile,

red for BLUFOR, green for OPFOR, yellow for INDEP.

Note: I didn't cope with current tracer colors. So, in some cases, my tracer colors  are different from BI tracer ones: For example,  the INDEP NYX (I_LT_01_AA_F), is vanilla fitted with red tracers for HMG12.7. (should be yellow... I don't know why this exception).

 

I'll probably add this code in a MGI module... once at home.

Enjoy!

 

  • Like 2
  • Thanks 4

Share this post


Link to post
Share on other sites
  On 4/5/2020 at 1:48 PM, pierremgi said:

Well, still stuck 17,000 km far from my home...

I decided to shift on another PC. As I have plenty of time these ugly days, here is a brand new script:

 

  Reveal hidden contents

 

The best way is to run it, independently on each played PC, say like inside  initPlayerLocal.sqf  (I can't imagine any sync/broadcast for all that stuff! Avoid any remote execution)

 

There are 2 parameters:

MGI_LIMITTRACERS (boolean) :   If you set it to FALSE, all bullets/shells/missiles will have an attached light. That could be enchanting but not very realistic... and resource consuming.

If you let it to TRUE, you will force all end of magazines for custom tracers (set to 5 here);

 

MGI_FORCESOMETRACERS (number):   if set to zero, no extra thing. If you set it >O, 2 cases:

  - the current magazine is already able to fire a tracer regularly (say every 5 bullets): The vanilla parameter is taken into account and the script adds a light on these tracers only;

  - there is no tracer supposed to be fired regularly : in this case, your parameter will add tracers every interval you set.

 

Colors used are:

white for any missile,

red for BLUFOR, green for OPFOR, yellow for INDEP.

Note: I didn't cope with current tracer colors. So, in some cases, my tracer colors  are different from BI tracer ones: For example,  the INDEP NYX (I_LT_01_AA_F), is vanilla fitted with red tracers for HMG12.7. (should be yellow... I don't know why this exception).

 

I'll probably add this code in a MGI module... once at home.

Enjoy!

 

 

Hey, for some reason I wasn't aware of this reply! 

 

Thank you very much @pierremgi

 

Will test this ASAP!

Share this post


Link to post
Share on other sites

@pierremgi @Grumpy Old Man

 

This fnc does the job!

No performance impact, nothing attached, no network load, looks amazing and it is just perfect.


Thank you both for your input and help!

  Reveal hidden contents

 

  • Like 2

Share this post


Link to post
Share on other sites

Hi @LSValmont,

 

this script looks very interesting. The less network traffic for Dedicated Server makes me looking for very interested.

To which way you integrated your fnc? Do you use a call via init.sqf or initserver.sqf?

 

Thanks a lot for sharing this idea.

  • Like 1

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

×