Search the Community
Showing results for tags 'Undefined variable'.
Found 3 results
-
Hi, I'm new to scripting so forgive me for what I'm asking. I'm trying to make a training mission for my clan. I need to randomly place four flags inside a given area defined by a marker, and these four flags have some constraints in terms of the position in which they can be placed. Here's a bit of the code: traguardo setPos ([["white"], []] call BIS_fnc_randomPos); blueflag setPos ([[[getPos traguardo, 4500]], [[getPos traguardo, 2500], "water"], _this inArea "white"] call BIS_fnc_randomPos); where "white" is the name of the above-stated marker. When I run the code, it returns me the error: |#|_this inArea "white" Error undefined variable in the expression: _this don't know why though. Thank you greatly for your help.
-
Trouble with creation civilian panic script - Simple issue?
BobTheHunted posted a topic in ARMA 3 - MISSION EDITING & SCRIPTING
Hello. First off, I want to apologize if I have posted this topic in the wrong area, but I think it's right. If not, oh well. Oops. Anyway, on to my script. What I am trying to do is make a script for the civilians in my mission to make them behave in a certain way by playing some of the cowering type animations in A3. I managed to get the basic idea working by spawning the commands manually into each units initialization field but when I try to define a function and call that I get issues. inside the civ units init: init.sqf: functions.sqf; The problem I am having is I get the error message "Error: Undefined Variable in Expression: this" and the line of code it shows above that is "0 = [] spawn { |#|this playMove "ApanPknlMstpSnonWnonDnon_G01"; };" or something along those lines. I feel like the problem isn't really a problem at all, I'm just missing something obvious or I'm still just completely unfamiliar with scripting in general. I have tried several things but I just can't seem to get it working. Anyone know what is wrong? Thanks in advance for the help (if anyone actually responds lol). -
sqs help, 1 error left (vtol/stol)
dr death jm posted a topic in ARMA 3 - MISSION EDITING & SCRIPTING
_vcl = _this select 0 _aID = _this Select 2 _vcl RemoveAction _aID _vtolOnID = _this Select 2 _vtolOffID = _this select 0 _vcl removeAction _vtolOnID _helpmsg = Format["HOW TO USE vtol\nIn options the keyboard keys which control the following moves will control vtol.\nMOVEUP - THRUST +\nMOVEDOWN- THRUST -\nMOVELEFT - ROTATE L\nMOVERIGHT - ROTATE R\nMOVEBACK - STOL BRAKE\nMOVEFAST - STOL TURBO"] _max = 15 karr_maxvtolSpeed = 200 ;;#vtolInit ?karr_vtol : karr_vtol = FALSE; PSOn = 0; _vtolOnID = _vcl addAction ["ACTIVATE VTOL","karr-vtol-On.sqs"]; _vtolOnID = _vtolOnID; exit ?!karr_vtol : karr_vtol = TRUE; PSOn = 1; hint _helpmsg; _vtolOffID = _vcl addAction ["DEACTIVATE VTOL","karr-vtol-On.sqs"] ;;#Waitforvtol ~0.1 ?IsNull Driver _vcl OR !Alive _vcl OR !Alive Driver _vcl : Goto "Finish" ;;hint "vtol on" #vtolLoop ;;hint format [" ProSphere Controller Lite\n\n X-Axis %1\n Y-Axis %2\n Z-Axis %3\n A-Axis %4\n B-Axis %5\n C-Axis %6\n\nTurbo?: %7\n\nPSOn: %8", PS select 0, PS select 1, PS select 2, PS select 3, PS select 4, PS select 5,vtolturbo,PSOn] ~.001 _x = PS Select 0 _y = PS Select 1 _z = PS Select 2 _a = PS Select 3 _b = PS Select 4 _c = PS Select 5 _xThrust = (velocity _vcl select 0) _yThrust = (velocity _vcl select 1) _zThrust = _max * _z #Lateral Thrust ?_x > 0 && _xThrust < +10 && _yThrust < +10 && Speed _vcl < +20 && Speed _vcl > -20 : _factor = _x*.1; _dir = GetDir _vcl; _xThrust = (_factor*(cos _dir))+(velocity _vcl select 0); _yThrust = (_factor*(sin _dir))+(velocity _vcl select 1); ?_x < 0 && _xThrust > -10 && _yThrust > -10 && Speed _vcl < +20 && Speed _vcl > -20 : _factor = _x*.1; _dir = GetDir _vcl; _xThrust = (_factor*(cos _dir))+(velocity _vcl select 0); _yThrust = (_factor*(sin _dir))+(velocity _vcl select 1); ;;hint Format["XThrust: %1\nYThrust: %2\nZThrust: %3",_xthrust,_ythrust,_zthrust] #Vertical Thrust ?_zThrust == 0 : _zThrust = -.30 #Rotation _rotation = 0 ?_c > 0 : _rotation = .4 ?_c < 0 : _rotation = -.4 _speed = [_xThrust,_yThrust,_zThrust] #STOL Turbo Brake ?_y < 0 AND Speed _vcl > 0 : _xThrust = (-.2*(sin getDir _vcl))+(velocity _vcl select 0); _yThrust = (-.02*(cos getDir _vcl))+(velocity _vcl select 1); _speed = [_xThrust,_yThrust,_zThrust] ?_y < 0 AND Speed _vcl <= 0 : _speed = [0,0,Velocity _vcl Select 2] ?!karr_vtol OR !Alive _vcl OR IsNull Driver _vcl : goto "vtolOff" ?(speed _vcl) < karr_maxvtolspeed AND (Fuel _vcl) > 0 : _vcl SetVelocity _speed ?(speed _vcl) < 80 : _vcl SetDir (GetDir _vcl) + _rotation ?jm_vtolturbo AND (Fuel _vcl) > 0 : Goto "vtolTurbo" Goto "vtolLoop" #vtolTurbo ~.001 ?(Fuel _vcl) > 0 AND (jm_vtolturbo) : _vcl SetVelocity _speed; _vcl SetFuel (Fuel _vcl) - .0003 ?(Fuel _vcl) > 0 AND (_z > 0) AND (Getpos _vcl Select 2 < 1) AND Speed _vcl > 10 : _vcl setvelocity [(velocity _vcl select 0),(velocity _vcl select 1),(velocity _vcl select 2) + _height];_wait = 3; _vcl SetFuel (Fuel _vcl) - .1 ?!jm_vtolturbo AND Alive _vcl AND !IsNull Driver _vcl : Goto "vtolLoop" ?!Alive _vcl || IsNull Driver _vcl || !Alive Driver _vcl || !karr_vtol : Goto "vtolOff" _fuelfactor = 0 _factor = .11 ?Speed _vcl > 300 : _factor = .35; _fuelfactor = .001 _xThrust = (_factor*(sin getDir _vcl))+(velocity _vcl select 0) _yThrust = (_factor*(cos getDir _vcl))+(velocity _vcl select 1) _zThrust = (Velocity _vcl Select 2) + .15 ?(Getpos _vcl Select 2) < 2 : _zThrust = Velocity _vcl Select 2 hint format["%1",_factor] _speed = [_xThrust,_yThrust,_zThrust] ?(Fuel _vcl > 0) : _vcl SetVelocity _speed; _vcl SetFuel (Fuel _vcl) - _fuelfactor Goto "vtolTurbo" #vtolOff PSOn = 0 karr_vtol = FALSE jm_vtolturbo = FALSE ?isNull _vcl || !Alive Driver _vcl : Goto "Finish" Exit #Finish _vtolOnID = FALSE _vtolOffID = FALSE Exit