Wow, these look great! Way better than the other tracer script that was linked to, and it doesn't require addons either!
I only get about 12-18 FPS, and sometimes I can't see the tracers very well/at all. I have this problem with other quick drop effects as well sometimes, but yours doesn't seem to be too bad. I wouldn't worry about trying to slow it down any for lower end computers.
You know, I was playing with these and I thought to myself: "damn, now I wish there was a way I could disable OFP's default tracers." Then I remembered you could do it in the options panel
. Now it looks even better! Too bad I can't disable MG tracers as well, because these are just better than the BIS stuff.
One thing I noticed, which I'm sure you are aware of, is that EVERYTHING gets a tracer, not just the primary weapon. Grenades, pistols, etc... they all have tracers. An easy fix might be to check if the fired weapon is the unit's "primaryWeapon" (see com ref for that command). I don't think this would solve m203's firing trace though. Another solution might be to just check the speed of the fired round, and if it is below a certain speed, then exit.
----------
Looking in the scripts, I see that you adjust the tracer depending on where the player is. Very nice
, just make sure to check distance to VEHICLE PLAYER, in case the player is in a car/helo/etc. One suggestion would be to put a Level Of Detail variable in there that says the maximum distance from the player that tracers will be shown. That's used in the ECP to cut down on needless effects that the player can't see.
I must admit, I'm confused about why you use the function and invisible H for the ricochets at the end. Are you aware that you can use the "drop" command without passing an object to it? Since you already know the last position of the bullet, I don't see why you need the H/function.
Now some performance issues. With a script like this,
every little bit of lag counts bigtime, since it is run every time every unit shoots every round:
I notice that there are only 2 tracer colors supported. If that is the case, then you really only need 1 weapon array. Meaning, you only need to know if the fired weapon is in the "green" tracers array, otherwise you can just default to red tracers (or vice-versa). That way OFP only has to search thru one array, which hopefully would be the smaller of the two.
The "custom tracer mix" array also seems a little unneeded. You could just divide the unit's remaining rounds by 3, and if the result is an even number, then you use a tracer. The "mod" command would come in handy here. I'd have to think about the exact formula that would be required, but it would only involve a check like this:
? (_a % 3) == 0 : goto "loop"
That would be quicker for OFP to check than searching thru a huge array. I realize that this wouldn't support, say, having the last 5 rounds be all trace, but perhaps a combination of array and the above would work:
? (_a in [1,2,3,4,5]) || (_a % 3) == 0 : goto "loop"
In MP, I think this script should work just fine. I believe that EHs fire on all clients, which would mean that the drop effects would be created locally on each player's machine (which you need because drop effects can only be seen on the machine where they are created). The tracer size would adjust itself to each player properly. Ricochets would be different on each machine, since the random number is "rolled" up on each separate client, but since it is only visual, it isn't a problem.
The only thing I would add for MP is a check to see if this is a dedicated server. Since no one is playing on a ded server, there is no one to see the effects, so the server doesn't need to bother creating them. You also might get errors, since you use the distance to the player, which doesn't exist on the ded. server.
On ded. servers, the "player" variable is null. So a check at the very beginning of the script would work:
? player == player : goto "start"
exit
#start