OFPEC Forum

Editors Depot - Mission Editing and Scripting => ArmA - Editing/Scripting General => Topic started by: SaBrE on 16 Mar 2007, 21:36:47

Title: Domove Near Driver
Post by: SaBrE on 16 Mar 2007, 21:36:47
I can't think of a totally appropriate title :/

Well I have a man who I want to domove near the [dead] driver of a vehicle.

So far I've had the driver die and swerve off the road, now I want man1 to walk over to the driver's side of the car and look at the dead driver, civ1. I've tried man1 domove getpos civ1 but man1 just goes near the centre of the car rather than actually to the driver.

I've also tried using setpos H (invisible)  to the driver's position after he's dead and stationary but again the game thinks that civ1 is in the centre of the car. 

How can I get the coordinates of the car and create a script so that I can find the driver's side of the car? Sorry if it's not clear what I mean- I'm finding it difficult to articulate it. See the pic below for what I mean:

(http://img.photobucket.com/albums/v625/sabre_fett/problem-1.jpg)

So what I want is whatever direction the car's facing, man1 always moves to the outside of the driver's side of the car.

Thanks in advance,

Sabre
Title: Re: Domove Near Driver
Post by: D_P_ on 17 Mar 2007, 04:00:01
Dunno if this is what you were going for, it will send man1 to the driver's side door, however he might run thru the car on his way to the driver... so you need to position  man1 so that he doesn't have to run around the car.  In other words he needs to approach the vehicle from the driver's side.

Code: [Select]
man1 domove [(getpos civ1 select 0) + 0, (getpos civ1 select 1) - 1, (getpos civ1 select 2) + 0];
You'll proberly need to add setdir and dowatch after he arrives.
Hope this helps, i'm no expert. 

Nice diagram btw!!! :good:
 
Title: Re: Domove Near Driver
Post by: SaBrE on 17 Mar 2007, 13:35:40
Hehe ;) Thanks a lot for the help, I'll try it out.
Title: Re: Domove Near Driver
Post by: Cheetah on 17 Mar 2007, 13:42:16
If that doesn't work (because for every angle, the x and y corrections have to be different as far as I know), you might want to start using the sinus and cosinus to calculate the position to move the soldier to.
Title: Re: Domove Near Driver
Post by: SaBrE on 17 Mar 2007, 14:02:39
What like:

Code: [Select]
man1 domove [(getpos civ1 select 0) + (2*sin(getdir civ1 - 45)), (getpos civ1 select 1) + (2*cos(getdir civ1 - 45))];
(Modified from Hoz's excellent DoFollowUnit script.)

I fiddled about with the numbers a bit and I think this works adequately enough :) I'll try yours, too D_P_ to see if it gives better results :)