I’m thinking about creating a SWep that will change the DIRECTION of gravity for selected objects, or yourself. This is my first SWep, so expect it to be buggy.
If this actually makes progress, I will post pictures, and maybe a movie, if someone can film it.
I know how to make a simple SWep, but I cannot find any tutorials on making one that creates an entity when shot.
The way I see this SWep works, is that it first finds the angles perpendicular to the surface you are looking at when you fire it. It then removes the object’s gravity, and applies force to that object equal to that of the map’s gravity, in the direction you specified when you fired the gun at the surface.
I do not know how to do any of this besides the base SWep, so can someone TEACH me how I can do this in pieces, I wish to make the SWep, not you.
The first thing I want to know how to do is the perpendicular angles function.
SWEP.Author = "Copperbotte" SWEP.Contact = "n/a" SWEP.Purpose = "Gravity Changing" SWEP.Instructions = "Primary changes your gravity's direction to the plane you are looking at, secondary moves it away." SWEP.Category = "Copperbotte's SWeps" SWEP.Spawnable = false SWEP.AdminSpawnable = true SWEP.ViewModel = "models/weapons/v_pistol.mdl" SWEP.WorldModel = "models/weapons/w_pistol.mdl" SWEP.Primary.ClipSize = 8 SWEP.Primary.DefaultClip = 20 SWEP.Primary.Automatic = false SWEP.Primary.Ammo = "pistol" SWEP.Secondary.ClipSize = -1 SWEP.Secondary.DefaultClip = -1 SWEP.Secondary.Automatic = false SWEP.Secondary.Ammo = "none" SWEP.Sound = Sound ("weapons/pistol.wav") SWEP.Damage = 50 SWEP.Spread = 0.02 SWEP.NumBul = 1 SWEP.Delay = 0.6 SWEP.Force = 3 function SWEP:Deploy() return true end function SWEP:Holster() return true end function SWEP:Think() end function SWEP:PrimaryAttack() if ( !self:CanPrimaryAttack() ) then return end if ( !self:CanSecondaryAttack() ) then return end end function SWEP:SecondaryAttack() if ( !self:CanPrimaryAttack() ) then return end if ( !self:CanSecondaryAttack() ) then return end end function SWEP:Reload() self.Weapon:DefaultReload( ACT_VM_RELOAD ) end
this is the only code I have, besides the default cl_init.lua and init.lua. this is the shared.lua file.