Home   Help Search Login Register  

Author Topic: Chopper evac, need help  (Read 1352 times)

0 Members and 1 Guest are viewing this topic.

1stJemHadar

  • Guest
Chopper evac, need help
« on: 04 Dec 2002, 01:37:34 »
Hi.

When all the mission goals are completed I want an evac chopper to appear. I use the radio to trigger the evac script. The chopper comes, but it doesn't stop. It just fly past me. Why is that?

Here's the script:
Quote
;Evac chopper move to the evac point
Rescue1 DoMove GetMarkerPos "Rescue"

;Player & Second join the chopper pilot's team.
[Hero, Hero2] join Rescue1
Hero assignAsCargo Rescue1
Hero2 assignAsCargo Rescue1

;Order us to enter the chopper. Land.
[Hero, Hero2] orderGetIn true
Rescue1 land "Get In"

;Check if my second is alive
?(alive Hero2) : goto "wait2"

;Wait until we're inside
#Wait
?(Hero in Rescue1) && (Hero2 in Rescue1): goto "Leave"
~4
goto "Wait"

#Wait2
?(Hero in Rescue1) : goto "Leave"
~4
goto "Wait2"

;Leave the evac point (end the mission. Not done from here)
#Leave
TitleText ["Let's get out of here!!", "Plain"]
Rescue1 DoMove GetMarkerPos "Escape"
Exit

Thanks.

Offline Ranger

  • Members
  • *
  • Hoo-ah!
Re:Chopper evac, need help
« Reply #1 on: 04 Dec 2002, 20:21:14 »
Is there a reason that you cannot use waypoints to accomplish this?  It might be easier.

In any case, I'm guessing that your Hero and Hero2 units are player-controlled.  If so, you don't need to make them join Rescue1, and you do not need to use the assignAsCargo and orderGetIn commands since the players will be doing that on their own.  These are just ideas to cut out excess in your script.

Regardless, one problem could be because you tell the chopper to land *immediately* when the script is run, instead of telling it to land when it reaches the marker "Rescue".  You need to add a delay of some kind to wait for the chopper to reach the marker before ordering it to land.  The chopper probably lands the moment the script is run, and then takes off to fly to the marker.

Below is my revised version of your code that will hopefully work.  I haven't tested it, so there's no guarantee.  If it doesn't work, post again and I'll give other ideas.

Code: [Select]
;Evac chopper move to the evac point
Rescue1 DoMove GetMarkerPos "Rescue"

; Wait until the chopper, Rescue1, gets within 50 meters of
; the marker, Rescue, before continuing with the script.

@ Rescue1 distance Rescue < 50

Rescue1 land "Get In"

; Wait until Hero and Hero2 are in the chopper.  Also continue
; if both are dead.

@ (Hero in Rescue1 or not alive Hero) and (Hero2 in Rescue1 or not alive Hero2)

; Leave the evac point (end the mission. Not done from here)

TitleText ["Let's get out of here!!", "Plain"]

Rescue1 DoMove GetMarkerPos "Escape"

Exit

I'm not 100% sure if you can refer to a marker as an object when checking distance, so if that doesn't work, if you can, put an object there instead, such as a gamelogic.

Actually, I'm going to guess that you cannot refer to a marker as an object in this manner.  So, you'll probably have to replace the marker with a gamelogic and name the gamelogic appropriately.  If you originally used a marker so that the players can see it on the map, then leave the marker, but also put a gamelogic at the same place.

Good luck!
« Last Edit: 04 Dec 2002, 20:31:12 by Ranger »
Ranger

1stJemHadar

  • Guest
Re:Chopper evac, need help
« Reply #2 on: 04 Dec 2002, 23:47:27 »
Thanks :)
I tried it (both with and without a gamelogic named "Rescue"), the chopper still doesn't land. It just flies past me, the gamelogic and the marker, without landing. An extremely rude pilot ;)

Offline Ranger

  • Members
  • *
  • Hoo-ah!
Re:Chopper evac, need help
« Reply #3 on: 05 Dec 2002, 00:18:08 »
Funny. :)

Try the following code instead, then:

Code: [Select]
;Evac chopper move to the evac point
Rescue1 DoMove GetMarkerPos "Rescue"

; Wait until the chopper, Rescue1, gets within 50 meters of
; the marker, Rescue, before continuing with the script.

@ Rescue1 distance Rescue < 50

; Make the helicopter land.

Rescue1 flyInHeight 0

; Wait until Hero and Hero2 are in the chopper.  Also continue
; if both are dead.

@ (Hero in Rescue1 or not alive Hero) and (Hero2 in Rescue1 or not alive Hero2)

; Leave the evac point (end the mission. Not done from here)

TitleText ["Let's get out of here!!", "Plain"]

; Make the helicopter lift off.

Rescue1 flyInHeight 30

Rescue1 DoMove GetMarkerPos "Escape"

Exit

Again, change the Rescue1 distance Rescue < 50 code as appropriate for whatever you named your gamelogic.

