Home   Help Search Login Register  

Author Topic: Pilot Rescue Script  (Read 557 times)

0 Members and 1 Guest are viewing this topic.

Kilo11

  • Guest
Pilot Rescue Script
« on: 01 Jun 2004, 22:38:31 »
Alright Im making a mission with a downed pilot.  The whole "get there before the russians do" type.  I made a very simple script allowing for when any friendly unit reaches within 25 feet from the pilot, the pilot will join that closet unit, and for some reason it wont work.  Any unit that comes to the pilot....the pilot wont join !!! AHH...so tell me what is wrong with this:

Code: [Select]
;RESCUE.sqs by Hoot

_rescuer=[player,bravo]

_pilot=pilot

#check

~5

_dis=99999

{_d=_pilot distance (leader _x);if (_d<_dis) then {_dis=_d;_closest=_x}} foreach _rescuer

?_dis > 25:goto "check"

[_pilot] join _closest

exit


If anyone could jsut tell me what is wrong, and mabey make an example mission or soemthing or exact directions w/e. Help is appreciated! THANK YOU!


-=Kilo=-

Kilo11

  • Guest
Re:Pilot Rescue Script
« Reply #1 on: 02 Jun 2004, 02:03:40 »
Anyone :-(.....


-=Kilo=-

CrashnBurn

  • Guest
Re:Pilot Rescue Script
« Reply #2 on: 02 Jun 2004, 04:05:52 »
try changing the last line to -

[_pilot] join (leader _closest)

so that he joins the group of the closest soldier. If the rest of your syntax is correct it should work. If all the rescuers are individuals and not part of a group then I don't know whats wrong...must be syntax.

Offline macguba

  • Former Staff
  • ****
    • macguba's operation flashpoint page
Re:Pilot Rescue Script
« Reply #3 on: 02 Jun 2004, 08:20:58 »
{_d=_pilot distance (leader _x);if (_d<_dis) then {_dis=_d;_closest=_x}} foreach _rescuer

It may just be my ignorance, but won't ; in the middle make the second and third bits just notes, not active code?

Also, _rescuer has only two elements.   If you're only trying to check two distances you could do it simply and seperately.  
Plenty of reviewed ArmA missions for you to play

Offline alimag

  • Contributing Member
  • **
  • I'm a llama!
Re:Pilot Rescue Script
« Reply #4 on: 02 Jun 2004, 14:52:11 »
Hi,

You cant initialize a variable inside an IF statement.

_closest need to be initialize before the if statement.

Just give it a value at the beginning of the script.

Cheers
« Last Edit: 02 Jun 2004, 14:53:13 by alimag »