Jump to content
Sign in to follow this  
gopgop

Tell the play to get in the vehicle though a script and give him a time limit

Recommended Posts

I'm a novice at scripting and I tried doing what the title says this is what I came up with:

Whats wrong with it?

if (alive Heli1) then {
   task1 = player createSimpleTask ["Get into the KA-60"];
task1 setTaskState "Assigned";
player setCurrentTask task1;

   _wp = (group group1) addWaypoint [position player, 1];
   [_wp, 1] setWPPos (position Heli1);
   [_wp, 1] setWaypointType "GETIN";
(group group1) setCurrentWaypoint [_wp, 1];

hint "|||||| MISSION ||||||\n Get into the KA-60";

_time = 0;
while(_time < 30) do {
   [_wp, 1] setWPPos (position Heli1);
   hint format["|||||| MISSION ||||||\n Get into the KA-60\n %1 : 30 seconds left",_time];
   if (player in Heli1) then {
      	hint "|||||| MISSION ||||||\n Completed Good job!";
   };
   _time = _time + 1;
   sleep 1;
};
       if (!(player in Heli1)) then {
             hint "|||||| MISSION ||||||\nFailed. Good luck next time!";
       };
};

Thanks for the help!

Share this post


Link to post
Share on other sites

'while' conditions require curly brackets

try:

if (alive Heli1) then {
hint "|||||| MISSION ||||||\n Get into the KA-60";

_time = 0;
while{_time < 30} do {
   hintSilent format["|||||| MISSION ||||||\n Get into the KA-60\n %1 : 30 seconds left",_time];
   if (player in Heli1) exitWith{
      	hint "|||||| MISSION ||||||\n Completed Good job!";
   };
  _time = _time + 1;
   sleep 1;
};
if (!(player in Heli1)) then {
	  hint "|||||| MISSION ||||||\nFailed. Good luck next time!";
};
};

The first hint wont be visible though like this without a short sleep before the while loop.

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  

×