• Im making a gmod swep. And the weapons position is weird
    6 replies, posted
Soo i was making a gmod swep. But i tried to use a downloaded gmod prop and turn it into a weapon. The outcome of this were that the weapon spawned inside me Q_Q meh.. And how do i change the position and holding angle of the weapon ?? Heres the lua script: ________________________ //General Settings \\ SWEP.AdminSpawnable = true // Is the swep spawnable for admin SWEP.ViewModelFOV = 140 // How much of the weapon do u see ? SWEP.ViewModel = "models/weapons/V_ninja.mdl" // The viewModel, the model you se when you are holding it-.- SWEP.WorldModel = "models/weapons/V_ninja.mdl" // The worlmodel, The model yu when it's down on the ground SWEP.AutoSwitchTo = true // when someone walks over the swep, chould i automatectly change to your swep ? SWEP.Slot = 1 // Deside wich slot you want your swep do be in 1 2 3 4 5 6 SWEP.HoldType = "melee" // How the swep is hold Pistol smg grenade melee SWEP.PrintName = "Beejay is ninja" // your sweps name SWEP.Author = "Beejay" // Your name SWEP.Spawnable = false // Can everybody spawn this swep ? - If you want only admin keep this false and adminsapwnable true. SWEP.AutoSwitchFrom = false // Does the weapon get changed by other sweps if you pick them up ? SWEP.FiresUnderwater = true // Does your swep fire under water ? SWEP.Weight = 6 // Chose the weight of the Swep SWEP.DrawCrosshair = false // Do you want it to have a crosshair ? SWEP.Category = "Beejay" // Make your own catogory for the swep SWEP.SlotPos = 1 // Deside wich slot you want your swep do be in 1 2 3 4 5 6 SWEP.DrawAmmo = no // Does the ammo show up when you are using it ? True / False SWEP.ReloadSound = "Weapon_Pistol.Reload" // Reload sound, you can use the default ones, or you can use your one; Example; "sound/myswepreload.waw" SWEP.Instructions = "Hit those guys!" // How do pepole use your swep ? SWEP.Contact = "Debbeyaa@gmail.com" // How Pepole chould contact you if they find bugs, errors, etc SWEP.Purpose = "Killing people?!" // What is the purpose with this swep ? SWEP.base = "weapon_base" //General settings\\ //PrimaryFire Settings\\ SWEP.Primary.Sound = "Weapon_Crowbar.Single" // The sound that plays when you shoot :] SWEP.Primary.Damage = 1337 // How much damage the swep is doing SWEP.Primary.TakeAmmo = 0 // How much ammo does it take for each shot ? SWEP.Primary.ClipSize = 0 // The clipsize SWEP.Primary.Ammo = "crowbar" // ammmo type pistol/ smg1 SWEP.Primary.DefaultClip = 0 // How much ammo does the swep come with `? SWEP.Primary.Spread = 0.1 // Does the bullets spread all over, if you want it fire exactly where you are aiming leave it o.1 SWEP.Primary.NumberofShots = 1 // How many bullets you are firing each shot. SWEP.Primary.Automatic = true // Is the swep automatic ? SWEP.Primary.Recoil = 0 // How much we should punch the view SWEP.Primary.Delay = 1 // How long time before you can fire again SWEP.Primary.Force = 50 // The force of the shot //PrimaryFire settings\\ //Secondary Fire Variables\\ SWEP.Secondary.NumberofShots = 1 // How many explosions for each shot SWEP.Secondary.Force = 100 // Explosions Force SWEP.Secondary.Spread = 0.1 // How much the explosion does spread SWEP.Secondary.Sound = "Weapon_Mortar.Single" // Fire sound SWEP.Secondary.DefaultClip = 32 // How much ammo the secoindary swep comes with SWEP.Secondary.Automatic = false // Is it automactic ? SWEP.Secondary.Ammo = "rpg_round" // Leave as Pistol ! SWEP.Secondary.Recoil = 2 // How uch we should punch the view SWEP.Secondary.Delay = 3 // How long you have to wait before fire a new shot SWEP.Secondary.TakeAmmo = 1 // How much ammo Does it take ? SWEP.Secondary.ClipSize = 100 // ClipSize SWEP.Secondary.Damage = 10000 -- The damage the explosion does. SWEP.Secondary.Magnitude = "75" -- How big its the explosion ? //Secondary Fire Variables\\ //SWEP:Initialize()\\ function SWEP:Initialize() util.PrecacheSound(self.Primary.Sound) util.PrecacheSound(self.Secondary.Sound) if ( SERVER ) then self:SetWeaponHoldType( self.HoldType ) end end //SWEP:Initialize()\\ //SWEP:PrimaryFire()\\ function SWEP:PrimaryAttack() if ( !self:CanPrimaryAttack() ) then return end local bullet = {} bullet.Num = self.Primary.NumberofShots bullet.Src = self.Owner:GetShootPos() bullet.Dir = self.Owner:GetAimVector() bullet.Spread = Vector( self.Primary.Spread * 0.1 , self.Primary.Spread * 0.1, 0) bullet.Tracer = 0 bullet.Force = self.Primary.Force bullet.Damage = self.Primary.Damage bullet.AmmoType = self.Primary.Ammo local rnda = self.Primary.Recoil * -1 local rndb = self.Primary.Recoil * math.random(-1, 1) self:ShootEffects() self.Owner:FireBullets( bullet ) self.Weapon:EmitSound(Sound(self.Primary.Sound)) self.Owner:ViewPunch( Angle( rnda,rndb,rnda ) ) self:TakePrimaryAmmo(self.Primary.TakeAmmo) self.Weapon:SetNextPrimaryFire( CurTime() + self.Primary.Delay ) self.Weapon:SetNextSecondaryFire( CurTime() + self.Primary.Delay ) end //SWEP:PrimaryFire()\\ //SWEP:SecondaryFire()\\ function SWEP:SecondaryAttack() if ( !self:CanSecondaryAttack() ) then return end local rnda = -self.Secondary.Recoil local rndb = self.Secondary.Recoil * math.random(-1, 1) self.Owner:ViewPunch( Angle( rnda,rndb,rnda ) ) local eyetrace = self.Owner:GetEyeTrace() self.Weapon:EmitSound ( self.Secondary.Sound ) self:ShootEffects() local explode = ents.Create("env_explosion") explode:SetPos( eyetrace.HitPos ) explode:SetOwner( self.Owner ) explode:Spawn() explode:SetKeyValue("iMagnitude","175") explode:Fire("Explode", 0, 0 ) explode:EmitSound("weapon_AWP.Single", 400, 400 ) self.Weapon:SetNextPrimaryFire( CurTime() + self.Secondary.Delay ) self.Weapon:SetNextSecondaryFire( CurTime() + self.Secondary.Delay ) self:TakePrimaryAmmo(self.Secondary.TakeAmmo) end //SWEP:SecondaryFire()\\
there may be a problem with the model itself. have you tried with another model to see if they are in the same place? if the model is then could be something to do with the lua . but i assume the model isnt parented to the hand bones, or even has bones. also, is it the viewmodel or the worldmodel you have problems with?
Its the viewmodels that i have problems is. The world model is fine and working, but yeah there is no bones at all...
you'll have to use SoftImage XSI Mod Tool 7.5 to add bones. im sure i saw a tut on adding bones a while ago - i go hunting then - heres for the Mod Tool: [url]http://developer.valvesoftware.com/wiki/Softimage_Mod_Tool[/url] :smile: its quite complex to be honest, so you may not want to use it if it is too difficult or confusing to use. also, do you have any screenshots of the problem, specifically the viewmodel itself? You may possibly be able to see the viewmodel using the SWEP construction tool which lets modify viewmodels and worldmodels, as seen here: [URL="http://www.facepunch.com/threads/1032378-SWEP-Construction-Kit-developer-tool-for-modifying-viewmodels-ironsightshttp://"]http://www.facepunch.com/threads/1032378-SWEP-Construction-Kit-developer-tool-for-modifying-viewmodels-ironsights[/URL]
[QUOTE=EpicExplosion;31272994]you'll have to use SoftImage XSI Mod Tool 7.5 to add bones. im sure i saw a tut on adding bones a while ago - i go hunting then - heres for the Mod Tool: [url]http://developer.valvesoftware.com/wiki/Softimage_Mod_Tool[/url] :smile: its quite complex to be honest, so you may not want to use it if it is too difficult or confusing to use. also, do you have any screenshots of the problem, specifically the viewmodel itself? You may possibly be able to see the viewmodel using the SWEP construction tool which lets modify viewmodels and worldmodels, as seen here: [URL="http://www.facepunch.com/threads/1032378-SWEP-Construction-Kit-developer-tool-for-modifying-viewmodels-ironsightshttp://"]http://www.facepunch.com/threads/1032378-SWEP-Construction-Kit-developer-tool-for-modifying-viewmodels-ironsights[/URL][/QUOTE] Thank you
:smile: glad to be of service.
Can i just add, please use [noparse][lua] [/lua][/noparse] tags when you are posting code, it makes it a lot easier for us to read, thanks :smile:
Sorry, you need to Log In to post a reply to this thread.