Home   Help Search Login Register  

Author Topic: Tracer effect script  (Read 5547 times)

0 Members and 3 Guests are viewing this topic.

Offline chops

  • Members
  • *
  • I'm a llama!
Tracer effect script
« on: 20 Jun 2003, 05:58:44 »
 Here's a script I made which changes the tracer effects of any weapon or vehicle you want.

 It uses a coloured lights Addon (only 15k) which is included in the zip file. Let me know what ya reckon, so I know whether to bother posting it or not.

Thanks!!

Chops


MPKING

  • Guest
Re:Tracer effect script
« Reply #1 on: 20 Jun 2003, 18:19:47 »
I like it, it looks good but i need a little info on when and which situation you would use tracerfire to make realistic missions :P
Btw. My handgrenades aren't supposed to light up too, are they? ;D

terrazasjs

  • Guest
Re:Tracer effect script
« Reply #2 on: 20 Jun 2003, 23:19:36 »
well i put all the scripts on the user mission folder like always but when i get to the mission editor and try to open the mission can not test it because of a missing addon "runwaymarkerwhite",i already put the pbo file of colorfull ligth in my addons folder please correct this problem thanks

Offline libriut99

  • Members
  • *
  • 2b or not 2b, who cares ???
Re:Tracer effect script
« Reply #3 on: 21 Jun 2003, 08:25:22 »
MPKING .....

on realistic missions U would use tracers to mark enemy positions ,at night , for your squad troopers or as an AA battery you would use tracers in order to know where your firing at.
before 'Zee germans get there ...

MPKING

  • Guest
Re:Tracer effect script
« Reply #4 on: 22 Jun 2003, 06:15:57 »
Thanks Libriut99.

Terrazasjs did you remember to unzip the pbo's before putting them in your addons folder?

Offline chops

  • Members
  • *
  • I'm a llama!
Re:Tracer effect script
« Reply #5 on: 22 Jun 2003, 09:27:28 »
MPKING, libriut99, terrazasjs  thanks for your feedback, much appreciated.

I made the scripts hoping that somebody more knowledgable would tinker with them and fix problems like ANYTHING (grenades, satchel charges etc) fired having a tracer.

From what I've seen from my armchair tracers are used on vehicle machine guns and AAA and the like. I think the idea is so the gunner can actualy see where the bullets are going and adjust fire.

terrazasjs

  • Guest
Re:Tracer effect script
« Reply #6 on: 23 Jun 2003, 00:32:07 »
okey guys i manage to make the demo mission to work and look fantastic 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 and I think you can still make this wonderful script to go beyond this point and make it looks more realistic and if you can add sounds to the bullets like those in the vietcong game will add more tension to the missions we make with this script.I just have one more problem went i try to use the scrpts in one of my missions by coping and pasting the triggers ans everything in the demo mission and of course by puting all the sqs files in the mission folder I CANT MAKE IT WORK, there is
a big error everytime the soldiers with the code:this addEventHandler ["fired",{_this exec "tracerYellowL.sqs"}]
 in the init field star firing will you let me know what im doing wrong
and thank you for your time :)

 

terrazasjs

  • Guest
Re:Tracer effect script
« Reply #7 on: 24 Jun 2003, 02:44:29 »
Hi guys is me againg I been spending some time with this script and I found some bugs like the tracers effect wont work if you put the M2 machingun "miearge" far then where it is I think it has something to do with this line of command in the scripts:
_missile = nearestObject [this,_this select 4]
so the problems comes when you want to use the whole map to do your mission only the soldiers that are near to the emty objects will have the tracer effect,and when i try to copy and paste onother mission of my into the tracer demo mission I always have this error in this line of command from the scripts:"_trace setpos [(getpos _missile select 0), (getpos _missile select 1), (getpos _missile select 2)] #error expected number"

maybe you can try to test the scripts in every way so you can debug because this tracer effect is worthy looks very nice.thank you againg ;)

terrazasjs

  • Guest
Re:Tracer effect script
« Reply #8 on: 24 Jun 2003, 02:54:37 »
I want to make some rectifications before I go. when I said that the tracer effect wont work when you put away the M2 machinegun "mierge" i mean add some units next to the soldier of the demo mission and put this code in thier init field:this addEventHandler ["fired",{_this exec "tracerYellowL.sqs"}]
you will see a yellow tracer coming from thier guns but then try to put M2"mierge" away and you will see that you dont have the tracer effect no more. okey thats all, I will be cheking this tread

Offline chops

  • Members
  • *
  • I'm a llama!
Re:Tracer effect script
« Reply #9 on: 24 Jun 2003, 05:30:25 »
Gday terrazasjs!

Im pleased you like the script! I totally agree that the OFP tracers need some work! Please understand that I posted this script here because I need help with it !!

Now down to business.

The problem is that I really don't know much about scripting at all. What you have now took me the best part of two days to come up with!

The radio triggers in the demo mission are specifically for the player as they are all

player removeEventHandler [""fired"",0]

and

player addEventHandler [""fired"",{_this exec ""tracerYellowL.sqs""}]

The init line for other units is

this addEventHandler [""fired"",{_this exec ""tracerYellow.sqs""}]

try naming the unit you want to use the script eg, sold1. Then put

sold1 addEventHandler [""fired"",{sold1 exec ""tracerYellow.sqs""}]

Then change the first line in tracerYellow.sqs (or whichever you want to use) from this;

