OFPEC Forum
Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: Lamorack on 08 Aug 2005, 13:58:47
-
I am new to mission editing, and was wondering if it is possible to get an AI vehicle Driver to get out of the other side of the vehicle - not the drivers side? I am working with Trucks, and I want the driver to exit the vehicle away from the enemy and use his truck for cover. ???
-
Welcome to the forum!
I'm not sure but it's probably impossible.
However, we may be able to figure out a workaround. Will the player see? Would it work if he got out on the usual side and was then teleported to where you want him?
-
Hmmm, I'm not sure if this would work, but when the driver is out of the truck, maybe setpos him immediately to the other side so as to appear he got out of that side?
In order to get the driver on the other side, you will need to know the direction of the truck, then use some trig to setpos the driver on the other side. I could figure out the proper equation for that, but I don't have it stored in my memory bank ::)
-Student Pilot
-
Thanks for replies.
The player(s) may welll be able to see, but I was more concerned with drivers getting shot as soon as they disembarked. I know I could use a setpos, I was just hoping that there was an easier way to do this, brain couldn't take working out the trig on a monday.
If I do use setpos, do I have to get the driver out of the truck first, or can I just move him from inside?
-
Move him from inside. Remember to use an unassign command or he'll try to get back in.
-
Try this script, it works for me:
_truck = _this select 0
_driver = driver _truck
#Loop
?_driver in _truck: goto "Loop"
_dir = getdir _truck
_driver setpos [((getpos _truck select 0) + (sin _dir*2)) + ((cos _dir)*2), ((getpos _truck select 1) + (cos _dir*2)) - ((sin _dir)*2), 0]
exit
Call it from the init field of the truck you want the driver to jump out of:
[this] exec "OtherSide.sqs"
Assuming of course you name the script OtherSide.sqs ::)
EDIT:
Made a correction in the way I called the script
-Student Pilot
-
why not just give him a moveincargo so he'll go to the passengers seat, then tell him to get out?
-
I think Triggerhappy is right. But you may need to be careful with assignments. I suggest trying:
UnassignVehicle unitname
unitname assignAsCargo vehiclename
unitname moveInCargo vehiclename
UnassignVehicle unitname
unitname allowGetIn false
This last line is only needed if the driver is an original crew member of the vehicle to stop him getting back in. For some reaosn original crew members want to get back in even after they have been unassigned.
I have not tested this.
-
why not just give him a moveincargo so he'll go to the passengers seat, then tell him to get out?
...uhhh.........hmmmm.........well........my script works too! :P
darn, there's always an easier way to do it, isn't there? ::)
Note to everyone:
Any time you want something done more complicated than needs be, contact me ;D
And I thought I could finally put my knowledge of trig to use, thanks a lot, triggerhappy. :'( ;D
-Student Pilot
-
...uhhh.........hmmmm.........well........my script works too!
Does it? I wondered about that. Even though you moved the driver he is still the driver and so I thought he would still get out the driver's side.
-
Yes, I did test it and it does work. :wow: ;D Anytime the driver of the vehicle leaves, he is automatically transported to the other side.
Btw, welcome back, THobson (that is, if you are back)
-Student Pilot
-
he is automatically transported to the other side.
To the driver's side?
Btw, welcome back, THobson (that is, if you are back)
Thank you. Yes I am back (ish). My intention is to spend less than 120% of my spare time on OFP from now on. Not sure how I will manage the depravation though!
Congratulations on your mission btw.
-
To the driver's side?
No, the driver is transported to the passenger side
My intention is to spend less than 120% of my spare time on OFP from now on. Not sure how I will manage the depravation though!
Good luck!
Congratulations on your mission btw.
Thanks
-Student Pilot
EDIT:
I'll explain it a little bit more:
The script detects when the driver is out of the vehicle. Once he is out, he is immediately transported to the passenger side of the truck no matter what direction the truck is facing. This is all done instantly and the player can't tell the driver has been setpos'd. What's even better, because the driver is instantly moved, he still plays the get out animation for the vehicle he was just in, but does it on the passenger side.