Forum Jump :

Author Message


Posts: 29
Rank:


Level: Member

Country: au
Location:
Occupation:
Age:
In-game name:

 
#1 Posted at 2016-02-04 03:14        
     
Hi there, I have a mission that calls in a chopper extract when a certain time is reached. Im just testing the script in the editor at the moment. I cannot seem to get the helicopter to land at the waypoint (I have the "extractionpoint" marker on top of an invisible helipad. Can anyone see what is wrong?

_hgrp = creategroup WEST;
_heli = createvehicle ["CUP_B_UH1Y_UNA_USMC", getmarkerpos "helispawn", [], 50, "FLY"];

_pilot = _hgrp createunit ["B_Helipilot_F", getmarkerpos "helispawn", [], 50, "CAN COLLIDE"];
_pilot setRank 'PRIVATE';

_copilot = _hgrp createunit ["B_helicrew_F", getmarkerpos "helispawn", [], 50, "CAN COLLIDE"];
_copilot setRank 'PRIVATE';

_pilot moveindriver _heli;
_copilot moveinany _heli;

_hgrp setspeedmode "NORMAL";
_heligrp setbehaviour "CARELESS";

_evac = _hgrp addwaypoint [getmarkerpos "extractionpoint", 0];
[_hgrp, 0] setWaypointType "GetIN";

// waituntil {HAVENT DECIDED WHAT TO WAIT FOR YET};

_flyaway = _hgrp addwaypoint [getmarkerpos "flyto", 1];
[_hgrp, 1] setWaypointType "MOVE";


Author Message


Posts: 176
Rank:


Level: Member

Country: pl
Location:
Occupation:
Age:
In-game name:

 
#2 Posted at 2016-02-04 08:51        
     
//-->Server side only
if (!isServer) exitWith{};
_hgrp = creategroup WEST;
_heli = createvehicle ["CUP_B_UH1Y_UNA_USMC", getmarkerpos "helispawn", [], 50, "FLY"];

_copilot = _hgrp createunit ["B_helicrew_F", getmarkerpos "helispawn", [], 50, "CAN COLLIDE"];
_copilot setRank 'PRIVATE';

_pilot moveindriver _heli;
_copilot moveinany _heli;

_hgrp setspeedmode "NORMAL";
_heligrp setbehaviour "CARELESS";

_evac = _hgrp addwaypoint [getmarkerpos "extractionpoint", 0];
[_hgrp, 0] setWaypointType "MOVE";


//-->Add action
//->Manage
[[[_heli],{
 private _heli = _this select 0;
 private _actionTxt = format["<t color='%1'>%2</t>",#FFA500e,"GO!"];
 private _actionFnc = { (_this select 0) setVariable ["heliWait_status",1,true]; };
 private _actionId = _heli addAction [_actionTxt,_actionFnc,nil,6,true,true,"","_this in _target && (_target getVariable  ['heliWait_status',0] ) == 2"];
		
 //->Remove action
 waitUntil {
  private _heliStatus  = _heli getVariable["heliWait_status",0]; 
  _heliStatus == 1
 };
 _heli removeAction _actionId;
}],"BIS_fnc_spawn",true] call BIS_fnc_mp; 

//-->Manage landing
private _wpState = "(vehicle this) land 'LAND'";
_evac setWaypointStatements ["true", _wpState]; 
private _wPos = waypointPosition _evac;
private _pickLz = createVehicle ["Land_HelipadEmpty_F", _wPos, [], 0, "NONE"];
waitUntil {
  (getPos _heli select 2) < 5 && (speed _heli) < 15
};
_heli flyInHeight 2;
_heli land "NONE";
_heli limitSpeed 0;
_heli setVariable ["heliWait_status",2,true];

waitUntil {
   private _status  = _heli getVariable["heliWait_status",2];
   _status == 1
};
_heli limitSpeed 999;
deleteVehicle _pickLz;

_flyaway = _hgrp addwaypoint [getmarkerpos "flyto", 1];
[_hgrp, 1] setWaypointType "MOVE";

Heli will go to first waypoint and hoover low over ground. When player will get in into heli he will have action under scroll named "GO!" to order heli take off. You can delete invisible helipad from editor, script is spawning it/deleting when needed.

"Speed coding", not tested, but should work (if i dont make any typo)

This post was edited by bp.sushi (2016-02-04 09:39, 624 days ago)


Advertisement


Author Message


Posts: 29
Rank:


Level: Member

Country: au
Location:
Occupation:
Age:
In-game name:

 
#3 Posted at 2016-02-10 03:12        
     
Unfortunately the helicopter is still hovering above the supposed landing position :(

Added 52 minutes later:

Ok the helicopter lands which is great! Now setting it up so once a hostage is in the chopper it is extracted :D
_landpos = getmarkerpos "extractionpoint";
_flyto = getmarkerpos "flyto";

_hgrp = creategroup WEST;
_heli = createvehicle ["CUP_B_UH60L_Unarmed_US", getmarkerpos "helispawn", [], 50, "FLY"];

_pilot = _hgrp createunit ["B_helicrew_F", getmarkerpos "helispawn", [], 50, "CAN COLLIDE"];
_pilot setRank 'PRIVATE';

_copilot = _hgrp createunit ["B_helicrew_F", getmarkerpos "helispawn", [], 50, "CAN COLLIDE"];
_copilot setRank 'PRIVATE';

_pilot moveindriver _heli;
_copilot moveinany _heli;

_hgrp setspeedmode "NORMAL";
_hgrp setbehaviour "CARELESS";

_evac = _hgrp addwaypoint [_landpos, 10];
_evac setWaypointType "MOVE";
_evac setWaypointStatements ["true", "(vehicle this) LAND 'GET IN';"]; 

waitUntil {hostage in _heli};


_leave = _hgrp addwaypoint [_flyto, 10];
_leave setWaypointType "MOVE";
_leave setWaypointStatements ["true", "(vehicle this) LAND 'LAND';"]; 

This post was edited by danjoo (2016-02-10 04:19, 618 days ago)


Author Message


Posts: 1189
Rank:


Level: Member

Country: tr
Location:
Occupation: Computer Science student
Age: 20
In-game name: Wak

 
#4 Posted at 2016-02-10 04:09        
     
I think you need the heli to have a "LOAD" waypoint, and not a "GETIN" waypoint. Also the first number parameter in addWaypoint isn't index, it's radius (wiki). Waypoint types are "MOVE" by default and their speed is also normal. Also createVehicleCrew is really helpful when you need to spawn vehicles from scripts.

_heli = createVehicle ["CUP_B_UH1Y_UNA_USMC", getMarkerPos "helispawn", [], 50, "FLY"];
createVehicleCrew _heli;

_hgrp = group (driver _heli);
_hgrp setBehaviour "CARELESS";

_evac = _hgrp addwaypoint [getMarkerPos "extractionpoint", 0];
_evac setWaypointType "LOAD";
_evac setWaypointStatements ["", "doStop (vehicle this); (vehicle this) land 'GET IN'"];

// waituntil {HAVENT DECIDED WHAT TO WAIT FOR YET};
//Try this: waitUntil {{_x in _heli} count units player == count units player};

_flyaway = _hgrp addwaypoint [getMarkerPos "flyto", 0];

Sometimes I like to think as I started the whole "earplugs" thing.

W0lle: The only advice I can give you is: Do not try to understand BI. You will not succeed and it only makes your brain go boom. I would even go so far and say that not even they understand their own actions :-D.

#define getDamage getDammage

Author Message


Posts: 29
Rank:


Level: Member

Country: au
Location:
Occupation:
Age:
In-game name:

 
#5 Posted at 2016-02-10 07:27        
     
I'm trying to terminate the script timer early when a player/hostage is in the chopper. I want to do this either externally in another script or within the timer script itself. Currently when i use the exitwith{} command inside the while loop, the loop just plays once then exits. If its on the outside, nothing happens, and the timer keeps going. Heres what I have

private "_time2";
_time2 = _this select 0;


// while player !in _heli do
while {_time2 > 0} do {
	_time2 = _time2 - 1;  
	hintSilent format["Time 'Till Dust Off: \n %1", [((_time2)/60)+.01,"HH:MM"] call BIS_fnc_timetostring];
	
// IF THE IF STATEMENT IS HERE THE Exitwith completes the loop straight away
	if (_time2 == 0) then {
	//Mission Fail
	};
	sleep 1;
};

if (player in _heli) exitWith{}; //It does nothing here

I've also tried terminating the timer script from the helicopter script but that doesnt work. There is very little information on the terminate script
waitUnitl (player in _heli);
terminate []execVM "Timer.SQF";


Author Message


Posts: 176
Rank:


Level: Member

Country: pl
Location:
Occupation:
Age:
In-game name:

 
#6 Posted at 2016-02-10 08:40        
     
You have to translate it, it was made for my mission and its working.
Not EXACTLY what you want, but you can use it as reference.
Demo:
MIRROR 1 (GoogleDrive)

This post was edited by bp.sushi (2016-02-10 08:47, 618 days ago)