Home   Help Search Login Register  

Author Topic: how to move a unit to a vehicle as close as possible?  (Read 585 times)

0 Members and 1 Guest are viewing this topic.

gundernak

  • Guest
I would like to MyUnit get played an anim(by playMove command - acting repair) at a vehicle as close as possible.

I moved MyUnit to the vehicle by:

              MyUnit commandMove position VehicleName.

But MyUnit does not move close enough to the vehicle to play the anim believable.

So how can I move him as close as possible?

Thanks in advance


m21man

  • Guest
Re:how to move a unit to a vehicle as close as possible?
« Reply #1 on: 03 Aug 2003, 21:46:43 »
Maybe:

MyUnit commandmove [getpos vehiclename select 0,(getpos vehiclename select 1)-5]

The -5 adjusts the coordinates to 5 meters behind the vehicle :).
« Last Edit: 03 Aug 2003, 21:49:50 by m21man »

gundernak

  • Guest
Re:how to move a unit to a vehicle as close as possible?
« Reply #2 on: 03 Aug 2003, 22:38:52 »
Thanks, I tested a lot, changing the value "-5" at the end of the line, best result is with 1. But unfortunatelly sometimes MyUnit goes as close as needed, but most of the times he doesn't.

other problem: how to set MyUnit's heading to the vehicle.

Because the anim played often to a different angle, not heading to the vehicle.

Offline Artak

  • The old beanbag shaker
  • Former Staff
  • ****
  • You want to talk about it, yes?
    • OFP Team Finlanders
Re:how to move a unit to a vehicle as close as possible?
« Reply #3 on: 03 Aug 2003, 22:44:29 »
I don't have an aswer to the first one but on the second one you could try either

myunit dowatch targetname       which makes him look at the target at all times
or
myunit setdir #          with the # being a number from 0 to 360. (degrees)
Not all is lost.

Offline Blanco

  • Former Staff
  • ****
Re:how to move a unit to a vehicle as close as possible?
« Reply #4 on: 03 Aug 2003, 23:08:35 »
maybe you can use the @ (wait until) and distance

@myunit distance vehiclename < 1
myunit playmove "repairanimthingy..."




Search or search or search before you ask.

gundernak

  • Guest
Re:how to move a unit to a vehicle as close as possible?
« Reply #5 on: 04 Aug 2003, 00:08:58 »
Ok solved! :)

The doWatch command helped a lot, I wrote it to the engineer's init field.

If the vehicle is a bigger one the situation works more accurate and you can believe the engineer is working on the vehicle. At the beginning I tryed this case with a Jeep, but with a Scud it's ok. ( fortunatelly I needed it for a Scud).

Thanks the hints ;)

If anyone (beginner beside me) interested:

TRIGGER_1: When the Scud dammaged a certain amount, the engineer moves inmediately to close to the vehicle.

Condition: this and damage SCUDNAME > 0.1 (or something)
On Act: ENGINEERNAME commandMove [getpos SCUDNAME select 0,(getpos SCUDNAME select 1)-1]


TRIGGER_2: And when the engineer is close enough he repairs the dammage.

Condition: this and ENGINEERNAME distance SCUDNAME < 7
On Act: ENGINEERNAME playMove "MedicToCombat"; SCUDNAME setDammage 0.1

This trigger needs about 6 sec delay to activate (countdown 6), because it makes the average timing correct. If the distance value is lesser then 7, the trigger should not be activated, because depending on circumstances the engineer closes the vehicle variable distances. Without delaying the engineer may act the anim too early.

It is important to set the doWatch command for the Engineer.