@name Verus's Plane chip @inputs [Cam Pod EyePod LeftWing RightWing LeftTailWing RightTailWing MiddleTailWing]:wirelink @outputs Throttle RightUp VTOLTog @persist [On Up Dn Ri Le Yaw Mass Roll Lift EyeX1 EyeY1 Timer Speed VTOLTog Thrust AimingM RightUp InTimer Damage Throttle ReticuleSize RealisticFlight HoloFlapsEnabled]:number @persist [CollisionSpeed Interval Damaged Injured EngineProb LiftAlter VTOLFlight SoundPitch SoundDistance AimingMethod StartUpSpeed CameraRotation Manuevarebility]:number @persist [E Holo1]:entity [Clamp HurtVec ThrustDirection CameraPosition]:vector [EngineSound WarningSound1 WarningSound2]:string [FA1 FA2 FA3 DamageAlter]:angle @persist [Array WingLink WingExists HintDriver AimingModes HurtSounds EyeSensitivity]:array [AimingData Flaps]:table @model models/hunter/blocks/cube1x6x1.mdl # Verus / Badger130 made this (changed name) # Please do not claim as your own # distribute freely # version - V1.3.3 #Digit 1 Represents a major functionality change #Digit 2 Represents a new feature #Digit 3 Represents a bug fix ###### this is Verus's Plane Chip ###### #Explination on the wing wirelinks #Link these to the prop you want the e2 to think is the respective wing #if this prop is destroyed / no longer exists, the plane will crash as a result of loss of lift and control if(first()){ ###### setup ####### #@model changes the model of the base prop Interval = 20 #Increasing this will decrease ops, but you will need to increase the lift and other options #Performance may also drop if it is too high or the code will become un-usable #Flight Settings Manuevarebility = 15 #this is how agile the Plane is Lift = 32 #This is how much Lift the plane has Thrust = 100 StartUpSpeed = 0.05 #This is how fast it takes the Plane to reach full throttle RealisticFlight = 0 #Should the plane use a more real flight system, doesnt work well in the small scale of gmod VTOLFlight = 0 #Does the plane have vtol capabilities? (Press F / Light to enable) #Phyiscal damage settings Damage = 1 #Determines weather the Plane will acount for physical damage or not CollisionSpeed = 700 #This is how fast the Plane has to be flying prior to a collision to hurt the motor #Camera settings CameraPosition = vec(0,0,90) #This is the position of the camera relative to the Plane CameraRotation = 270 #This is the position of the camera relative to the player's eye AimingModes = array(1,2,3,4) #This controls the order of the aiming modes by the alt button #Simply remove a number if you dont want that aiming mode #1 is 1rd person strafe, 2 is 3st person strafe #3 is 1st person WASD, 4 is 3rd person WASD #5 is 1st person BF3, 6 is 3rd person BF3 #Change Reticule Size to 0 to disable the crosshair ReticuleColor = vec(255,25,25) #This is the color of the crosshair ReticuleMode = 3 # A number between 1 and 10 for diffrent reticules ReticuleSize = 1.5 #T his determines the size of the reticule #Sound settings EngineSound = "/vehicles/airboat/fan_blade_fullthrottle_loop1.wav" #This is the Sound of the Engine SoundPitch = 15 #This is how much the soundpitch is multiplied SoundDistance = 40 #This is how far the sound will travel WarningSound1 = "/npc/attack_helicopter/aheli_crash_alert2.wav" #This is the warning sound played when a wing has been lost WarningSound2 = "/ambient/alarms/fire_alarm-01.wav" #This is the warning sound played when a main wing has been lost #Flap settings HoloFlapsEnabled = 1 #are the flaps enabled or not? Flaps = table(array( #This is the Main wing Flap# vec(0.5,3,6) #This is the size of the flap ,vec(100,50,0) #This is the position of the flap ,ang(85,0,0) #This is the rotation angle of the flap ,vec(255,255,255) #This is the color of the flap ,"phoenix_Storms/concrete1" #This is the mat of the flap ),array( #This is the tail wing Flap# vec(0.5,2,4) #This is the size of the flap ,vec(100,-70,0) #This is the position of the flap ,ang(90,0,0) #This is the rotation angle of the flap ,vec(255,255,255) #This is the color of the flap ,"phoenix_Storms/concrete1" #This is the mat of the flap ),array( #This is the rutter# vec(0.5,2,4) #This is the size of the Flap ,vec(0,-70,50) #This is the position of the flap ,ang(0,0,0) #This is the rotation angle of the flap ,vec(255,255,255) #This is the color of the flap ,"phoenix_Storms/concrete1" #This is the mat of the flap ###### setup ####### )) #####Update Info##### #[ --- Verson Update V1.3.3 Added long range sounds Fixed Non-Vtol flight Fixed W and S in WASD mode --- Verson Update V1.3.2 Added free-look Mode Added Comments for easy explination Fixed camera in 3rd person WASD mode Fixed Vtol mode - code was attempting to apply forward flight angle calculation in vtol mode Fixed real/unreal flight mode conditonal --- Verson Update V1.3.1 Added VTOL Mode --- Verson Update V1.2.1 fixed Unreal lift calculation --- Verson Update V1.2.0 Added holoCrosshair Added Unreal lift option --- Verson Update V1.1.0 Added holoFlaps Added Damage detection Added option to change alert sounds --- Version Update V1.0.0 Basic functionality works Added Point and aim mode based off Generic default's strafe mode Added smoothed out WASD mode Added laggy Mouse aiming mode Added startup notes --- Version Update V0.1.0 Buggy pre-release working --- To-do list (No order of importance) Fix crosshair w/o camera active Add BlackOuts Add breathing sound for G-force stress indication Add stalls Add autopilot Add invert mode Maybe Add a clamping option for plane - cant lift more than #% of it's weight ]# # Codeing below # Do not alter unless you know what you are doing interval(20) EyeSensitivity = array() #For use in my complicated eye and array system E = entity() #detects itself Mass = E:mass() #detects the mass of itself LiftAlter = 1 #Because default is 0 not 1 VTOLTog = VTOLFlight #Because default is 0 not 1 RightUp = VTOLFlight #Because default is 0 not 1 Clamp = vec(Manuevarebility #Agilty clamp, quite basic ,Manuevarebility ,Manuevarebility/1.5) ThrustDirection = -E:right() #This direction the code pushes the base WingLink = array( #This array contains data on wether the wings exists or not, and if it should detect if they are broken ->LeftWing ,->RightWing ,->LeftTailWing ,->RightTailWing ,->MiddleTailWing ) AimingData = table( #This table contains arrays of the camera - holo parent system array(1,vec(),vec(),"First Person 'point-aim' mode engaged") ,array(2,vec(-CameraRotation,0,0),vec(),"Third Person 'point-aim' mode engaged") ,array(3,vec(),vec(),"First person 'WASD' mode enageged") ,array(4,vec(-CameraRotation,0,0),vec(),"Third person 'WASD' mode engaged") ,array(5,vec(),vec(),"First person 'Mouse' mode enageged") ,array(6,vec(-CameraRotation,0,CameraPosition:z()/2),vec(),"Third person 'Mouse' mode engaged") ) HintDriver = array( #This array contains the hints displayed when you first enter seat "This is Badger130's Plane Chip",3 ,"Hold Space to start accelerate, shift to deccelerate",7 ,"Hold ALT to switch aiming methods",7 ,"Hold R to enable free-look",7 ) HurtSounds = array( #This array contains the sounds played when a wing is lost "/physics/metal/metal_break1.wav" ,"/physics/metal/metal_break2.wav" ,"/physics/metal/metal_box_break1.wav" ,"/physics/metal/metal_box_break2.wav" ,"/physics/metal/metal_solid_break2.wav" ) rangerPersist(1) #This is making the code filter all props constrained to the base and all players rangerFilter(E:getConstraints()) rangerFilter(players()) ReticleModels = array("cylinder","octagon","hexagon","icosphere","icosphere2","icosphere3","sphere") #This is an array of the reticule mode models, feel free to add your own props/holos holoCreate(2,vec(),vec(),ang()) #This holo is the the parent of the cam, which is parented to the base holoVisible(2, players(),0) #makes sure no one sees it, but making the size 0 also works holoParent(2, E) holoCreate(1,E:toWorld(vec(0,E:boxSize():y() / 2,0)),vec(1,1,1),E:angles(),vec(255,255,255),"cone") #This tells you which way is up and front for the base holoParent(1,E) holoVisible(1,players(),E:getAlpha() > 0) #So that it wont be visible if you have the base invisible holoCreate(11, vec(),vec(5,5,5),ang()) #Parent for the reticule, of which parents to the camera parent (holo 2) holoVisible(11, players(),0) #This is merely in the same place as the cam all the time to reduce about 50 ops holoParent(11, 2) holoCreate(8,vec(),vec(),ang()) #This is parented to 11, it rotates the angles of the reticule holoVisible(8,players(),0) holoParent(8,11) OO5 = clamp(vec(0.05,0.05,0.05)*ReticuleSize,vec(0.05,0.05,0.05),vec(0.5,0.5,0.5)) holoCreate(9,vec(9,0,0),OO5,ang(90,0,0),ReticuleColor,"hq_torus_thin") #This is the circle of the reticule holoVisible(9,players(),1) holoParent(9,8) holoDisableShading(9,1) holoCreate(10,vec(9,0,0),OO5,ang(90,0,0),ReticuleColor,ReticleModels[clamp(ReticuleMode,1,7),string]) #This is the actual grid of the reticule holoVisible(10,players(),1) holoParent(10,8) holoDisableShading(10,1) holoMaterial(10,"models/wireframe") #Material - FLIR hates this Holo1 = holoEntity(11) if(HoloFlapsEnabled) { #This is the creation of the holo flaps A1 = Flaps[1,array] FA1 = A1[3,angle] A2 = Flaps[2,array] FA2 = A2[3,angle] A3 = Flaps[3,array] FA3 = A3[3,angle] holoCreate(3,E:toWorld(A1[2,vector]) ,A1[1,vector],E:toWorld(FA1) ,A1[4,vector],"hq_cylinder") #Front Right flap holoCreate(4,E:toWorld(A1[2,vector] * vec(-1,1,1)),A1[1,vector],E:toWorld(FA1 * ang(-1,1,1)),A1[4,vector],"hq_cylinder") #Front Left flap holoCreate(5,E:toWorld(A2[2,vector]) ,A2[1,vector],E:toWorld(FA2) ,A2[4,vector],"hq_cylinder") #Tail Right flap holoCreate(6,E:toWorld(A2[2,vector] * vec(-1,1,1)),A2[1,vector],E:toWorld(FA2 * ang(-1,1,1)),A2[4,vector],"hq_cylinder") #Tail Right flap holoCreate(7,E:toWorld(A3[2,vector]) ,A3[1,vector],E:toWorld(FA3) ,A3[4,vector],"hq_cylinder") #Tail Middle flap holoMaterial(3,A1[5,string]) holoClipEnabled(3,1) holoClip(3,vec(),vec(0,-1,0),0) holoParent(3,E) holoVisible(3,players(),1) #just more setup holoMaterial(4,A1[5,string]) holoClipEnabled(4,1) holoClip(4,vec(),vec(0,-1,0),0) holoParent(4,E) holoVisible(4,players(),1) #just more setup holoMaterial(5,A1[5,string]) holoClipEnabled(5,1) holoClip(5,vec(),vec(0,-1,0),0) holoParent(5,E) holoVisible(5,players(),1) #just more setup holoMaterial(6,A1[5,string]) holoClipEnabled(6,1) holoClip(6,vec(),vec(0,-1,0),0) holoParent(6,E) holoVisible(6,players(),1) #just more setup holoMaterial(7,A1[5,string]) holoClipEnabled(7,1) holoClip(7,vec(),vec(0,-1,0),0) holoParent(7,E) holoVisible(7,players(),1) #just more setup } E:soundPlay(1,0,WarningSound1) E:soundPlay(2,0,WarningSound2) soundVolume(1,0) #Sets volume to 0 for debugging soundVolume(2,0) soundVolume(3,0) timer("SoundSet",200) #This is for the long range sounds } else { interval(Interval) #Basic interval, makes code re-run everything (except the if(first)) every time frame, 0.02 of a second by default #Setup # |--| # |--| #Variables W = Pod["W",number] #Used for Pitch in Point and Aim and WASD A = Pod["A",number] #Used for Roll in Point and Aim, Yaw in WASD, and Roll in Mouse S = Pod["S",number] #Used for Pitch in Point and Aim and WASD D = Pod["D",number] #Used for Roll in Point and Aim, Yaw in WASD, and Roll in Mouse F = Pod["Light",number] #Used for VTOL mode Toggle R = Pod["R",number] #Used for Free look MUp = Pod["NextWeapon",number] #Unused MDn = Pod["PrevWeapon",number] #Unused Alt = Pod["Alt",number] #Used for Aim Mode selection Zoom = Pod["Zoom",number] #Unused Space = Pod["Space",number] #Used for Throttle increase Shift = Pod["Shift",number] #Used for Throttle decrease Active = Pod["Active",number] #Used for conditional execution of code Seat = Pod["Entity",entity] #Used for Eye and driver hints EyeX = EyePod["X",number] #Used for Mouse Mode EyeY = EyePod["Y",number] #Used for Mouse Mode Ang = E:angles() #Used for Optimization Ang90 = E:toWorld(ang(0,90,0)) #Used for Optimization Pos = E:pos() #Used for Optimization VelL = E:velL() #Used for Optimization VelLY = VelL:y() #Used for Optimization #Variables # |--| # |--| #Angles and Camera EyeAngles = Seat:toLocal(Seat:driver():eyeAngles()) #These are the basic angles from the seat EyeSensitivity:insertAngle(1,EyeAngles) #This will keep a small storage of the eye angles if(EyeSensitivity:count() > 2) #Makes sure its not more than 2 angles {EyeSensitivity:pop()} #deletion EyePod1 = EyeAngles - EyeSensitivity[2,angle] #Finds the diffrence EyePodYaw = EyePod1:yaw() #Yaw diffrence YawPlus = (EyePodYaw > 180) ? -360 * (EyePodYaw > 180) : 360 * (EyePodYaw < -180) #Accounts for the swap between 180* and -180* EyePods = EyePod1 + ang(0,YawPlus,0) #This is all the eye date in diffrential form EyeX1 = mod(EyeX1 + EyePods:pitch(),360) #This is the persist of the eye, so it doesnt behave like an eyepod EyeY1 = mod(EyeY1 + EyePods:yaw(),360) Eye = ang(EyeX1,EyeY1,EyeAngles:roll()) #Combonation of the angles if(changed(Active)) { for(H = 1,HintDriver:count()/2) #This is using the HintDriver array and a loop to display driver hints { Seat:hintDriver(HintDriver[H*2 - 1,string] ,HintDriver[H*2,number]) } if(VTOLFlight) #Because I only want this to display if you have VTOL mode in, would be wierd if it popped up on your WWII plane { Seat:hintDriver("To Enable/Disable VTOL flight tap light, default F",7) } } if(changed(AimingMethod) | changed(Active)) { CurData = AimingData[AimingMethod,array] holoCreate(2, vec(),vec(),ang()) #Yes, it creates it again at vec(0,0,0) holoVisible(2, players(),0) holoParent(2, E) holoPos(11, CurData[2,vector]) #This one also holoAng(11, ang()) holoVisible(11, players(),0) holoParent(11, holoEntity(2)) #Parenting to holos Holo1 = holoEntity(11) #I need this data to make the crosshair 100% accurate Cam["Position",vector] = CurData[2,vector] #This is the offset of the camera, for very smooth 3rd person transverse even in lag Cam["Angle",angle] = ang() #This method was developed after I noticed the substantial lag in generic's camera Cam["Parent",entity] = holoEntity(2) Seat:hintDriver(CurData[4,string],5) #tells the driver which aiming mode the plane is in Yaw = Ang:yaw() + 90 #This makes the eye's yaw look whichever way the plane is, advantage of my custom eye calculation EyeY1 = AimingMethod <= 2 ? Ang:yaw() + 90 : -Ang:pitch() if(Active) { holoVisible(8,Seat:driver(),1) #This is making the crosshair visible for the driver, and only the driver when the seat is active holoVisible(9,Seat:driver(),1) holoVisible(10,Seat:driver(),1) } else { holoVisible(8,players(),0) #This is making the crosshair invisible for everyone when the seat is inactive holoVisible(9,players(),0) holoVisible(10,players(),0) } } else { if(Alt) #This is the holding style for the alt, so if you tap it it wont swap {InTimer = clamp(InTimer + 1,0,18)} #This also was in place so that tapping alt would invert pitch elseif(!Alt) #which I need to enable for WASD and Mouse aiming modes {InTimer = 0} AimingM = mod(AimingM + (changed(InTimer) #the selection of the aiming modes & (InTimer == 18)),AimingModes:count()) #Uses an array because arrays can simplify life AimingMethod = AimingModes[AimingM + 1,number] if((AimingMethod <= 2) & Active) #Point and aim method { Sub = (Eye - Ang90):yaw() if(Sub > 300) #This is for the yaw, so it doesnt freak out, which is still does {Roll = Sub - 360} elseif(Sub < -300) {Roll = Sub + 360} else {Roll = Sub} TargetAngles = Eye - ang( (S - W) * 35,0,clamp(Roll * 5,-140,140) + (A - D) * 15) #angles to where you are aiming Smoother = vec(0,abs(clamp((abs(abs(Ang:roll()) - 90) - 90),0,90) / 180 * Manuevarebility) / 1.8,0) #Smooths roll for nice arcs HoloPos = (AimingMethod == 1) ? (Seat:toWorld(vec(0,1,35))) : (E:toWorld(CameraPosition:setZ(0)) + vec(0,0,CameraPosition:z())) #Angles of the camera } elseif((AimingMethod >= 2) & Active) { if(AimingMethod <= 4) { #This is the smoothing system for WASD, makes the plane fly without jerky movement Up = clamp(Up + W - !W * 3,0,Manuevarebility) #Up Dn = clamp(Dn + S - !S * 3,0,Manuevarebility) #Down Ri = clamp(Ri + A - !A * 3,0,Manuevarebility) #Right Le = clamp(Le + D - !D * 3,0,Manuevarebility) #Left Pitch = (Up - Dn) / 2 #Average pitch Yaw = -Ang:pitch() / 10 #This is the yaw controlled by roll Roll = (Le - Ri) / 2 #Average roll } else { #This is Mouse aiming mode, im to lazy to put more into it because eyepod is inferior Ri = clamp(Ri + A - !A * 3,0,Manuevarebility*2) #Right Le = clamp(Le + D - !D * 3,0,Manuevarebility*2) #Left Pitch = clamp(EyeY / 4 ,-Manuevarebility,Manuevarebility) Yaw = -Ang:pitch() / 10 + (Ri - Le) / 6 Roll = clamp(EyeX / 4 ,-Manuevarebility,Manuevarebility) } TargetAngles = E:toWorld(ang(Pitch,90,Roll)) + ang(0,Yaw,0) #Assemply of previouse numbers into the TargetAngles HoloPos = (AimingMethod == 5) ? Seat:toWorld(vec(0,7,39)) : #Conditonal of the Camera pos, for 1st person mode E:toWorld(CameraPosition:setZ(0)) + vec(0,0,CameraPosition:z()) #This is the camera upward addition, gives that wierd feel in 3rd person WASD/mouse #I like this, I dont know about user prefrence though } elseif((!Active | (VelLY < 50))) #This is asking if the plane is going a minimum speed and if its inactive { TargetAngles = E:vel():toAngle():setRoll(Ang:roll()) #This is the angles if the code is inactive, same as a fin } HoloAng = (AimingMethod <= 4) ? ( AimingMethod == 4 ? E:toWorld(Eye) #This is the angle of the holo the camera is parented to : Eye ) : Ang90 #, can be out here because its always where your looking, but needs special treatment in a few modes holoPos(2,HoloPos) #This is where all those prior calculations go to holoAng(2,HoloAng) #Same as above Cam["Activated",number] = Active & (AimingMethod != 3) #Disables in 1st person WASD mode, should probaly remove so that crosshair works if(ReticuleSize > 0) #Did the settings allow for the crosshair { rangerPersist(1) #a ranger from the base's pos to the base's right direction, which is actually it's forward GunRanger = rangerOffset(9999999999,Pos,-E:right()):position() GunPos = ( GunRanger - Holo1:pos() ):toAngle() #This finds the angle from the camera pos (holo 11) to the position of the ranger, makes crosshair dead accurate holoAng(8,GunPos) #Angle of the crosshair } } EyePod["Enable",number] = Active & (AimingMethod >= 5) #This is needs to be outside of a conditional, enables it in mouse aim-mode, I personaly think eyepod is horrible #Angles and Camera # |--| # |--| #ApplyForce and torque if(VTOLFlight) #VTOL flight calculations { if(changed(F) & F) #This toggle { VTOLTog = !VTOLTog } RightUp = clamp(RightUp + (VTOLTog - !VTOLTog) / 300,0,1) #The clamped direction of the thrust } ThrustDirection = ( E:right() * (RightUp - 1) ) + ( ( E:up() * RightUp ) / 11) #Calculates it with forward thrust in mind Throttle = clamp(Throttle + (Space - Shift - !Active - EngineProb * 3) #This is the throttle calculation 0 - 10 * StartUpSpeed,0,10) SpeedLift = VelLY > 0 ? VelLY : abs(VelLY) / 2 #This is the calculation for lift if(RealisticFlight & Active) { #This flight mode basicaly makes the plane hover and forces it in a direction DirecLift = E:up() + vec(0,0,90 - abs(Ang:pitch())) / 65 #Angle of Lift E:applyForce(SpeedLift * Lift * LiftAlter * DirecLift * Mass * 0.0001) #Lift calculation E:applyForce(Thrust * Interval * Throttle * ThrustDirection) #Engine thrust } else { #Plane seems to drift in this mode from not enough -E:vel() E:applyForce(SpeedLift * (Lift * LiftAlter * vec(0,0,1) * Mass * 0.0001 - E:vel() * Mass * 0.00005)) #Lift calculation E:applyForce(Thrust * Interval * Throttle * ThrustDirection * 4) #Engine Thurst } VClamp = clamp(Clamp * VelLY / 6000 - Smoother - HurtVec + RightUp * Manuevarebility / 15,vec(),vec(999)) #This is half the flight code, maintains half angle clamps and smooths movement in strafe flight mode #VClamp = Clamp / 2 - Smoother #This is debug flight mode, if using remember to also remove the clamp on line 466 TarQ2 = quat(Damaged ? E:toWorld(DamageAlter) #This is determining Which angles to return based on Damage Detection : (R ? Ang90 : TargetAngles)) #This is determining (If undamaged) to return flight or free-look angles CurQ2 = quat(Ang90) #This is the Current Angle of the Base Q2 = TarQ2/CurQ2 #Simple division V2 = clamp(E:toLocal(rotationVector(Q2) + Pos),-VClamp,VClamp) #The vector in which to apply force (direction and magnitude) E:applyTorque((300*V2 - 40*E:angVelVector()) #This applyTorque section *E:inertia() * (clamp(VelLY/250,0,1) + RightUp * Throttle / 100)) #This part is in place so that the code does not try to maintain angles when on not moving #Directly above this comment is the VTOL exception to the Regulation #ApplyForce and torque # |--| # |--| #Damage Detection if(Damage) { Array:insertNumber(1,VelL:length()) if(Array:count()>7) {Array:pop()} ChangedSpeed = VelL:length() - Array[7,number] Physgun = owner():weapon():type() == "weapon_physgun" & owner():keyAttack1() Prev = (ChangedSpeed< -(CollisionSpeed)) & !Physgun if(changed(Prev) & Prev) {EngineProb = 1} WingExists = array( !->LeftWing & WingLink[1,number] ,!->RightWing & WingLink[2,number] ,!->LeftTailWing & WingLink[3,number] ,!->RightTailWing & WingLink[4,number] ,!->MiddleTailWing & WingLink[5,number] ) if(changed(WingExists:average()) | (changed(EngineProb) & EngineProb)) #All the damage calculation is made if a damage is detected, saves ops { Damaged = WingExists[1,number] | WingExists[2,number] #Major damage Injured = WingExists[3,number] | WingExists[4,number] | WingExists[5,number] #Minor damage if(Damaged) #If its going down { DamageAlter = ang( #At which angle should the plane spin out of control, might need to be improved so it looks much more epic (WingExists[3,number] + WingExists[4,number]) * Manuevarebility / 2 ,(WingExists[1,number] - WingExists[2,number]) * Manuevarebility + 90 ,-(WingExists[1,number] + WingExists[2,number]) * Manuevarebility ) HurtVec = vec( #This damages the agility of the plane -Manuevarebility * 2 ,-Manuevarebility * 8 ,-Manuevarebility ) soundVolume(1,1) #Warning sounds soundVolume(2,1) soundPitch(1,100) soundPitch(2,110) } if(Injured) { soundVolume(1,1) #Warning sounds soundPitch(1,70) HurtVec = vec( (WingExists[3,number] + WingExists[4,number]) * Manuevarebility / 3 #Agility degrades from minor damage, makes plane flyable, but barely ,(WingExists[3,number] + WingExists[4,number]) * Manuevarebility / 12 , WingExists[5,number] * Manuevarebility / 1.5 ) } LiftAlter = 1 - (WingExists[1,number] + WingExists[2,number])/2 - (WingExists[3,number] + WingExists[4,number])/6 #This will determine the subtraction of lift from damage E:soundPlay(3,1,HurtSounds[random(1,HurtSounds:count()),string]) #Sound play when a wing is lost holoVisible(3,players(),!WingExists[2,number]) #Makes flaps disable when wing props are removed holoVisible(4,players(),!WingExists[1,number]) holoVisible(5,players(),!WingExists[4,number]) holoVisible(6,players(),!WingExists[3,number]) holoVisible(7,players(),!WingExists[5,number]) } } #Damage Detection # |--| # |--| #Sounds NumPlayers = numPlayers() #For less ops if(clk("SoundSet") | changed(NumPlayers)) #Holo spawning section { for(G = 1,NumPlayers) { A10 = G + 10 #This is in place so the holo IDs wont collide with the other ones CurPlay = players()[G,entity] #This is the player currently being used holoCreate(A10,CurPlay:pos(),vec()) holoVisible(A10,players(),0) holoParent(A10,CurPlay) holoEntity(A10):soundPlay(A10,0,EngineSound) #Soundplaying at each holo soundVolume(A10,0) #So the sound wont derp out soundPitch(A10,0) #So the sound wont derp out } } for(Z = 1,NumPlayers) #Sound changing section { B10 = Z + 10 #This is in place so the holo IDs wont collide with the other ones HoloE = holoEntity(B10) #The current holo the E2 is using Dis = clamp(HoloE:pos():distance(Pos),1,9999999) #This is the distance from the player to the E2 SPitch = 1 / Dis * SoundDistance * 10 #The sound pitch calculation soundVolume(B10,clamp(SPitch,0,1)) #the sound volume soundPitch(B10,Throttle * SoundPitch) #the sound pitch } #Sounds # |--| # |--| #Flaps if(HoloFlapsEnabled & Active) #Flap angles { FlapAngles = TargetAngles - Ang90 #This is what the flaps should angle to FPitch = FlapAngles:pitch() * ((AimingMethod > 2) * Manuevarebility + 1) #clamp of flap angles FRoll = FlapAngles:roll() * ((AimingMethod > 2) * Manuevarebility + 1) holoAng(3,E:toWorld(FA1 ):rotateAroundAxis((vec(0,0,1):rotate(FA1) ):rotate(Ang) , clamp(-FPitch - FRoll,-35,35))) #Rotates at any angle holoAng(4,E:toWorld(FA1 * ang(-1,1,1)):rotateAroundAxis((vec(0,0,1):rotate(FA1 * ang(-1,1,1))):rotate(Ang) , clamp(FPitch - FRoll,-35,35))) holoAng(5,E:toWorld(FA2 ):rotateAroundAxis((vec(0,0,1):rotate(FA2) ):rotate(Ang) , clamp(FPitch - FRoll,-35,35))) holoAng(6,E:toWorld(FA2 * ang(-1,1,1)):rotateAroundAxis((vec(0,0,1):rotate(FA2 * ang(-1,1,1))):rotate(Ang) , clamp(-FPitch - FRoll,-35,35))) holoAng(7,E:toWorld(FA3 ):rotateAroundAxis((vec(0,0,1):rotate(FA3) ):rotate(Ang) , clamp(-FlapAngles:yaw(),-35,35))) } #Sounds # |--| # |--| #End } if(dupefinished()) {reset()}