Hi all !
I've always tough that a unit can shoot when she'es in a truck or a car would be a cool addiction to OFP. I've just found a limited, but quite good solution, with a modification of the good old script "MGCarry.sqs" (I've just changed the MG for a soldier) :
In init.sqs, type :
[Vehiclename,Unitname,0.785] exec "MGCarry.sqs"
exit
MGCarry.sqs :
_carrier = _this select 0
_cargo = _this select 1
_height = _this select 2
endCargoSession = false
goto debug
#carrier
_x = (getPos _carrier) select 0
_y = (getPos _carrier) select 1
_z = ((getPos _carrier) select 2)+_height
_cargo setPos [_x, _y, _z + 0.9 ]
_cargo setDir (getDir _carrier)
~.01
? (!endCargoSession) : goto "carrier"
@ endcargosession
_cargo setpos [_x,(_y)-1.5,0]
exit
Results of the test :
- Use the setUnitPos command to make the unit "DOWN" for cars OR "UP" for trucks. If you don't do that the unit will die after a few seconds.
- As driver, the AI doesn't drive at full speed. As "gunner", it seems that the AI shots the enemies only when they're quite close (about 50 meters), but a human (as driver) can drive at full speed without any problem. The script works perfect with two humans
!
- The gunner can only fire before him ; only the driver can change the direction. That limit is greater with trucks, because of the cab (the gunner can shot only enemy who are on hills or flying choppers).
If you have ideas for improve this script, don't hesitate
!