6thStorm 0 Posted October 3, 2007 I have made this script but im having some problems with getting the chopper to land. <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">if (isServer) exitwith {}; _group = _this select 0 _chopper = _this select 1 _height = _this select 2 _pos = _this select 3 _minheight = 2 ; ----------------------------------- ; Call with [group,chopper,height to fly in,gamelogic waypoint] exec "land_chopper.sqs" ; Add a 2nd gamelogic where chopper will move to after unloading and call it dest3 ; ----------------------------------- _pilot = driver _chopper _chopper flyinHeight _height _chopper doMove [getPos _pos select 0, getPos _pos select 1, _height] #start ? (_chopper distance _pos < 10): goto "Land" ~1 goto "start" #Land _chopper flyinheight _minheight * 2 @((getpos _chopper select 2)<2):goto "Unload" #Unload {_x action ["GETOUT", _chopper];unassignVehicle _x} forEach units _group player action ["GETOUT", _chopper] if not (_group in (crew _chopper)) then {goto "MoveOn"} ;when all are out #MoveOn _chopper doMove [getPos dest3 select 0, getPos dest3 select 1, 50] ? (_chopper distance dest3 < 10):goto "End" #End deletevehicle _chopper deletevehicle _pilot exit Hope someone can see what im doing wrong. It's one of my first scripts so im pretty sure im doing it a little wrong. Â Share this post Link to post Share on other sites
silola 1086 Posted October 4, 2007 hi, try this sqf-script (Not tested, no possibility for the moment): <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">/////////////////////////////////////////////////////////////////////////////////////// // [group,chopper,height to fly in,gamelogic waypoint] execVM "land_chopper.sqf" // ///////////////////////////////////////////////////////////////////////////////////// private ["_group","_chopper","_crew","_height","_pos","_pilot","_minheight","_run","_go","_i"]; _group = _this select 0;_chopper = _this select 1;_height = _this select 2; _pos = _this select 3;_minheight = 2;_run = 1;_go = true;_i = 0;_crew = []; if (!(isServer)) then { while {_run > 0} do { switch (_run) do { case 1: { // #start _chopper flyinHeight _height;_chopper doMove _pos; while{_go} do { if((!(alive _pilot)) || (!(canmove _chopper)) || ((getdammage _chopper) == 1)) then { _run = 5;_go = false; } else { if(([(position _chopper select 0),(position _chopper select 1),0] distance _pos) < 25) then { _run = 2;_go = false; } else { sleep 1; }; }; }; }; case 2: { // #Land _chopper flyinheight _minheight * 2;_go = true; while{_go} do { sleep 1; if((!(alive _pilot)) || (!(canmove _chopper)) || ((getdammage _chopper) == 1)) then { _run = 5;_go = false; } else { if((position _chopper select 2) < 2) then {_run = 3;_go = false}; }; }; }; case 3: { // #Unload {unassignVehicle _x;[_x] ordergetin false} forEach units _group;player action ["GETOUT", _chopper];_go = true; while{_go} do { sleep 1; if(({((alive _x) && (_x in _chopper))} count units _group) == 0) then {_run = 4;_go = false}; }; }; case 4: { // #MoveOn _chopper doMove position dest3; while{_go} do { if((!(alive _pilot)) || (!(canmove _chopper)) || ((getdammage _chopper) == 1)) then { _run = 0;_go = false; } else { if(([(position _chopper select 0),(position _chopper select 1),0] distance dest3) < 25) then { _run = 6;_go = false; }; }; }; }; case 5: { // #Alert _crew = crew _chopper; while{_i < count _crew} do { _man = _crew select _i; if(!(alive _man)) then { _i = _i + 1; } else { _man action ["EJECT",_chopper];unassignvehicle _man;_i = _i + 1; sleep 0.5; }; }; _run = 0; }; case 6: { // #End deletevehicle _chopper;deletevehicle _pilot;_run = 0; }; Default{}; }; }; }; Sorry, formatting is not represented correctly I do not know why bye Silola Share this post Link to post Share on other sites
6thStorm 0 Posted October 4, 2007 Thx Silola but id rather stick to .sqs for now. If i can conquer this i might be good enough to move on. Im gonna save ur script to use if everything fails and noone else has the slightest idea what is wrong. Should be impossible though since the most pros are lurking in this forum. Share this post Link to post Share on other sites
silola 1086 Posted October 4, 2007 hi, what exactly is your prob ? The helicopter does not want to land? The crew does not want to get out? The helicopter does not move on? first try this: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">?(([(position _chopper select 0),(position _chopper select 1),0] distance _pos) < 25):goto "Land" bye Silola Share this post Link to post Share on other sites