• Garry's mod modding weapon issue
    9 replies, posted
I have been coding a small project for Garry's mod, all 2 of my paint ball guns give me a Lua error whenever I shot then, I hear the firing sound but the not the splat sound Also it appears that the "paint" instead of the bullet hole, nothing appears that is another issue. These are the errors I get from each one. ERROR: Trying to derive entity paint_ball from non existant entity base_gmodentity! ERROR: Trying to derive entity paint_ball from non existant entity base_gmodentity! [ERROR] lua/weapons/paintball_swep/shared.lua:98: bad argument #1 to 'SetAngles' (Angle expected, got userdata) 1. SetAngles - [C]:-1 2. unknown - lua/weapons/paintball_swep/shared.lua:98 ERROR: Trying to derive entity paint_ball from non existant entity base_gmodentity! ----------------------------------------------------------------------------------------------------------------------------------- ERROR: Trying to derive entity paint_ball_rocket from non existant entity base_gmodentity! ERROR: Trying to derive entity paint_ball_rocket from non existant entity base_gmodentity! [ERROR] lua/weapons/paintball_rocket/shared.lua:73: bad argument #1 to 'SetAngles' (Angle expected, got userdata) 1. SetAngles - [C]:-1 2. unknown - lua/weapons/paintball_rocket/shared.lua:73 ERROR: Trying to derive entity paint_ball_rocket from non existant entity base_gmodentity! I really need help and I want to fix this before i move on in the process of my gamemode.
It seems you try to put a vector into ENT:SetAngles. Amd change youe entity base to base_anim
[QUOTE=Robotboy655;43144338]It seems you try to put a vector into ENT:SetAngles. Amd change youe entity base to base_anim[/QUOTE] As I am a beginner I do not understand almost everything you said but I did find stuff that might be useful to edit I don't really know And I have no idea how to change entity base function SWEP:PrimaryAttack() if ( !self:CanPrimaryAttack() ) then return end self.Weapon:EmitSound(Sound( "marker/pbfire.wav" )) self.Weapon:SetNextPrimaryFire( CurTime() + 0.10 ) self:ShootEffects() self:TakePrimaryAmmo( 1 ) local pb = ents.Create("paint_ball") local shotpos = self.Owner:GetShootPos() shotpos = shotpos + self.Owner:GetForward() * 5 shotpos = shotpos + self.Owner:GetRight() * 10 shotpos = shotpos + self.Owner:GetUp() * -10.0 pb:SetPos(shotpos) pb:SetAngles(Angle 20, 90, 0) pb:SetOwner(self.Owner) pb:Spawn() if SERVER then local phys = pb:GetPhysicsObject() phys:ApplyForceCenter(self.Owner:GetAimVector() * 30000 ) end end function SWEP:ShootEffects() self.Weapon:SendWeaponAnim( ACT_VM_PRIMARYATTACK ) self.Owner:SetAnimation( PLAYER_ATTACK1 ) end
1) [code] tags. 2) pb:SetAngles(Angle( 20, 90, 0) ) 3) Replace ENT.Base in your paintball entity fRom "gmod_baseentity" to "base_anim"
-ninja'd god dammit-
[QUOTE=Robotboy655;43144468]1) [code] tags. 2) pb:SetAngles(Angle( 20, 90, 0) ) 3) Replace ENT.Base in your paintball entity fRom "gmod_baseentity" to "base_anim"[/QUOTE] Thank you I was able to fix the ENT.Base, but now I have a new issue. [ERROR] lua/weapons/paintball_smg/shared.lua:86: attempt to call a nil value 1. unknown - lua/weapons/paintball_smg/shared.lua:86 This is line 86, pb:SetAngles(Angle( 20, 90, 0) ) 3) Before it was saying that unknown symbol near 3 [ERROR] lua/weapons/paintball_smg/shared.lua:86: unexpected symbol near '3' 1. unknown - lua/weapons/paintball_smg/shared.lua:0 I have tried to put 3 like (3) instead of ) 3) but that doesn't work.
pb:SetAngles( Angle( 20, 90, 0 ) ) You copied too much, thx to Facepunch for fucking up newlines again.
[QUOTE=Robotboy655;43144654]pb:SetAngles( Angle( 20, 90, 0 ) ) You copied too much, thx to Facepunch for fucking up newlines again.[/QUOTE] Well that fixed my problem, but as soon as I shot, my console got lighted up with this, [ERROR] lua/entities/paint_ball/cl_init.lua:29: attempt to index global 'mathx' (a nil value) 1. unknown - lua/entities/paint_ball/cl_init.lua:29 Line 29, lcolor.x = self.Color.r * mathx.Clamp( lcolor.x, 0, 1 )
mathx.* doesn't exist, use math.*
and please use [code] tags.
Sorry, you need to Log In to post a reply to this thread.