Home   Help Search Login Register  

Author Topic: Chopper won't Domove if move-to position is over a certain distance away  (Read 1198 times)

0 Members and 2 Guests are viewing this topic.

firstflash

  • Guest
Can anyone give me advice on this problem:

using a simple script like this (test mission included):

_heli = _this select 0
_player = _this select 1

#loop
_heli domove (getpos _player select 0,getpos _player select 1)
? (_heli distance _player <100) : goto "end"
~.01
goto "loop"

#end
exit

(the problem)

if the player unit is fairly close to the heli start point, it works fine (around 400 - 600 meters)

But, put the player unit 1000 +meters away from the heli start point, the heli wont move.

(now, if you (as player) run towards the heli, it will move to your location as soon as u get within the 400-600 meter range)

WTF??????????

Does anyone know what could be causing this? (other than my not-so-good scripting skills)

« Last Edit: 26 Oct 2002, 23:36:10 by firstflash »

Offline mcnorth

  • Members
  • *
At first I thought "Hey, what's the problem?" Then I merged your sample to a bigger island and damn, no chopper! I don't have a clue why your script won't work beyond a certain distance. Hopefully someone that does will jump in here and offer an explanation. I did, however, work up a solution and attached it to save a bunch of typing. It's now a UH60 (so you can ride along) I added a game logic unit to serve as a dynamic waypoint. You may ask "Why's it upside down on the map?" and it's just habit to distinguish it from the triggers.

mcnorth

Offline Black_Feather

  • Former Staff
  • ****
  • I'll never forget you Daisey.
I didn't get a problem on desert island, you could change domove to move I don't know if it would help though.

CareyBear

  • Guest
I also tried your test mission and the chopper moved even though I put the player as far away as I could.. (water lapping at my ankles)

A useful trick for such occasions (observing something far away) is to create a repeating radio trigger with the following in the onActivation field

hint format ["X: %1\nY: %2\nZ: %3\nH: %4", (getpos heli select 0), (getpos heli select 1), (getpos heli select 2), (getDir heli)]

Then, hit the radio trigger.. it will tell you exactly where the heli is at the moment, and you can see immediately whether it is lifting off (rather than waiting around five minutes and then deciding it hasn't moved). All that matters in this case is whether the values are changing or not.

Oh, and you don't need a delay as short as ~0.01 in that script. Even ~5 or ~10 would be fine.
I don't know if using move instead of doMove will make any difference unless you have a group of helis (move makes a whole group move)

Cheers

Bremmer

  • Guest
I haven't tried your mission, but I have experienced similar problems with choppers not responding to move commands.

I have found that they only ignore move commands if they are grounded - if they are already flying then there are no problems. One idea that i just came up with (ie I haven't tested) is therefore to make the chopper take off before issusing the proper move command.

eg.

chopper move [getpos chopper select 0, getpos chopper select 1, 50]
@ unitready chopper
chopper move getpos player

Might be worth a try at least  :-\

firstflash

  • Guest
thanks for the input, i tried some of the above solutions:

1. Using Move (as opposed to domove)
While "domove" craps out between 400-1000 meters, "move" craps out around 4000-4500 meters. Beats me why.

2. I tried the liftoff prior to move command (still use it :) ), but it didnt affect the movement. In fact if im in a chopper that is airborne, the pilot (as part of my group) will tell me "CANT GET THERE" if i direct him to fly to a point 6000+ meters away.

3. Thanks for the check position trigger, VERY HANDY

The solution i came up with, and seems to be working, is to constantly figure a midpoint between the player and the heli. This way the heli continually updates (and moves to a position halfway between the player and the heli). Looks like this:

#Moveloop1
_helix = getpos _heli select 0
_heliy = getpos _heli select 1
_diffx  = ((getpos _player select 0) - (getpos _heli select 0))
_diffy  = ((getpos _player select 1) - (getpos _heli select 1))
_halfx = _diffx / 2
_halfy = _diffy / 2
_midx = _halfx + _helix
_midy = _halfy + _heliy
_heli move[_midx,_midy]
? (_heli distance _player) <500: goto "Moveloop2"
~5
goto "Moveloop1"

The moveloop2 section is the original move-to script and guides the chopper in for landing.

Thanks for all the input. Ill be submitting a Single-script dynamic air evac/taxi using this code in the next day or two for testing, check it out (it may actually work).

Then again... it might not.