OFPEC Forum
Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started 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
?_projectile != "flare" : exit
Ive tried these lines instead none which work
?_projectile != "flare" or "flarered" or "flaregreen" or "flareyellow" : exit?_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
-
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
-
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:
_flaretypes = ["flare", "flarered", "flaregreen", flareyellow"]
if (not (_projectile in _flaretypes)) then {exit}or you can put the if-then in short hand
? ! (_projectile in _flaretypes) : exit
If someone makes a purple flare called "flarepurple", then that can be added to the array.
-
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
-
the array is the easiest, and probably best, way of doing it
-
okay thats sovled that problem
Thanks alot
Topic solved