• Realistic helicopters
    23 replies, posted
I would like to see realistic helicopters made for G-mod. More specifically I would like to see helis based off of the Battlefield games in terms of handling, controls, etc. I would appreciate it if you made it a challenge, Ie. make it easy to roll over if you; A. do something shitty, B. aren't paying attention or C. just suck (Just like in Battlefield :v: ), but rewarding if you get good. It should also be noted that a cockpit view is a must. The control scheme is pretty straight forward. The W and S keys would act as the collective, moving the helicopter up and down respectively/ giving it go juice. The A and D keys would act like the petals, rotating the helicopter in the respective direction. And the mouse would act like the cyclic (Teh stick :downs:). It would be nice to have the mouse control inverted for this, pushing the mouse forward will make the helicopter pitch forward (creating forward thrust), moving the mouse backward will pitch the chopper backwards (making the helicopter move back), moving the mouse to the right or left would make the heli pitch to the right or left (making it move right or left respectively) It would also be appreciated if it were possible to create helicopters easily; kind of like making a SWEP or something, have the easy stuff up top of the script, like lift, agility (how fast it rotates), warm up time (time to get the rotors spinning up to speed), and model, and all of the techno babble down at the bottom. here are some helicopters flying for some inspiration. :keke: [media]http://www.youtube.com/watch?v=roPrE_NJcoo[/media] [media]http://www.youtube.com/watch?v=-DdEO8gkR4E[/media] [media]http://www.youtube.com/watch?v=IDjwdYflfM8[/media] Lol, the only thing the french are good for is makin' love, surrenderin' and flyin'. :haw:
This is a bump for the request forum, so the head-hack request isn't on top. :killdozer:
A lot of people have already done this with wire. You won't roll over, but the controls you described are pretty similar. I haven't downloaded this but I think it's what you want [url]http://www.garrysmod.org/downloads/?a=view&id=54904[/url]
That's wire. I want an actual lua based vehicle, not an advanced duplication of some freaky wire contraption. I want to be able to make my own at some point (I can't make contraptions to save my life, especially wire). Besides, I [i]want[/i] to roll over. :v: Edit: I'd also need to keep my stuff updated, which is really impossible for me (MY computer doesn't have internet, so I have to use a flash drive to transfer data, and I'm technically not supposed to be on this one... :saddowns:)
This is the best i can offer and it was originally this lads code, [url]http://www.garrysmod.org/downloads/?a=view&id=54787[/url]. [code] local sound_helicopter=Sound("npc/attack_helicopter/aheli_rotor_loop1.wav") -- DEFAULT HELICOPTER SOUND IN MOVEMENT ENT.aHealth = 2000 function ENT:SpawnFunction( ply, tr) local SpawnPos = tr.HitPos + tr.HitNormal * 100 local ent = ents.Create( "Combine_Helicopter" ) -- THIS IS THE NAME OF THE FOLDER ent:SetPos( SpawnPos ) ent:Spawn() ent:Activate() return ent end function ENT:Initialize() -- Default helicopter sound createsound if (!self.Sound) then self.Sound = CreateSound( self.Entity, sound_helicopter ) end -- self.Target = Vector(0,0,0); self.DroneMaxSpeed = (8000); self.AllowAutoTrack = (true); self.AllowEyeTrack = (false); self.TrackTime = 1000000; self.Drones = {}; self.DroneCount = 0; self.MaxDrones = (4); self.Track = false; self.Launched = false; self.reloadtime = (4); self.Hover = true; self.Entity:SetUseType( SIMPLE_USE ) self.In=false self.Pilot=nil self.Entity:SetModel("models/Combine_Helicopter.mdl") --- THIS IS THE MODEL self.Entity:PhysicsInit( SOLID_VPHYSICS ) self.Entity:SetMoveType( MOVETYPE_VPHYSICS ) self.Entity:SetSolid( SOLID_VPHYSICS ) local phys = self.Entity:GetPhysicsObject() if (phys:IsValid()) then phys:Wake() phys:SetMass(10000) end self.Entity:StartMotionController() self.Accel=0 self.CanBomb = true self.CanShoot = true end function ENT:OnTakeDamage( dmginfo ) if self.Pilot != nil then self.Entity:EmitSound("npc/attack_helicopter/aheli_damaged_alarm1.wav") --- SOUND WHEN YOU DAMAGE THE VEHICLE end self.aHealth = self.aHealth - dmginfo:GetDamage() if self.aHealth <= 0 then local explode = ents.Create( "env_explosion" ) explode:SetPos( self:GetPos() ) explode:Spawn() explode:SetKeyValue( "iMagnitude", "5" ) explode:Fire( "Explode", 0, 0 ) self.Entity:Remove() explode:Remove() if self.Pilot != nil then dmginfo:GetAttacker():PrintMessage( HUD_PRINTTALK, "You downed " .. self.Pilot:Nick() .. "s helicopter." ) self.Pilot:PrintMessage( HUD_PRINTTALK, dmginfo:GetAttacker():Nick() .. " downed your helicopter." ) end self.Pilot:UnSpectate() self.Pilot:DrawViewModel(true) self.Pilot:DrawWorldModel(true) self.Pilot:Kill() self.Pilot:SetNetworkedBool("isDriveJumper",false) self.In = false end if self.aHealth > 0 && self.aHealth < 150 then self:Ignite(600,5) end end function ENT:PhysicsCollide( data, physobj ) if data["HitEntity"]:IsNPC() || data["HitEntity"]:IsPlayer( ) then if data["Speed"] > 350 then data["HitEntity"]:Kill() self.aHealth = self.aHealth - 50 end end if data["Speed"] < 450 then return end if self.In then if self.Pilot != nil then self.Entity:EmitSound("npc/attack_helicopter/aheli_damaged_alarm1.wav") --- SOUND WHEN YOU DAMAGE THE VEHICLE end local explode = ents.Create( "env_explosion" ) explode:SetPos( self:GetPos() ) explode:Spawn() explode:SetKeyValue( "iMagnitude", "5" ) explode:Fire( "Explode", 0, 0 ) self.Entity:Remove() explode:Remove() if self.In then self.Pilot:UnSpectate() self.Pilot:DrawViewModel(true) self.Pilot:DrawWorldModel(true) self.Pilot:Kill() self.Pilot:SetNetworkedBool("isDriveJumper",false) self.In = false end end end function ENT:OnRemove() if self.In then self.Pilot:Spectate( OBS_MODE_NONE ) self.Pilot:UnSpectate() self.Pilot:DrawViewModel(true) self.Pilot:DrawWorldModel(true) self.Pilot:Spawn() self.Pilot:SetPos(self.Entity:GetPos() + Vector(200, 0, 0)) self.Pilot:SetNetworkedBool("isDriveJumper",false) end -- Default helicopter sound stop the sound when you leave the ship self.Sound:Stop() -- end function ENT:Think() if not ValidEntity(self.Pilot) then self.Pilot=nil self.In=false end if self.In and self.Pilot and self.Pilot:IsValid() then if self.CanShoot == true then if self.Pilot:KeyDown(IN_ATTACK) then bullet = {} bullet.Num=1 bullet.Src=self.Entity:GetPos()+Vector( 0, 0, 150 ) --bullet.Dir=self.Entity:GetAngles():Forward() bullet.Dir=self.Pilot:GetAimVector() bullet.Spread=Vector(0.08,0.08,0) bullet.Tracer=1 bullet.Force=1 bullet.Damage=100 bullet.TracerName = "AirboatGunTracer" self.Entity:FireBullets(bullet) self.Entity:EmitSound("Weapon_AR2.Single") self.CanShoot = false timer.Simple(0.1,function() self.CanShoot=true end) end end self.Pilot:SetPos(self.Entity:GetPos()) if self.Pilot:KeyDown(IN_USE) then self.In=false self.Pilot:Spectate( OBS_MODE_NONE ) self.Pilot:UnSpectate() self.Pilot:DrawViewModel(true) self.Pilot:DrawWorldModel(true) self.Pilot:Spawn() self.Pilot:SetPos(self.Entity:GetPos() + Vector(200, 0, 0)) self.Entity:SetOwner(nil) self.Pilot:SetNetworkedBool("isDriveJumper",false) self.Accel=0 self.Entity:SetLocalVelocity(Vector(0,0,0)) self.Pilot=nil -- Default helicopter sound stop the sound when you leave the ship self.Sound:Stop() -- end self.Entity:NextThink(CurTime()) else self.Entity:NextThink(CurTime()+1) end return true end function ENT:Use(ply,caller) if !self.In then self.Sound:Play() ply:Spectate( OBS_MODE_CHASE ) ply:SpectateEntity(self.Entity) ply:StripWeapons() self.Entity:GetPhysicsObject():Wake() self.Entity:GetPhysicsObject():EnableMotion(true) self.Entity:SetOwner(ply) ply:DrawViewModel(false) ply:DrawWorldModel(false) ply:SetNetworkedBool("isDriveJumper",true) ply:SetNetworkedEntity("Jumper",self.Entity) self.Pilot=ply self.In=true end end function ENT:PhysicsSimulate( phys, deltatime ) if self.In then local num=0 if self.Pilot:KeyDown(IN_FORWARD) then num=500 elseif self.Pilot:KeyDown(IN_BACK) then num=-400 elseif self.Pilot:KeyDown(IN_SPEED) then num=1000 end phys:Wake() self.Accel=math.Approach(self.Accel,num,10) if not self.Hover then if self.Accel>-200 and self.Accel < 200 then return end --with out this you float end local move={} move.secondstoarrive = 1 move.pos = self.Entity:GetPos()+self.Entity:GetForward()*self.Accel if self.Pilot:KeyDown( IN_DUCK ) then move.pos = move.pos+self.Entity:GetUp()*-200 elseif self.Pilot:KeyDown( IN_JUMP ) then move.pos = move.pos+self.Entity:GetUp()*200 end if self.Pilot:KeyDown( IN_MOVERIGHT ) then move.pos = move.pos+self.Entity:GetRight()*150 elseif self.Pilot:KeyDown( IN_MOVELEFT ) then move.pos = move.pos+self.Entity:GetRight()*-150 end move.maxangular = 4000 move.maxangulardamp = 10000 move.maxspeed = 1000000 move.maxspeeddamp = 10000 move.dampfactor = 0.8 move.teleportdistance = 5000 local ang = self.Pilot:GetAimVector():Angle() move.angle = ang move.deltatime = deltatime phys:ComputeShadowControl(move) end end [/code] Basically all i did was add a bit of feed back, gave the heli health, added collision detection on the heli so if you hit a player the heli will loose health and if you hit anything else at a specific velocity then you blow up, upped the damage, lowered the accuracy and speed of the gun, removed the mine drop(quick removal, not full).
[QUOTE=b00ce;15772709]That's wire. I want an actual lua based vehicle, not an advanced duplication of some freaky wire contraption. I want to be able to make my own at some point (I can't make contraptions to save my life, especially wire).[/QUOTE] I doubt anyone will do this when there is already a solution, and can be modified a bot to allow rolling over.
[QUOTE=LoganKett;15790527]This is the best i can offer and it was originally this lads code, [url]http://www.garrysmod.org/downloads/?a=view&id=54787[/url]. [code] local sound_helicopter=Sound("npc/attack_helicopter/aheli_rotor_loop1.wav") -- DEFAULT HELICOPTER SOUND IN MOVEMENT ENT.aHealth = 2000 function ENT:SpawnFunction( ply, tr) local SpawnPos = tr.HitPos + tr.HitNormal * 100 local ent = ents.Create( "Combine_Helicopter" ) -- THIS IS THE NAME OF THE FOLDER ent:SetPos( SpawnPos ) ent:Spawn() ent:Activate() return ent end function ENT:Initialize() -- Default helicopter sound createsound if (!self.Sound) then self.Sound = CreateSound( self.Entity, sound_helicopter ) end -- self.Target = Vector(0,0,0); self.DroneMaxSpeed = (8000); self.AllowAutoTrack = (true); self.AllowEyeTrack = (false); self.TrackTime = 1000000; self.Drones = {}; self.DroneCount = 0; self.MaxDrones = (4); self.Track = false; self.Launched = false; self.reloadtime = (4); self.Hover = true; self.Entity:SetUseType( SIMPLE_USE ) self.In=false self.Pilot=nil self.Entity:SetModel("models/Combine_Helicopter.mdl") --- THIS IS THE MODEL self.Entity:PhysicsInit( SOLID_VPHYSICS ) self.Entity:SetMoveType( MOVETYPE_VPHYSICS ) self.Entity:SetSolid( SOLID_VPHYSICS ) local phys = self.Entity:GetPhysicsObject() if (phys:IsValid()) then phys:Wake() phys:SetMass(10000) end self.Entity:StartMotionController() self.Accel=0 self.CanBomb = true self.CanShoot = true end function ENT:OnTakeDamage( dmginfo ) if self.Pilot != nil then self.Entity:EmitSound("npc/attack_helicopter/aheli_damaged_alarm1.wav") --- SOUND WHEN YOU DAMAGE THE VEHICLE end self.aHealth = self.aHealth - dmginfo:GetDamage() if self.aHealth <= 0 then local explode = ents.Create( "env_explosion" ) explode:SetPos( self:GetPos() ) explode:Spawn() explode:SetKeyValue( "iMagnitude", "5" ) explode:Fire( "Explode", 0, 0 ) self.Entity:Remove() explode:Remove() if self.Pilot != nil then dmginfo:GetAttacker():PrintMessage( HUD_PRINTTALK, "You downed " .. self.Pilot:Nick() .. "s helicopter." ) self.Pilot:PrintMessage( HUD_PRINTTALK, dmginfo:GetAttacker():Nick() .. " downed your helicopter." ) end self.Pilot:UnSpectate() self.Pilot:DrawViewModel(true) self.Pilot:DrawWorldModel(true) self.Pilot:Kill() self.Pilot:SetNetworkedBool("isDriveJumper",false) self.In = false end if self.aHealth > 0 && self.aHealth < 150 then self:Ignite(600,5) end end function ENT:PhysicsCollide( data, physobj ) if data["HitEntity"]:IsNPC() || data["HitEntity"]:IsPlayer( ) then if data["Speed"] > 350 then data["HitEntity"]:Kill() self.aHealth = self.aHealth - 50 end end if data["Speed"] < 450 then return end if self.In then if self.Pilot != nil then self.Entity:EmitSound("npc/attack_helicopter/aheli_damaged_alarm1.wav") --- SOUND WHEN YOU DAMAGE THE VEHICLE end local explode = ents.Create( "env_explosion" ) explode:SetPos( self:GetPos() ) explode:Spawn() explode:SetKeyValue( "iMagnitude", "5" ) explode:Fire( "Explode", 0, 0 ) self.Entity:Remove() explode:Remove() if self.In then self.Pilot:UnSpectate() self.Pilot:DrawViewModel(true) self.Pilot:DrawWorldModel(true) self.Pilot:Kill() self.Pilot:SetNetworkedBool("isDriveJumper",false) self.In = false end end end function ENT:OnRemove() if self.In then self.Pilot:Spectate( OBS_MODE_NONE ) self.Pilot:UnSpectate() self.Pilot:DrawViewModel(true) self.Pilot:DrawWorldModel(true) self.Pilot:Spawn() self.Pilot:SetPos(self.Entity:GetPos() + Vector(200, 0, 0)) self.Pilot:SetNetworkedBool("isDriveJumper",false) end -- Default helicopter sound stop the sound when you leave the ship self.Sound:Stop() -- end function ENT:Think() if not ValidEntity(self.Pilot) then self.Pilot=nil self.In=false end if self.In and self.Pilot and self.Pilot:IsValid() then if self.CanShoot == true then if self.Pilot:KeyDown(IN_ATTACK) then bullet = {} bullet.Num=1 bullet.Src=self.Entity:GetPos()+Vector( 0, 0, 150 ) --bullet.Dir=self.Entity:GetAngles():Forward() bullet.Dir=self.Pilot:GetAimVector() bullet.Spread=Vector(0.08,0.08,0) bullet.Tracer=1 bullet.Force=1 bullet.Damage=100 bullet.TracerName = "AirboatGunTracer" self.Entity:FireBullets(bullet) self.Entity:EmitSound("Weapon_AR2.Single") self.CanShoot = false timer.Simple(0.1,function() self.CanShoot=true end) end end self.Pilot:SetPos(self.Entity:GetPos()) if self.Pilot:KeyDown(IN_USE) then self.In=false self.Pilot:Spectate( OBS_MODE_NONE ) self.Pilot:UnSpectate() self.Pilot:DrawViewModel(true) self.Pilot:DrawWorldModel(true) self.Pilot:Spawn() self.Pilot:SetPos(self.Entity:GetPos() + Vector(200, 0, 0)) self.Entity:SetOwner(nil) self.Pilot:SetNetworkedBool("isDriveJumper",false) self.Accel=0 self.Entity:SetLocalVelocity(Vector(0,0,0)) self.Pilot=nil -- Default helicopter sound stop the sound when you leave the ship self.Sound:Stop() -- end self.Entity:NextThink(CurTime()) else self.Entity:NextThink(CurTime()+1) end return true end function ENT:Use(ply,caller) if !self.In then self.Sound:Play() ply:Spectate( OBS_MODE_CHASE ) ply:SpectateEntity(self.Entity) ply:StripWeapons() self.Entity:GetPhysicsObject():Wake() self.Entity:GetPhysicsObject():EnableMotion(true) self.Entity:SetOwner(ply) ply:DrawViewModel(false) ply:DrawWorldModel(false) ply:SetNetworkedBool("isDriveJumper",true) ply:SetNetworkedEntity("Jumper",self.Entity) self.Pilot=ply self.In=true end end function ENT:PhysicsSimulate( phys, deltatime ) if self.In then local num=0 if self.Pilot:KeyDown(IN_FORWARD) then num=500 elseif self.Pilot:KeyDown(IN_BACK) then num=-400 elseif self.Pilot:KeyDown(IN_SPEED) then num=1000 end phys:Wake() self.Accel=math.Approach(self.Accel,num,10) if not self.Hover then if self.Accel>-200 and self.Accel < 200 then return end --with out this you float end local move={} move.secondstoarrive = 1 move.pos = self.Entity:GetPos()+self.Entity:GetForward()*self.Accel if self.Pilot:KeyDown( IN_DUCK ) then move.pos = move.pos+self.Entity:GetUp()*-200 elseif self.Pilot:KeyDown( IN_JUMP ) then move.pos = move.pos+self.Entity:GetUp()*200 end if self.Pilot:KeyDown( IN_MOVERIGHT ) then move.pos = move.pos+self.Entity:GetRight()*150 elseif self.Pilot:KeyDown( IN_MOVELEFT ) then move.pos = move.pos+self.Entity:GetRight()*-150 end move.maxangular = 4000 move.maxangulardamp = 10000 move.maxspeed = 1000000 move.maxspeeddamp = 10000 move.dampfactor = 0.8 move.teleportdistance = 5000 local ang = self.Pilot:GetAimVector():Angle() move.angle = ang move.deltatime = deltatime phys:ComputeShadowControl(move) end end [/code] Basically all i did was add a bit of feed back, gave the heli health, added collision detection on the heli so if you hit a player the heli will loose health and if you hit anything else at a specific velocity then you blow up, upped the damage, lowered the accuracy and speed of the gun, removed the mine drop(quick removal, not full).[/QUOTE] :swoon: Oh my god. :D
Aww, that's not exactly what I was looking for... Close but no cigar, to be perfectly honest it wasn't even close (More what I was trying to get away from). But, thanks for the effort. It's nice to see somebody cares. :smile: Here is how a helicopter works, so you can better help me/ the Gmod community. [b][u]Collective[/u]:[/b] This is the stick on the right of the seat. It's job is to control the pitch of the rotor blades collectively. :downs: Meaning it effects the attack of all of the blades at the same time. if the collective is pulled up the attack of the blade increases; causing more lift, or thrust. It is a common misnomer that the collective increases the RPM of the blade, this isn't true. ALTHOUGH on some newer helicopters when the collective is used the helicopter will give it gas, though this is to maintain a stable RPM. [img]http://read.pudn.com/downloads64/sourcecode/others/224361/Collective%20Stick.JPG[/img] [b][u]Cyclic[/u]:[/b] This is "THE" stick, it's that stick that you see pilots manhandling all the time. It's job is to control the pitch of SOME of the blades. If it is pushed forward the rotors in the rear of the helicopter increase pitch, causing more lift in the back, causing the helicopter to rotate forward, causing lift to be diverted to the rear, causing forward motion. What ever direction you push the cyclic the blade opposite the motion will increase pitch causing motion in the direction you moved the stick. Sound complicated? Well it is. :wink: [img]http://www.thaitechnics.com/helicopter/tg5/cyclic_stick.jpg[/img] [b][u]Pedals[/u]:[/b] Yes, there is no fancy name for them, it's just pedal. The pedal is responsible for controlling the attack of the tail rotor blades. If you want to turn, these are your guys. Not much to say about them, pretty straight forward. [img]http://www.computerrepairs.ca/Sim%20Pics/G%20006%20copy.jpg[/img] [media]http://www.youtube.com/watch?v=3F2k-GWKW-w[/media] ^This is what happens when the tail rotor fails, more specifically the axle going to it.^ In a nutshell, what I just got done saying, with pretty pictures. :razz: [img]http://www.centennialofflight.gov/essay/Dictionary/pitch/DI39G1.jpg[/img] So, in another nutshell, controls are; W & S = collective, mouse = cyclic, and A & D = pedals. Edit: What, no automerge? :saddowns:
[QUOTE=LoganKett;15790527]This is the best i can offer and it was originally this lads code, [url]http://www.garrysmod.org/downloads/?a=view&id=54787[/url].[/QUOTE] That helicopter is so unrealistic and crappy looking. [url]http://www.garrysmod.org/downloads/?a=view&id=60791[/url] That one is like flying the HL2 helicopter. The gun charges, the mines are WAY better (not some shitty cluster bomb), the kills track back to you (and not #combine_helicopter), dust kicks up (and if over water, water kicks up), the helicopter sways in in mid-air, the rotors animate, and so on. It may not be perfectly realistic or what you're looking for, but it does make the dust kicking effects and it tilts in mid air, so this is at least a big step forward.
[QUOTE=russduck;15797108]That helicopter is so unrealistic and crappy looking. [url]http://www.garrysmod.org/downloads/?a=view&id=60791[/url] That one is like flying the HL2 helicopter. The gun charges, the mines are WAY better (not some shitty cluster bomb), the kills track back to you (and not #combine_helicopter), dust kicks up (and if over water, water kicks up), the helicopter sways in in mid-air, the rotors animate, and so on. It may not be perfectly realistic or what you're looking for, but it does make the dust kicking effects and it tilts in mid air, so this is at least a big step forward.[/QUOTE] That's is why I said it was the best i could offer and not that it is realistic.
You guys seem to be missing the mark here... I don't necessarily want really nice effects or cannons up the ass, it would be nice though; anything that uses the W key as forward is the opposite of what I want. the W key needs to be "up" and the heli needs to provide downward thrust and act like it's life depends on it; not just levitate there and only move if and only if you push the forward button. I'm going to be blunt, unless it is only slightly different than what I want then I don't want to hear about it. :keke:
Crysis has good helicopter controls.
How does that help me?
Well, it doesnt. So there. :|
:ughh: Are you going to add anything to that sweaty? Or are you going to leave me with a short, stupid statement stating the obvious. Help would be nice. And am I not being clear? If so, tell me so I can try to rectify the situation.
Couple things. "sweaty" means that I'm covered in sweat. Sweet refers to the taste/quality. also - If you really want to code something like this, do it. You seem to know exactly what you want. Post for help, I'm sure we can get you some.
Because any help I get will be miles over my head. That's why. :wink:
[QUOTE=b00ce;15820262]How does that help me?[/QUOTE] People were talking about how the helicopter should be controlled. [editline]12:21AM[/editline] [QUOTE=b00ce;15820832]:ughh: Are you going to add anything to that sweaty? Or are you going to leave me with a short, stupid statement stating the obvious.[/QUOTE] You asked a question that may or may not be rhetorical.
b00ce, I hate to say it, but it's probably time for you to start learning Lua. It's really very simple, to the point where things become a lot harder to do. :|
I'm at that point, but I can't manage to make any breakthroughs. I can make simple SWEPS, that's it.
make a swep that spawns a working helicopter the way you want it.
No, that would fall under the purview of making a helicopter that I want. Not to mention I would need to make a SWEP on top of that, a pointless gesture if you ask me.
But it doesn't sounds nearly as stupid as it is, does it?
It does. Now more on the topic. How would I go about scripting this if I were to attempt said venture?
Sorry, you need to Log In to post a reply to this thread.