My attempt at a script to make my own dynamic transport or map-click transport. Remember im very new to this and from my research this is what ive made up. I dont want to use the BI function/sec ops etc i want to script it for learning purposes.
I have a mission with these;
1. Helicopter named chopper.
2. Trigger, radio alpha activated repeated. It's on act is nul=[] execVM "scripts\heli\dt.sqf";
3. H Pad named pad.
4. Invisible H Pad named loc.
5. My player named toks.
6. Marker named LZ.
dt.sqf is
//call chopper commands
dt=true;
titleText ["Indicate LZ on map by map-click","PLAIN DOWN"];
onMapSingleClick "loc setPos _pos;dt=false";
waitUntil {!dt};
"lz" setMarkerPos getPos loc;
chopper move getPos loc;
//land chopper commands
player assignAsCargo chopper;
waitUntil {chopper distance loc < 180};
chopper land "GET IN";
waitUntil {player in chopper};
nul=[] execVM "scripts\heli\repeat.sqf";
repeat.sqf is
//repeat
repeat=true;
titleText ["Indicate LZ on map by map-click","PLAIN DOWN"];
onMapSingleClick "loc setPos _pos;repeat=false";
waitUntil {!repeat};
"lz" setMarkerPos getPos loc;
chopper move getPos loc;
nul=[] execVM "scripts\heli\drop.sqf";
drop.sqf is
//drop off commands
waitUntil {chopper distance loc < 180};
chopper land "GET OUT";
unassignVehicle toks;
waitUntil {!(player in chopper)};
chopper move getpos pad;
//chopper return to base commands
waitUntil {chopper distance pad < 180};
chopper land "LAND";
Okay BUT THERES PROBLEMS.
1. Helicopter comes to my map-click, starts landing to its hover point then as soon as its near the ground it starts climbing again and then just hovers high above me. It (the helicopter) doesnt listen to my waitUntil commands...
2. I tried to use chopper land "LAND"
and i found sometimes the chopper actually lands and waits, sometimes it wont. Its all just too stressfull and inconsistant! During these times it does wait if my player jumps on it actually continues with the script, i click on my next destination and it moves there and goes to land but it then has another problem it wont wait for me to get out! AAAHHHH!!!
Is this a bug in the game engine or is it my bad ammature scripting??