'ello!
I'm having a bit trouble with setvelocity command on manned vehicles
Example:
BMP moves from waypoint A to waypoint B and then executes a script, which makes it to move forward (or at least that's what I want it to do), but instead of going forward, the driver turns the vehicle and it starts to drive in circle. I tried dostop bmp1 and bmp1 disableAI "move" with no luck. Deleting the driver could be one thing to do, but it's not quite the same. Imagine a jeep driving without driver, not good.
[bmp1, 4] exec "setvel.sqs" on a trigger or scripted waypoint. Tried also in initilization field of a manned vehicle with no waypoints just to be sure the waypoints don't mess it, but same thing happened. Driver messed everything up.
Here's the script setvel.sqs
_unit = _this select 0
_speed = _this select 1
;;_trigger = _this select 2 can I specify the variable that stops the script also in [brackets] when I exec the script? I tried this way, but it didn't work.
movestop1 = false
;dostop _unit Tried these two lines here with no luck.
;_unit disableAI "move"
#loop1
_velocity = [sin (getdir _unit) * _speed, cos (getdir _unit) * _speed , 0]
_unit setvelocity _velocity
~0.1
?(movestop1):goto "loppu" ;; Tried ?(_trigger):goto "loppu" but it didn't work. Maybe I did it wrong.
goto "loop1"
#loppu
exit
So, the vehicle should drive forward and when it has moved for a while, a trigger sets movestop1 to true and the vehicle stops moving. It worked fine with empty vehicles. But when there's a driver inside, he messes it completely.
Another related question:
Can I specify a variable so I could use the script for different vehicles at same time. Like this:
[jeep1, 4, stopmove1] exec "setvel.sqs"
and then have a trigger to set stopmove1 to true when i want the jeep to stop.
And another vehicle to have [jeep2, 4, stopmove2] exec "setvel.sqs" etc. Instead of every script stopping when I set movestop1 to true.
Or maybe some kind of workaround to detect when the vehicle is in certain place or something. Or a completely different and better script to do the same, I'm not really good in these yet.
Hmm. This post came out quite long and messy, I hope you understand what I mean. Thanks in advance for any help!