Jump to content
Sign in to follow this  
mantls

Undefined Variable

Recommended Posts

Have to say i'm a bit confused.

I have this (chunk of) code:

case "Eliminate HVT":
{
 private ["_officer"];
 _mrk = activeMarkers call bis_fnc_selectRandom;
 _mrkPos = getMarkerPos _mrk;
 _rndPos = [_mrkPos, 0, 75, 3, 0, 20, 0] call BIS_fnc_findSafePos;

 _oGrp = createGroup EAST;
 _officer = "O_officer_F" createUnit [_rndPos,_oGrp];
 //_officer setVehicleVarname "HVT";
 nul = [leader _oGrp, _mrk, "spawned", "showmarker"] execVM "scripts\UPSMON.sqf";
        "sideMarker" setMarkerPos _mrkPos;
 "sideMarker" setmarkerText "Eliminate HVT";	

waitUntil {!isNil _officer && !alive _officer};
hint "Success";

};


And i'm getting a constant error message about the _officer being an undefinded variable in the waitUntil part.

However, to my knowledge it is defined? Any help is much appreciated!

cheers

Share this post


Link to post
Share on other sites
_officer = "O_officer_F" createUnit [_rndPos,_oGrp];

createUnit in this form does not return a value. You will need to use the other form createUnit ARRAY.

Share this post


Link to post
Share on other sites

oh really? :D been ranting for at least an hour...

i'll give it a try. But yeah should've known from the Wiki/Biki...

Thank you^^

Share this post


Link to post
Share on other sites

and with isNil you must supply either a string with the name of the variable or a code . and also you should use lazy evaluation.

waituntil {! isNil "_officer" && {!alive _officer}};

otherwise it would try !alive _officer even if it is nil.

read the two example in here https://community.bistudio.com/wiki/a_%26%26_b

it looks basic, but it is interesting.

Share this post


Link to post
Share on other sites

yeah, already got that out. That was a result of me getting desperate^^.

Share this post


Link to post
Share on other sites
yeah, already got that out. That was a result of me getting desperate^^.

lol

it does remind me, myself sometime ...

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×