Jump to content
🛡️FORUMS ARE IN READ-ONLY MODE Read more... ×
Sign in to follow this  
Big Dawg KS

Calculating Which Rounds are Tracers

Recommended Posts

Ok guys. I need your additional brainpower to help me figure this out.

In ArmA 2 we have the following config entries that the game uses to determine when to display tracers on a projectile:

In CfgMagazines:

tracersEvery
lastRoundsTracer

So, tracersEvery means this is how often tracers appear. Fine. LastRoundsTracer, when the ammo in the magazine reaches this number, the remaining rounds are all tracers. Also good.

Now, the problem. How do we use this information to come up with an equation to calculate, using these parameters in addition to the remaining ammo in the magazine, whether the round we just fired is going to be a tracer.

One would think it's as simple as if(ammoLeft mod tracersEvery == 0), but unfortunately it's not that simple. This will give us the correct tracer interval, but not guaruntee that we started in the correct place (could produce an offset between calculated tracer and actual tracer).

So, how does the game do it? I've asked Suma but haven't gotten a resposne yet. It seems that it might have something to do with lastRoundsTracer, and the order in which the rounds would have been "loaded" into the magazine. For example, the first X rounds (X being equal to lastRoundsTracer) are tracers, then the X+Y round (Y being tracersEvery) is a tracer. And every Y rounds is another tracer. This means we have to know what to compare the modulo calculation to depending on lastRoundsTracer and possibly (I say possibly because I'm not sure how to do the math) the capacity (initial round count) of the magazine.

I'm not entirely sure that's how it works either, but it's my best guess. And so the final question is, how do we use all of this information to calculate, correctly every time, whether or not we just fired a tracer round or a regular round?

Share this post


Link to post
Share on other sites

Tracers always seem to start on the first round in the magazine so it should be as simple as:

((ammoLeft + 1) % tracersEvery == 0) || ((ammoLeft + 1) <= lastRoundsTracer)

Or is there something I am missing?

Share this post


Link to post
Share on other sites
Tracers always seem to start on the first round ...

Or is there something I am missing?

They usually do, except that they don't on all of the M2s (regardless of magazine capacity). Therefore there must be something else at play. And it has to work for ANY weapon (including addons), so just checking if it's the M2 won't work. I need an equation.

Share this post


Link to post
Share on other sites

Well, besides getting it working just for single turrets & infantry (which I still can't do), there's no hope in getting it to work for vehicles with multiple turrets.

One of these days, we're really going to need multiple turret compatable versions of all the commands that check or manipulate weapons and magazines.

I wish there were a better way of convincing BIS to add/change scripting commands. :(

Share this post


Link to post
Share on other sites

I know I'm digging this up, but I think I've made some progress with this. However, it still requires knowing the magazine classname. Unfortunately, this is not passed by the fired eventhandler, so the only way is to use currentMagazine. The problem is that that it doesn't work for secondary turrets. If we had this alternative syntax, I'd be in good shape.

Share this post


Link to post
Share on other sites
I know I'm digging this up, but I think I've made some progress with this. However, it still requires knowing the magazine classname. Unfortunately, this is not passed by the fired eventhandler, so the only way is to use currentMagazine. The problem is that that it doesn't work for secondary turrets. If we had this alternative syntax, I'd be in good shape.

In the meantime you could get the list of the turret's magazines (magazinesTurret) and check which class contains the fired ammo (or is contained in the weapon's magazines[]). The chances of a vehicle carrying several kinds of magazines for the same weapon, differing in tracer properties, are quite low.

Edited by Q1184

Share this post


Link to post
Share on other sites
The chances of a vehicle carrying several kinds of magazines for the same weapon, differing in tracer properties, are quite low.

In BIS vehicles this is true. And yes, worst case scenario I will use a method like this. However, maybe it's not as rare as you think: ex: tracer mag vs tracerless mag. They could even use the same ammo and only one will use tracers.

Share this post


Link to post
Share on other sites
Sign in to follow this  

×