OFPEC Forum

Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: Wildebeest on 03 Oct 2005, 08:34:52

Title: "Tail" behind a vehicle?
Post by: Wildebeest on 03 Oct 2005, 08:34:52
I would like an object to act as a "tail" on a vehicle.

Unfortunately, this is the best I've come up with:

Code: [Select]
#loop

tail setdir getdir vehicle

tail setPos [(getPos vehicle select 0) - 1.2, (getPos vehicle select 1) + 1.2, 0]

~0.05

goto "loop"

The only problem with this little script is that the "tail" does not stay behind the vehicle. I know why: the "setPos [(getpos..." line only puts the "tail" like north, south, west or east of the vehicle.

Now, how can I make the "tail" stay behind the vehicle regardless of what direction the vehicle is facing?

Thanks
Title: Re:"Tail" behind a vehicle?
Post by: macguba on 03 Oct 2005, 12:20:56
IIRC there is a trailer script in the Editors Depot.  That might be adaptable to suit your purposes, or even solve the problem directly.
Title: Re:"Tail" behind a vehicle?
Post by: Blanco on 03 Oct 2005, 12:23:39
Somtin like this?


Code: [Select]
_unit = _this select 0
_tail = _this select 1
;distance in rear of vehicle
_dist = -5

#loop
_Xpos = (getpos _unit select 0)+(sin (getdir _unit)*_dist)
_Ypos = (getpos _unit select 1)+(cos (getdir _unit)*_dist)
_tail setpos [_Xpos,_Ypos,(getpos _unit select 2)]
_tail setdir getdir _unit
?! alive _unit : Exit
~.01
goto "loop"

Title: Re:"Tail" behind a vehicle?
Post by: Wildebeest on 03 Oct 2005, 12:45:49
I tried the attach script in the editors depot and it worked very well. I just had to change + into - to place the object behind the vehicle.

Code: [Select]

_xa = 0
_ya = - 2
_za = 0

_unit setpos [(getpos _kidnapper select 0) -((((_xa^2)+(_ya^2))^0.5) * sin (getdir _kidnapper)), (getpos _kidnapper select 1) -((((_xa^2)+(_ya^2))^0.5) * cos  (getdir _kidnapper)), (getpos _kidnapper select 2) +_z]

Thanks guys, topic solved
Title: Re:"Tail" behind a vehicle?
Post by: bedges on 03 Oct 2005, 17:54:01
if so then you may wish to press the (http://www.ofpec.com/yabbse/YaBBImages/solve.gif) button...  ;)
Title: Re:"Tail" behind a vehicle?
Post by: The-Architect on 03 Oct 2005, 18:01:47
Wait a minute before solving this. Totally off topic but what does IIRC mean?
Title: Re:"Tail" behind a vehicle?
Post by: Wildebeest on 03 Oct 2005, 19:26:23
LOL I forgot to press it.. hehehe... IIRC means Interactive Illinois Report Card or Image and Identity Research Collective... I dunno..
Title: Re:"Tail" behind a vehicle?
Post by: bedges on 03 Oct 2005, 19:59:17
if i remember correctly, it means If I Remember Correctly.

 8)