Prepare thyself, for this is the Script I used for the Humvee seen in the video:
!!!!! WARNING WARNING WARNING !!!!!
Do not click this Code Snippet without parental supervision.
If contact with eyes occurs, flush eyes thoroughly and see Ply's Scripting Tutorials for better recognition. If irritation persists, close Code Snippet immediately.
;Requires Ply's Mod V1.07+
;Artificial Intelligence Script
;Header
desc = HumVee Drive Script (Vehikleh!!!!)
;Triggers
;///// Load up HUD and Humvee camera, set humvee cam offsets for third person perspective
;///// Dim variables necessary
:state=0:hudreset,hudx=50,hudy=90,hudimagefine=gamecoretextpressentertouse.tga,hudname=driveprompt,hudhide=1,hudmake=display
:state=0:makecamera=HumveeCam
:state=0:offsetcamy=HumveeCam 150,offsetcamfore=HumveeCam -110
:state=0:dimvar=Temp,dimvar=TempX,dimvar=TempY,dimvar=HAccel,setvar=HAccel 0.5,dimvar=HVel,dimvar=HMaxVel
:state=0:animate=1,state=1
;///// Show Use HUD when player approaches
:state=1,plrdistwithin=100:hudshow=driveprompt,hudfadeout=driveprompt
;///// If player activates SpyBot, then disable plr input using startmenu
;///// and view through the humvee third person camera, also loop motor sound
:state=1,plrdistwithin=100,plrusingaction=1:startmenu,viewcam=HumveeCam,plrcoloff,loopsound=audiobank/atmos/motorhum.wav,state=2
;///// Hide The Player HUDs
:state=2:hudunshow=PlrLives,hudunshow=PlrLivesNum,hudunshow=PlrHealth,hudunshow=PlrHealthNum,hudunshow=GunPic,hudunshow=PlrAmmo,hudunshow=PlrArmor,hudunshow=PlrArmorNum,hudunshow=PlrMoney,hudunshow=PlrMoneyNum,state=3
;///// Make sure Camera follows the Humvee
;:state=3:cameraposx=HumveeCam $EPX,cameraposy=HumveeCam $EPY,cameraposz=HumveeCam $EPZ
;:state=3:cameraposx=0 $EPX,cameraposy=0 $EPY,cameraposz=0 $EPZ
;///// Give Humvee acceleration
:state=3,plrusingrun=0:setvar=HMaxVel 15
:state=3,plrusingrun=1:setvar=HMaxVel 25
:state=3:setanimspeed=100,setvar=TempX 0
:state=3:setvar=Temp %HMaxVel,mulvar=Temp -1,divvar=Temp 2
:state=3,keypressed=17 1,plrusingrun=1,varless=HVel %HMaxVel:addvar=HVel %HAccel,addvar=HVel %HAccel,setvar=TempX 1
:state=3,keypressed=17 1,plrusingrun=0,varless=HVel %HMaxVel:addvar=HVel %HAccel,setvar=TempX 1
:state=3,keypressed=31 1,plrusingrun=1,vargreater=HVel %Temp:subvar=HVel %HAccel,subvar=Hvel %HAccel,setvar=TempX 1
:state=3,keypressed=31 1,plrusingrun=0,vargreater=HVel %Temp:subvar=HVel %HAccel,setvar=TempX 1
;///// Handle Humvee Velocity and movement
:state=3:movefore=%HVel
:state=3,varless=HVel 0:setanimspeed=-100
:state=3:setvar=Temp %HAccel,divvar=Temp 2
:state=3,varequal=TempX 0,vargreater=HVel 0:subvar=HVel %Temp
:state=3,varequal=TempX 0,varless=HVel 0:addvar=HVel %Temp
:state=3,keypressed=57 1,vargreater=HVel 0:subvar=HVel %HAccel
:state=3,keypressed=57 1,varless=HVel 0:addvar=HVel %HAccel
;///// If moving, then start angling Humvee towards direction camera is facing
:state=3,varequal=TempX 1:state=10
:state=10:setvar=TempY $CAY_HumveeCam,subvar=TempY $EAY
:state=10,vargreater=TempY 180:state=11
:state=10,varless=TempY -180:state=12
:state=11:setvar=TempX $EAY,addvar=TempX -2,entityangley=%TempX,state=3
:state=12:setvar=TempX $EAY,addvar=TempX 2,entityangley=%TempX,state=3
:state=10:setvar=TempY $CAY_HumveeCam,addvar=TempY -3
:state=10,varless=$EAY %TempY:setvar=TempX $EAY,addvar=TempX 2,entityangley=%TempX
:state=10:setvar=TempY $CAY_HumveeCam,addvar=TempY 3
:state=10,vargreater=$EAY %TempY:setvar=TempX $EAY,addvar=TempX -2,entityangley=%TempX
:state=10:state=3
;///// Restore normal FPS Cam when "G" is pressed
;///// Need to restore player control with "stopmenu" and view the normal camera and stop motor sound
:state=3,keypressed=34 1:state=4
;///// Make humvee cam look around based on mouse movement
:state=3:setvar=TempX $MMY,setvar=TempY $MMX,divvar=TempX 7,divvar=TempY 7,addvar=TempX $CAX_HumveeCam,addvar=TempY $CAY_HumveeCam
:state=3:cameraangx=HumveeCam %TempX,cameraangy=HumveeCam %TempY
;///// Show the Player HUDs again
:state=4:hudshow=PlrLives,hudshow=PlrLivesNum,hudshow=PlrHealth,hudshow=PlrHealthNum,hudshow=GunPic,hudshow=PlrAmmo,hudshow=PlrArmor,hudshow=PlrArmorNum,hudshow=PlrMoney,hudshow=PlrMoneyNum
;///// Position Player outside of driver door
:state=4:cameraposx=HumveeCam $EPX,cameraposy=HumveeCam $EPY,cameraposz=HumveeCam $EPZ
:state=4:setvar=TempY $EAY,subvar=TempY 90
:state=4:cameraangx=HumveeCam 0,cameraangy=HumveeCam %TempY,cameraangz=HumveeCam 0
:state=4:movecam=HumveeCam 70
:state=4:setvar=TempX $CPX_HumveeCam,cameraposx=0 %TempX
:state=4:setvar=TempX $CPY_HumveeCam,addvar=TempX 100,cameraposy=0 %TempX
:state=4:setvar=TempX $CPZ_HumveeCam,cameraposz=0 %TempX
:state=4:addvar=TempY 90,cameraangy=HumveeCam %TempY
:state=4:cameraangy=0 %TempY
:state=4:stopmenu,viewcam=0,plrcolon,stopsound,state=1
;End of Script
It is documented somewhat, but most likely would require a very in-depth tutorial to understand if you don't have previous coding experience.
Anywhere you see "/////" is a comment on what the code is doing.
As complicated as this looks, my framerate suffered naught and maintained a steady 30-34 fps.
The script was MUCH MUCH simpler when I first made it, but since I wanted the video to look good, I vouched for putting in velocity and acceleration, as well as a "boost" control. Not to mention getting the player to come OUT of the car semi-realistically took up a bit of code at the bottom.
Vehicles absolutely do NOT have to be made this way. I went for a more "Halo" style control scheme, where you aim the camera where you want to go and the vehicle attempts to turn in that direction. Of course, you'd be able to make your own control scheme much simpler. Like, having A and D turn the car.
The one and only,
~PlystirE~