Edit: Never mind.  I see that you said you named your gamelogic Rescue, so you can leave the code as is, then.
« Last Edit: 05 Dec 2002, 00:35:26 by Ranger »
Ranger

1stJemHadar

  • Guest
Re:Chopper evac, need help
« Reply #4 on: 08 Dec 2002, 16:12:45 »
Sorry for not responding earlier, I've been somewhat busie with school work.

Anyway, I've tested the new script, and the pilot still doesn't land the chopper. He does slow down, though. But then he accelerate again and dissappear into the horizon.  
I don't understand this, I've neved had any problems geting a chopper to land earlier, just on this mission.
This is very odd...
Perhaps I should try the scripts on anohter mission and see if they work there. Not that I can think of a reason why they would work on one mission but not on another, but who knows... computers are strange machines :-\

Well, thanks again for your help!! Even though it still doesn't work, I've learned a few tricks to use in other scripts  :)

Offline Ranger

  • Members
  • *
  • Hoo-ah!
Re:Chopper evac, need help
« Reply #5 on: 09 Dec 2002, 19:36:20 »
No problem at all.  I don't know why that wouldn't work, either.  When I use the chopper flyInHeight 0 trick with waypoints, it always works for me.  Of course, yours is with a script, but I would think that the chopper would still be forced to land (fly at a height of 0).

Maybe you can try the following experimental code instead:

Code: [Select]
;Evac chopper move to the evac point
Rescue1 DoMove GetMarkerPos "Rescue"

; Wait until the chopper, Rescue1, gets within 50 meters of
; the marker, Rescue, before continuing with the script.

@ Rescue1 distance Rescue < 50

; Make the helicopter land.

Rescue1 flyInHeight 0

; The following code forces the helicopter to descend until
; it is below 1 meter in altitude.

while "(getPos Rescue1 select 2) > 1" do {Rescue1 setVelocity [(Rescue1 velocity) select 0, (Rescue1 velocity) select 1, -5]}

; Wait until Hero and Hero2 are in the chopper.  Also continue
; if both are dead.

@ (Hero in Rescue1 or not alive Hero) and (Hero2 in Rescue1 or not alive Hero2)

; Leave the evac point (end the mission. Not done from here)

TitleText ["Let's get out of here!!", "Plain"]

; Make the helicopter lift off.

Rescue1 flyInHeight 30

Rescue1 DoMove GetMarkerPos "Escape"

Exit

For the while loop, I don't know if -5 is a safe descending velocity for the helicopter--I just chose an arbitrary number.  If it's too fast, then reduce it.  For all I know, the chopper might slam really fast into the ground and destroy itself.  Or, it might even be too slow, so you can increase it.

I don't know if the chopper will stay on the ground once it has landed, but it's an experiment you can try.

Good luck!
Ranger

mr. lightswitch

  • Guest
Re:Chopper evac, need help
« Reply #6 on: 11 Dec 2002, 14:59:04 »
why don't u use waypoints instead of script:

place a waypoint "load" where u want the heli to pick u up.
place a waypoint "Get In" for u and ur men near it and syncronise them (F5). then place them over one another. then carry on with ur mission.  :)

Offline Ranger

  • Members
  • *
  • Hoo-ah!
Re:Chopper evac, need help
« Reply #7 on: 11 Dec 2002, 19:19:10 »
Probably because he wants dynamic waypoints.  I have a feeling that he doesn't know ahead of time where the players will be when they finish their mission.  At least, that's what I gather from his description.
Ranger

mr. lightswitch

  • Guest
Re:Chopper evac, need help
« Reply #8 on: 12 Dec 2002, 14:47:22 »
the  why not place a switch trigger over the evac point or near it to activate the evac ???

Azraell

  • Guest
Re:Chopper evac, need help
« Reply #9 on: 12 Dec 2002, 20:04:33 »
use an invisible helo pad  instead of a logic or marker....the helo will recognize it as a legit landing object, have the helo land when its 50 or so away from pad, try  helo  land "get in"....just got done with a helo evac of my own.... works fine for me... just waiting for ppl to test in beta script forums

Offline Ranger

  • Members
  • *
  • Hoo-ah!
Re:Chopper evac, need help
« Reply #10 on: 12 Dec 2002, 22:04:13 »
@ Mr. Lightswitch: We'll have to wait for 1stJemHadar to clear up the situation, but I'm under the impression that he wants a dynamic evacuation, which means that you cannot place a trigger near the evacuation zone, since you won't know where the zone will be.  It all depends on where the player goes by the end of the mission.

@Azraell: Great idea about the H.  I forgot about those!  That could indeed by what is missing for the chopper to land.

Therefore...

@1stJemHadar: Try putting an invisible H anywhere, and give the object a name.  Then, in your script that orders the chopper to move to the player's location, also move the H there, too.  Use the chopper land "Get In" command, and see if the chopper will land on the H.
Ranger