OFPEC Forum

Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: 456820 on 20 Jan 2006, 21:08:44

Title: any kind of flare
Post by: 456820 on 20 Jan 2006, 21:08:44
Alright i have this scripts which basiccaly creates smoke trails on flares but only works on whit flares how can i get it to work with all flares

the original line
Code: [Select]
?_projectile != "flare" : exit
Ive tried these lines instead none which work

Code: [Select]
?_projectile != "flare" or "flarered" or "flaregreen" or "flareyellow" : exit
Code: [Select]
?_projectile != "flare" or _projectile != "flarered" or _projectile != "flaregreen" or _projectile != "flareyellow" or : exit
Both of them give errors and dont work.
How will i get it to work if any flare is fired?
Cheers
Title: Re:any kind of flare
Post by: macguba on 20 Jan 2006, 21:55:23
You are writing in English, not OFP code.     The correct syntax is:-

? (_projectile != "flare") or (_projectile != "flarered") etc

However that will not work, logically.   Take the not outside the brackets.

? not ((_projectile == "flare") or (_projectile == "flarered") etc) : exit


Title: Re:any kind of flare
Post by: Raptorsaurus on 20 Jan 2006, 22:24:21
You could also do this with an array.  This will also allow one to add different flare types (addon flares) very easily by adding those to the array.  Here's how:

Code: [Select]
_flaretypes = ["flare", "flarered", "flaregreen", flareyellow"]
if (not (_projectile in _flaretypes)) then {exit}
or you can put the if-then in short hand
Code: [Select]
? ! (_projectile in _flaretypes) : exit
If someone makes a purple flare called "flarepurple", then that can be added to the array.
Title: Re:any kind of flare
Post by: 456820 on 20 Jan 2006, 23:11:06
thanks ill try them out ASAP
Since i dont plan on releasing the script to the public as i am just editing it to work with more then the white flare, but even so an array does sound like a good idea ill try them both though
Cheers
Title: Re:any kind of flare
Post by: Triggerhappy on 21 Jan 2006, 02:49:15
the array is the easiest, and probably best, way of doing it
Title: Re:any kind of flare
Post by: 456820 on 21 Jan 2006, 10:24:15
okay thats sovled that problem
Thanks alot

Topic solved