_missile = nearestObject [this,_this select 4]

to this


_missile = nearestObject [sold1,_this select 4]

I hope this helps and I'm keen to play any missions you make with this script or your own (improved) version!

chops
« Last Edit: 24 Jun 2003, 05:32:25 by chops »

terrazasjs

  • Guest
Re:Tracer effect script
« Reply #10 on: 24 Jun 2003, 23:04:37 »
good day! Okey Chops I did everything you told me to do , and yes now I can place the soldier everywhere in the map and tracer effect will now work thats great :D
however when you change this code: _missile = nearestObject [this,_this select 4] in the original scripts for this one:_missile = nearestObject [sold1,_this select 4]  the effect only works with that spesific unit and even if you put more unit with their own names the script refuse to work with them. I try to modify the code by adding more names:_missile = nearestObject [sold1,sold2,sold3_this select 4] but with no luck I got the same error:"_trace setpos [(getpos _missile select 0), (getpos _missile select 1), (getpos _missile select 2)] #error expected number" then I try to put a group loop directly into the script itself:




; ########### DEBUG ###########
;hint "DEBUG: grouploop"
; #############################

_groupselect = _groupselect - 1
; If _groupselect is less than 0 goto start
? _groupselect < 0 : goto "start"
; If all units in selected group is dead remove it from _groups and occupied array and goto start
? count units (_groups select _groupselect) == 0 : _groups = _groups - [(_groups select _groupselect)]; occupied = occupied - [(_groups select _groupselect)]; _groupcount = count _groups;
_missile = nearestObject [sold1,_this select 4]

_trace="LargeRunwayMarkerWhite" createVehicle [0,0,0]
_trace setpos [getpos _missile select 0, getpos _missile select 1, (getpos _missile select 2) +0]

_trace inflame true

#loop
~0.0001
_trace setpos [(getpos _missile select 0), (getpos _missile select 1), (getpos _missile select 2)]
 
? isNull _missile : goto "end"
goto "loop"

#end

deleteVehicle _trace

exit

PS. you know this is for the whitelarge effect but you can do this with the other scripts as well.
---------------------------------------------------------------------------------------------

and then I got something interesting I was able to add units like:sold2 addEventHandler [""fired"",{sold2 exec ""tracerYellow.sqs""}];sold3 addEventHandler [""fired"",{sold3 exec ""tracerYellow.sqs""}] and they where able to call the script with no errors but they have to be in the same group of "sold1" in order to work or near to "sold1".and another little bug is that east units always refuse to call the script even if you use another color scritp only for them using the same logic;because this is where the problem lives:_missile = nearestObject [sold1,_this select 4] because you can have to names like:I[sold1,east1_this select 4]  without messing everything up.
I dont have a clue how to fix it but at least we did some improvements what we need is to somehow find a way to call the scripts by using triggers that will cover the whole mission I know that we will need eventhandlers anyway because the script is call by the event"fired" but if we can avoid eventhandler the better but you will have to rewrite the whole scripts to find another way around. Well i have to go test the scripts and try to make it work in the whole map and using a lot of units for the west and for the east see you next time ;)

terrazasjs

  • Guest
Re:Tracer effect script
« Reply #11 on: 24 Jun 2003, 23:10:58 »
sorry I have i little spelling error correcting the above frase:YOU CANT HAVE TWO O MORE NAMES LIKE :[sold1,east1_this select 4]  without messing everything up. OKEY SORRY ABOUT THAT BYE :tomato:

Offline chops

  • Members
  • *
  • I'm a llama!
Re:Tracer effect script
« Reply #12 on: 28 Jun 2003, 09:45:42 »
terrazasjs!

 Mate, looks like you've put in a lot of time and effort! Sounds like hopefully you're making some progress! I'm not sure about the group loop thing you mentioned, it's a bit beyond my knowledge!   ???

 When I have got the script to work with a helicopter and a machine gunners (SEB Nam pack) firing at each other, I noticed the lights appear and disappear at different times.

 I think maybe OFP struggles with having to compute the position of every bullet in the game at the same time? My orignal idea was for the script to be used with vehicles and machine guns.

I realise this posting is of no use to you at all! Just hope you have some luck with it!

Chops

MPKING

  • Guest
Re:Tracer effect script
« Reply #13 on: 04 Jul 2003, 18:01:26 »
Sorry i can't help you with the scripting.
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 ;)

_hammy_

  • Guest
Re:Tracer effect script
« Reply #14 on: 05 Jul 2003, 20:28:18 »
looks good

Offline General Barron

  • Former Staff
  • ****
  • Semper Fi!
Re:Tracer effect script
« Reply #15 on: 16 Jul 2003, 21:38:01 »
...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 :o). 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!  8)
HANDSIGNALS COMMAND SYSTEM-- A realistic squad-control modification for OFP
kexp.org-- The best radio station in the world, right here at home! Listen to John Richards!

MPKING

  • Guest
Re:Tracer effect script
« Reply #16 on: 18 Jul 2003, 00:24:44 »
 :-[BUMP ::)

Well i'm sorry, i just assumed that they would light up the ground. I know i shouldn't assume but i did and i'm sorry.
And no i haven't seen real tracers, well yes but only from long distance.
I've only fired a rifle once in daylight without tracers  and i do not play Ghost Recon or America's Army.
« Last Edit: 18 Jul 2003, 00:28:27 by MPKING »