• 3D Maneuver Gear script error
    6 replies, posted
After finally getting this working, I found out that it gives off a script errors related to ironsights (common with grapple hook like addons) and another error I am unfamiliar with. Please don't recommend other addons as I'm looking to get help fixing this. That wont solve the issue at hand. [ERROR] gamemodes/terrortown/gamemode/weaponry_shd.lua:12: attempt to compare number with string 1. IsEquipment - gamemodes/terrortown/gamemode/weaponry_shd.lua:12 2. unknown - gamemodes/terrortown/gamemode/weaponry.lua:24 3. Give - [C]:-1 4. GiveEquipmentWeapon - gamemodes/terrortown/gamemode/weaponry.lua:319 5. unknown - gamemodes/terrortown/gamemode/weaponry.lua:323 [ERROR] gamemodes/terrortown/gamemode/util.lua:107: attempt to index field 'dt' (a number value) 1. GetIronsights - gamemodes/terrortown/gamemode/util.lua:107 2. unknown - gamemodes/terrortown/gamemode/player.lua:1082 Inside /gamemodes/terrortown/gamemode/entities/weapons/3dgear: shared.lua [lua] SWEP.PrintName = "3D Maneuver Gear" SWEP.Author = "Darkfortune, OldDeath" SWEP.Contact = "olddeath1@gmx.net" SWEP.Purpose = "Swinging around and killing Titans." SWEP.Instructions = "Leftclick for Grappling Hook and Rightclick for dealing damage." SWEP.Category = "Attack on Titan" SWEP.Spawnable = true SWEP.AdminSpawnable = true SWEP.Base = "weapon_tttbase" SWEP.ViewModelFlip = false SWEP.Slot = 6 SWEP.Kind = "WEAPON_EQUIP1" SWEP.DrawAmmo = false SWEP.DrawCrosshair = true SWEP.ViewModel = "models/aot/c_aot_model_sword.mdl" SWEP.WorldModel = "models/aot/w_snk_sword.mdl" SWEP.Icon = "vgui/entities/3dgear" SWEP.AutoSwitchTo = true SWEP.Weight = 100 SWEP.UseHands = true SWEP.CanBuy = { ROLE_DETECTIVE } SWEP.Secondary.Damage = 0 SWEP.Secondary.NumShots = -1 SWEP.Secondary.Recoil = 0 SWEP.Secondary.ClipSize = -1 SWEP.Secondary.DefaultClip = -1 SWEP.Secondary.TakeAmmoPerBullet = false SWEP.Secondary.Automatic = true SWEP.Secondary.Ammo = "none" SWEP.WElements = { ["3dgear"] = { type = "Model", model = "models/aot/3dgear.mdl", bone = "ValveBiped.Bip01_Pelvis", rel = "", pos = Vector(0, 0, -3), angle = Angle(90, 0, -90), size = Vector(1, 1, 1), color = Color(255, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} }, ["left_sword"] = { type = "Model", model = "models/aot/w_snk_sword.mdl", bone = "ValveBiped.Bip01_L_Hand", rel = "", pos = Vector(0, 2.2, 0), angle = Angle(270, 90, 180), size = Vector(1, 1, 1), color = Color(255, 255, 255, 255), surpresslightning = false, material = "", skin = 0, bodygroup = {} } } local SwingSound = Sound( "weapons/iceaxe/iceaxe_swing1.wav" ) local HitSound = Sound( "physics/flesh/flesh_impact_bullet3.wav" ) local hooksound = Sound( "aot/hookshootsound.wav" ) function SWEP:Initialize() nextshottime = CurTime() self:SetWeaponHoldType( "melee" ) if CLIENT then // Create a new table for every weapon instance self.VElements = table.FullCopy( self.VElements ) self.WElements = table.FullCopy( self.WElements ) self.ViewModelBoneMods = table.FullCopy( self.ViewModelBoneMods ) self:CreateModels(self.VElements) // create viewmodels self:CreateModels(self.WElements) // create worldmodels // init view model bone build function if IsValid(self.Owner) then local vm = self.Owner:GetViewModel() if IsValid(vm) then self:ResetBonePositions(vm) // Init viewmodel visibility if (self.ShowViewModel == nil or self.ShowViewModel) then vm:SetColor(Color(255,255,255,255)) else // we set the alpha to 1 instead of 0 because else ViewModelDrawn stops being called vm:SetColor(Color(255,255,255,1)) // ^ stopped working in GMod 13 because you have to do Entity:SetRenderMode(1) for translucency to kick in // however for some reason the view model resets to render mode 0 every frame so we just apply a debug material to prevent it from drawing vm:SetMaterial("Debug/hsv") end end end end end SWEP.AttackAnims = { "hitcenter1", "hitcenter2", "hitcenter3" } function SWEP:Think() if (!self.Owner || self.Owner == NULL) then return end if ( self.Owner:KeyPressed( IN_ATTACK ) ) then self:StartAttack() elseif ( self.Owner:KeyDown( IN_ATTACK ) && inRange ) then self:UpdateAttack() elseif ( self.Owner:KeyReleased( IN_ATTACK ) && inRange ) then self:EndAttack( true ) end if ( self.Owner:KeyPressed( IN_ATTACK2 ) ) then self:Attack2() end --[[ if !self.Owner:OnGround() then if SERVER then if( self.Owner:KeyDown( IN_SPEED ) ) then self.Owner:SetVelocity(Angle(-25,self.Owner:EyeAngles().y,0):Forward()*15) end end end if !self.Owner:OnGround() then if SERVER then if( self.Owner:KeyDown( IN_SPEED ) ) then self.Owner:EmitSound(Sound( "ambient/levels/canals/dam_water_loop2.wav" )) else self.Owner:StopSound(Sound( "ambient/levels/canals/dam_water_loop2.wav" )) end end end]] end function SWEP:DoTrace( endpos ) local trace = {} trace.start = self.Owner:GetShootPos() trace.endpos = trace.start + (self.Owner:GetAimVector() * 14096) if(endpos) then trace.endpos = (endpos - self.Tr.HitNormal * 7) end trace.filter = { self.Owner, self.Weapon } self.Tr = nil self.Tr = util.TraceLine( trace ) end function SWEP:StartAttack() local gunPos = self.Owner:GetShootPos() local disTrace = self.Owner:GetEyeTrace() local hitPos = disTrace.HitPos local x = (gunPos.x - hitPos.x)^2; local y = (gunPos.y - hitPos.y)^2; local z = (gunPos.z - hitPos.z)^2; local distance = math.sqrt(x + y + z); local distanceCvar = GetConVarNumber("aot_rope_distance") inRange = false if distance <= distanceCvar then inRange = true end if inRange then if (SERVER) then if (!self.Beam) then self.Beam = ents.Create( "aot_rope" ) self.Beam:SetPos( self.Owner:GetShootPos() ) self.Beam:Spawn() end self.Beam:SetParent( self.Owner ) self.Beam:SetOwner( self.Owner ) self.Owner:EmitSound( hooksound ) end self:DoTrace() self.speed = 10000 self.startTime = CurTime() self.endTime = CurTime() + self.speed self.dt = -1 if (SERVER && self.Beam) then self.Beam:GetTable():SetEndPos( self.Tr.HitPos ) end self:UpdateAttack() else end end function SWEP:UpdateAttack() self.Owner:LagCompensation( true ) if (!endpos) then endpos = self.Tr.HitPos end if (SERVER && self.Beam) then self.Beam:GetTable():SetEndPos( endpos ) end lastpos = endpos if ( self.Tr.Entity:IsValid() ) then endpos = self.Tr.Entity:GetPos() if ( SERVER ) then self.Beam:GetTable():SetEndPos( endpos ) end end local vVel = (endpos - self.Owner:GetPos()) local Distance = endpos:Distance(self.Owner:GetPos()) local et = (self.startTime + (Distance/self.speed)) if(self.dt != 0) then self.dt = (et - CurTime()) / (et - self.startTime) end if(self.dt < 0) then self.dt = 0 end if(self.dt == 0) then zVel = self.Owner:GetVelocity().z vVel = vVel:GetNormalized()*(math.Clamp(Distance,0,7)) if( SERVER ) then local gravity = GetConVarNumber("sv_Gravity") vVel:Add(Vector(0,0,(gravity/100)*1.5)) if(zVel < 0) then vVel:Sub(Vector(0,0,zVel/100)) end self.Owner:SetVelocity(vVel) end end endpos = nil self.Owner:LagCompensation( false ) end function SWEP:EndAttack( shutdownsound ) if ( CLIENT ) then return end if ( !self.Beam ) then return end self.Beam:Remove() self.Beam = nil end function SWEP:Attack2() end function SWEP:Holster() if CLIENT and IsValid(self.Owner) then local vm = self.Owner:GetViewModel() if IsValid(vm) then self:ResetBonePositions(vm) end end self:EndAttack( false ) return true end function SWEP:OnRemove() self:Holster()
Why are you constantly comparing values to "keyword operator?"
[QUOTE=code_gs;44196310]Why are you constantly comparing values to "keyword operator?"[/QUOTE] That's the forum messing stuff up.
[QUOTE=code_gs;44196310]Why are you constantly comparing values to "keyword operator?"[/QUOTE] I remember seeing another thread where this happened and said the same thing. I was told that it's apparently an issue with Facepunch, so while it makes the code very messy to read, I don't think it means anything
Oh, it's been copy/pasted AFTER the forum messed it up. [editline]11th March 2014[/editline] My automerge :(
I have no idea what the error is :P I myself cannot see it. Anyhow, back to the issue at hand :)
Bumping for actual help
Sorry, you need to Log In to post a reply to this thread.