OFPEC Forum
Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: Lone-Wolf on 16 Aug 2009, 22:08:24
-
The script editor is asking for those unneccessary brackets that when I put them in it demands they be removed.
Whenever I try to run this line:
_a setvelocity ((velocity _a select 0 + ((2 * (cos (90-(_dir))))))),((velocity _a select 1 + ((2 * (sin (90-(_dir))))))),((velocity _a select 2)-1)];
(BTW, its all on the one line rly)
The editor says: "Error: Type Any, Expected Number" (referring to the middle section of [*,*,*])
and it also says: "Error: Missing )" seemingly expecting one after the line's end.
I've stripped it apart and tried each piece seperately and found that sometimes a piece works on it's own but not in the line as a whole or that when I run the script it spontaneously works fine and then when I run it again w/o changing anything it has a million errors!
In a nutshell:
:weeping: :weeping: :weeping:
Help?
Yours
Lone-Wolf
-
seems alright
well just introduce local vars
_var1 = 90-(_dir)
_var2 = cos(_var1)
etc
-
Try
_a setvelocity [(velocity _a select 0) + (2 * cos (90-_dir)), (velocity _a select 1) + (2 * sin(90-_dir)), (velocity _a select 2) -1];
Was missing opening [ and had far too many unnecessary brackets. Also, it may not make any difference but I generally have sin and cos the other way around, ie sin for x and cos for y.
-
The latter worked fine so thanks a bunch. :good: