Garry's Mod

Garry's Mod

WAC Aircraft
topdog864 Aug 12, 2020 @ 8:34pm
When I spawn WAC from lua and use "SetAngles" to specify the angle of the plane the weapons fire in the direction they would've if I hadn't specified an angle.
if game.GetMap() == "gm_spoon" then Spoon = true else Spoon = false end PLANE_SPAWNS = { "wac_pl_a10", } hook.Add("TTTPrepareRound", "PrepPhaseVehicleAdd", function() if Spoon == true then local Plane = ents.Create(PLANE_SPAWNS[math.random(#PLANE_SPAWNS)]) Plane:SetPos( Vector( 11106.74, -10513.47, -6143.97 ) ) Plane:SetAngles(Angle( 0, -153, 0) ) Plane:Spawn() Plane:Activate() Plane:SetSkin(math.random(0,3)) return end end )

I have looked through the lua base for WAC and have found the following
function ENT:fireBullet(pos) if !self:takeAmmo(1) then return end local bullet = {} bullet.Num = 1 bullet.Src = self.aircraft:LocalToWorld(pos) bullet.Dir = self:GetForward() bullet.Spread = Vector(0.015,0.015,0) bullet.Tracer = self.Tracer bullet.Force = self.Force bullet.Damage = self.Damage bullet.Attacker = self:getAttacker() local effectdata = EffectData() effectdata:SetOrigin(bullet.Src) effectdata:SetAngles(self:GetAngles()) effectdata:SetScale(1.5) util.Effect("MuzzleEffect", effectdata) self.aircraft:FireBullets(bullet) end

I've tried pasting this command in the lua file that spawns the planes and modifying the file to get the bullets to change but I have been unsuccessful.

The only piece of information I could find in regards to spawning wac with lua is here. (For whatever reason when I click the link directly it dosen't work but if I copy and paste it in a new tab the page will load if the problem also persists for you.) However it does not go over the issue I am experiencing.