• Change bullet impact force?
    10 replies, posted
I find it sort of annoying when I shoot people with SWEPs and they do triple backflips and land 50 feet from where they were before. I want my SWEPs to have more realistic impact effects. How can I accomplish this? Thanks. And please be as specific as possible.
I'm GUESSING its a part of the actual swep, maybe edit the swep? xD
[QUOTE=rockstar91;22669856]I'm GUESSING its a part of the actual swep, maybe edit the swep? xD[/QUOTE] I'm sure it's part of the actual SWEP. But I don't know how to change a SWEP's impact force.
its a .lua file right? Well if it has an edited impact force, im guessing its just the case of finding it somewhere in the file and changing a number xD , I doubt it would be named to randomly?
[QUOTE=rockstar91;22669939]its a .lua file right? Well if it has an edited impact force, im guessing its just the case of finding it somewhere in the file and changing a number xD , I doubt it would be named to randomly?[/QUOTE] I looked for a line that changes impact force and could find none. Do you know how to access bullet force? i.e. what variable it is?
Nope, not a clue. Could you post the code here?
[QUOTE=rockstar91;22670082]Nope, not a clue. Could you post the code here?[/QUOTE] Here's one [CODE]local HitImpact = function(attacker, tr, dmginfo) local hit = EffectData() hit:SetOrigin(tr.HitPos) hit:SetNormal(tr.HitNormal) hit:SetScale(20) -- I tried changing this. No effect. util.Effect("effect_hit", hit) return true end /*---------------------------------------------------------*/ if (SERVER) then AddCSLuaFile("shared.lua") SWEP.HoldType = "ar2" end if (CLIENT) then SWEP.PrintName = "M-14" SWEP.ViewModelFOV = 70 SWEP.Slot = 3 SWEP.SlotPos = 1 SWEP.IconLetter = "w" killicon.AddFont("weapon_real_cs_m4a1", "CSKillIcons", SWEP.IconLetter, Color( 255, 80, 0, 255 )) end SWEP.Instructions = "Hold your use key and press secondary fire to change fire modes." SWEP.Base = "kermite_base_snip" SWEP.Category = "Kermite's Sniper Rifles Weapons" SWEP.Spawnable = true SWEP.AdminSpawnable = true SWEP.ViewModel = "models/weapons/v_snip_m14a1.mdl" SWEP.WorldModel = "models/weapons/w_snip_m14a1.mdl" SWEP.Primary.Sound = Sound("weapons/m14/sg550-1.wav") SWEP.Primary.Damage = 100 SWEP.Primary.Recoil = 5.5 SWEP.Primary.NumShots = 20 SWEP.Primary.Cone = 0.0052 SWEP.Primary.ClipSize = 20 SWEP.Primary.Delay = 0.50 SWEP.Primary.DefaultClip = 30 SWEP.Primary.Automatic = true SWEP.Primary.Ammo = "pistol" SWEP.IronSightZoom = 1.8 SWEP.ScopeZooms = {2} SWEP.IronSightsPos = Vector (3.4979, -18.8359, 0.919) SWEP.IronSightsAng = Vector (-17.6507, 13.2229, 24.933) SWEP.data = {} SWEP.mode = "semi" SWEP.data.semi = {} SWEP.data.auto = {} [/CODE]And the kermite_base_snip shared.lua: [code] -- Read the weapon_real_base if you really want to know what each action does if (SERVER) then AddCSLuaFile("cl_init.lua") AddCSLuaFile("shared.lua") end /*--------------------------------------------------------- Muzzle Effect + Shell Effect ---------------------------------------------------------*/ SWEP.MuzzleEffect = "rg_muzzle_highcal" -- This is an extra muzzleflash effect -- Available muzzle effects: rg_muzzle_grenade, rg_muzzle_highcal, rg_muzzle_hmg, rg_muzzle_pistol, rg_muzzle_rifle, rg_muzzle_silenced, none SWEP.ShellEffect = "rg_shelleject_rifle" -- This is a shell ejection effect -- Available shell eject effects: rg_shelleject, rg_shelleject_rifle, rg_shelleject_shotgun, none SWEP.MuzzleAttachment = "1" -- Should be "1" for CSS models or "muzzle" for hl2 models SWEP.ShellEjectAttachment = "2" -- Should be "2" for CSS models or "1" for hl2 models /*-------------------------------------------------------*/ SWEP.Base = "kermite_base" SWEP.ViewModelFOV = 60 SWEP.Spawnable = false SWEP.AdminSpawnable = false SWEP.Primary.Sound = Sound("Weapon_AK47.Single") SWEP.Primary.Recoil = 0 SWEP.Primary.Damage = 0 SWEP.Primary.NumShots = 0 SWEP.Primary.Cone = 0 SWEP.Primary.UnscopedCone = 0 SWEP.Primary.Delay = 0 SWEP.Primary.Automatic = false SWEP.Primary.ClipSize = 0 SWEP.Primary.DefaultClip = 0 SWEP.Primary.Ammo = "none" SWEP.Secondary.ClipSize = 0 SWEP.Secondary.DefaultClip = 0 SWEP.Secondary.Automatic = false SWEP.Secondary.Ammo = "none" --------------------------- -- Ironsight/Scope -- --------------------------- -- IronSightsPos and IronSightsAng are model specific paramaters that tell the game where to move the weapon viewmodel in ironsight mode. SWEP.IronSightZoom = 1.2 SWEP.ScopeZooms = {5,10} SWEP.UseScope = true SWEP.ScopeScale = 0.4 SWEP.DrawParabolicSights = false /*--------------------------------------------------------- ResetVars ---------------------------------------------------------*/ function SWEP:ResetVars() self.NextSecondaryAttack = 0 self.bLastIron = false self.Weapon:SetNetworkedBool("Ironsights", false) if self.UseScope then self.CurScopeZoom = 1 self.fLastScopeZoom = 1 self.bLastScope = false self.Weapon:SetNetworkedBool("Scope", false) self.Weapon:SetNetworkedBool("ScopeZoom", self.ScopeZooms[1]) end if self.Owner then self.OwnerIsNPC = self.Owner:IsNPC() -- This ought to be better than getting it every time we fire end end -- We need to call ResetVars() on these functions so we don't whip out a weapon with scope mode or insane recoil right of the bat or whatnot function SWEP:Holster(wep) self:ResetVars() return true end function SWEP:Equip(NewOwner) self:ResetVars() return true end function SWEP:OnRemove() self:ResetVars() return true end function SWEP:OnDrop() self:ResetVars() return true end function SWEP:OwnerChanged() self:ResetVars() return true end function SWEP:OnRestore() self:ResetVars() return true end /*--------------------------------------------------------- Initialize ---------------------------------------------------------*/ local sndZoomIn = Sound("Weapon_AR2.Special1") local sndZoomOut = Sound("Weapon_AR2.Special2") local sndCycleZoom = Sound("Default.Zoom") function SWEP:Initialize() if (SERVER) then self:SetWeaponHoldType(self.HoldType) end if CLIENT then -- We need to get these so we can scale everything to the player's current resolution. local iScreenWidth = surface.ScreenWidth() local iScreenHeight = surface.ScreenHeight() -- The following code is only slightly riped off from Night Eagle -- These tables are used to draw things like scopes and crosshairs to the HUD. self.ScopeTable = {} self.ScopeTable.l = iScreenHeight*self.ScopeScale self.ScopeTable.x1 = 0.5*(iScreenWidth + self.ScopeTable.l) self.ScopeTable.y1 = 0.5*(iScreenHeight - self.ScopeTable.l) self.ScopeTable.x2 = self.ScopeTable.x1 self.ScopeTable.y2 = 0.5*(iScreenHeight + self.ScopeTable.l) self.ScopeTable.x3 = 0.5*(iScreenWidth - self.ScopeTable.l) self.ScopeTable.y3 = self.ScopeTable.y2 self.ScopeTable.x4 = self.ScopeTable.x3 self.ScopeTable.y4 = self.ScopeTable.y1 self.ParaScopeTable = {} self.ParaScopeTable.x = 0.5*iScreenWidth - self.ScopeTable.l self.ParaScopeTable.y = 0.5*iScreenHeight - self.ScopeTable.l self.ParaScopeTable.w = 2*self.ScopeTable.l self.ParaScopeTable.h = 2*self.ScopeTable.l self.ScopeTable.l = (iScreenHeight + 1)*self.ScopeScale -- I don't know why this works, but it does. self.QuadTable = {} self.QuadTable.x1 = 0 self.QuadTable.y1 = 0 self.QuadTable.w1 = iScreenWidth self.QuadTable.h1 = 0.5*iScreenHeight - self.ScopeTable.l self.QuadTable.x2 = 0 self.QuadTable.y2 = 0.5*iScreenHeight + self.ScopeTable.l self.QuadTable.w2 = self.QuadTable.w1 self.QuadTable.h2 = self.QuadTable.h1 self.QuadTable.x3 = 0 self.QuadTable.y3 = 0 self.QuadTable.w3 = 0.5*iScreenWidth - self.ScopeTable.l self.QuadTable.h3 = iScreenHeight self.QuadTable.x4 = 0.5*iScreenWidth + self.ScopeTable.l self.QuadTable.y4 = 0 self.QuadTable.w4 = self.QuadTable.w3 self.QuadTable.h4 = self.QuadTable.h3 self.LensTable = {} self.LensTable.x = self.QuadTable.w3 self.LensTable.y = self.QuadTable.h1 self.LensTable.w = 2*self.ScopeTable.l self.LensTable.h = 2*self.ScopeTable.l self.CrossHairTable = {} self.CrossHairTable.x11 = 0 self.CrossHairTable.y11 = 0.5*iScreenHeight self.CrossHairTable.x12 = iScreenWidth self.CrossHairTable.y12 = self.CrossHairTable.y11 self.Cr
Hmm, The first thing that sprang to mind was the damn scale, then i read your comment xD maybe try SWEP.Primary.Damage = 100 SWEP.Primary.Cone = 0.0052 ? Maybe its damage related? , Havn't got a clue what cone is? maybe the spread of the bullet? maybe increase it?
Post kermite_base
he has? in post #7 right?
Oops, the problem was actually with an unrelated weapons script in my init.lua Can now change force with bullet.Force, which in this case is in kermite_base (in case anyone's searching for the answer to this question sometime)
Sorry, you need to Log In to post a reply to this thread.