Home   Help Search Login Register  

Author Topic: AI Drivers actions  (Read 1141 times)

0 Members and 1 Guest are viewing this topic.

Lamorack

  • Guest
AI Drivers actions
« 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. ???

Offline macguba

  • Former Staff
  • ****
    • macguba's operation flashpoint page
Re:AI Drivers actions
« Reply #1 on: 08 Aug 2005, 14:22:40 »
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?
Plenty of reviewed ArmA missions for you to play

Offline Pilot

  • Contributing Member
  • **
Re:AI Drivers actions
« Reply #2 on: 08 Aug 2005, 14:24:29 »
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

Lamorack

  • Guest
Re:AI Drivers actions
« Reply #3 on: 08 Aug 2005, 14:48:04 »
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?

Offline macguba

  • Former Staff
  • ****
    • macguba's operation flashpoint page
Re:AI Drivers actions
« Reply #4 on: 08 Aug 2005, 15:22:24 »
Move him from inside.   Remember to use an unassign command or he'll try to get back in.
Plenty of reviewed ArmA missions for you to play

Offline Pilot

  • Contributing Member
  • **
Re:AI Drivers actions
« Reply #5 on: 08 Aug 2005, 16:43:16 »
Try this script, it works for me:

Quote
_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
« Last Edit: 08 Aug 2005, 16:50:34 by Student Pilot »

Offline Triggerhappy

  • Contributing Member
  • **
  • Llama, it's what's for dinner.
Re:AI Drivers actions
« Reply #6 on: 08 Aug 2005, 21:32:04 »
why not just give him a moveincargo so he'll go to the passengers seat, then tell him to get out?

Offline THobson

  • OFPEC Patron
  • Former Staff
  • ****
Re:AI Drivers actions
« Reply #7 on: 08 Aug 2005, 22:03:47 »
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.

Offline Pilot

  • Contributing Member
  • **
Re:AI Drivers actions
« Reply #8 on: 08 Aug 2005, 22:08:14 »
Quote
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

Offline THobson

  • OFPEC Patron
  • Former Staff
  • ****
Re:AI Drivers actions
« Reply #9 on: 08 Aug 2005, 22:10:21 »
Quote
...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.
« Last Edit: 08 Aug 2005, 22:10:38 by THobson »

Offline Pilot

  • Contributing Member
  • **
Re:AI Drivers actions
« Reply #10 on: 08 Aug 2005, 22:15:38 »
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

Offline THobson

  • OFPEC Patron
  • Former Staff
  • ****
Re:AI Drivers actions
« Reply #11 on: 08 Aug 2005, 23:04:24 »
Quote
he is automatically transported to the other side.
To the driver's side?

Quote
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.

« Last Edit: 08 Aug 2005, 23:06:07 by THobson »

Offline Pilot

  • Contributing Member
  • **
Re:AI Drivers actions
« Reply #12 on: 08 Aug 2005, 23:19:17 »
Quote
To the driver's side?
No, the driver is transported to the passenger side

Quote
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!

Quote
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.
« Last Edit: 08 Aug 2005, 23:24:14 by Student Pilot »