...i alway want this kind of script because the tracers of ofp look very bad i use to say if somebody one day can make the tracers in ofp look like ghost recon will be nice...
I would just like to point out one thing this script is missing.
I noticed that there's no light emitting from the tracerbullets, i mean light on the ground
under the bullets.
I think this would certainly enhance the realism of your script, because this is kind of the point with tracerfire
First off, let me ask: has anyone here actually
fired tracer rounds? Or even seen someone else firing them? If not, then I suggest you not talk about what "looks realistic"
. Tracers are not meant to light the ground up beneath them. They aren't bright enough for that, and even if they were, they so fast that you wouldn't have enough time to see what they are lighting (I don't care what you see in "America's Army". The Army don't know $hit anyway
). Tracers are generally loaded as every third round in a belt/box/magazine of ammo in a machine gun. Of course, nothing says you couldn't load them into a rifle, but they are mainly useful for machine guns, so you can tell where all those damn rounds are going. Basically they are just a flaming bullet, and they literally look like laser beams when they are shot. When they hit something hard they sometimes bounce onto the ground, and you can see them sitting there, flaming for a few seconds.
I've never seen the tracers in Ghost Recon, but in my opinion, the tracers in OFP aren't too bad. They should be brighter and redder, especially at night, and you should be able to see them from much, much farther away, but they have the basic idea down okay. Chops, your script looks more realistic at longer distances, but at closer ones, I must say OFP wins on realism.
Now onto your script itself. It's a good start, but it needs some work. I can tell that you are new to scripting, and I would be happy to try and guide you, but I'm kinda busy right now, so I'll have to make this very rough. First off, you don't need a bunch of different scripts that only have one word ("lightyellow","lightred", yada yada) different. You can pass values to a script, so that the editor could say something like: [this,"lightred"] exec "tracer.sqs". That way you could have only one script, and the editor would choose the color of the light.
Now, as far as your script not catching every bullet. I think this is because of how you are constantly "setpos"ing the light to the bullet, using a constant loop. I'll bet that if you use the "setvelocity" command then there would be less drain on the CPU, and it would work better.
Another thing you need is a way for the script to determine what is being fired, so that if a grenade is thrown, no tracer will be fired.
To polish up your script and make it more realistic, you might want to make it so a tracer is fired every third round, instead of every single round. This would also reduce the drain on the CPU, since it would only have to keep track of 1/3 the tracers.
Like I said, I'm a little busy right now, but maybe later I'll give you some examples of what I mean, if you can't get it yourself. Keep scripting!