Skip to content

Projectile Base, How to...

Vuthakral edited this page Oct 24, 2019 · 1 revision

Draconic Projectile Base

Still a little barebones, but will have more added to it in the future.
The projectile base is a simple entity that functions off of a string to define the "type" of the projectile, as recognized by what is coded within the projectile base. Here is a list of the currently recognized strings:

  • point
  • grenade
  • magazine
  • explosive

Here is a summary of what each string will make a projectile do:

  • point type projectile
    "Point" projectiles are simple projectiles that will be removed on impact. Can be used to make arcing bullets, piercing shells, or whatever else you can think of. I don't want to be the limit of your creativity.

  • grenade type projectile
    "Grenade" projectiles are nothing more than a physics object which will explode after the fuse time (described in settings below) has passed from it being spawned.

  • magazine type projectile
    "Magazine" """""projectiles"""" are just simple physics debris objects which are intended to be assigned to the SWEP.MagazineEntity = "" setting in a gun. They will spawn & drop to the floor when a player reloads their weapon, hen used in SWEP.MagazineEntity. They will not collide with players, NPCs, other entities, doors, or etc as to prevent physics crashing issues. They will automatically despawn after 15 seconds. Automatically inherits players current velocity.

  • explosive type projectile
    Explosive projectiles just explode on impact. Not really much more to say. They generate a generic explosion effect upon contact with solid objects. They will float in water and later explode upon coming into contact with a physical object.


Settings

  • ENT.Damage = 75 // The raw damage a player / NPC / object will be dealt upon being hit by this projectile (on touch)
  • ENT.Mass = 1 // Mass of the projectile
  • ENT.Force = 5 // Physics for the projectile will have on objects it impacts (such as physics props / entities)
  • ENT.Gravity = true // Whether or not the projectile is affected by gravity
  • ENT.ProjectileType = "explosive" // String setting to define how the projectile should act.
  • ENT.ExplodeShakePower = 25 // Power of a screen shake effect from a generated explosion
  • ENT.ExplodeShakeTime = 0.5 // How long (in seconds) the screen should shake for
  • ENT.ExplodeShakeDistance = 500 // the distance (in hammer units) people should be affected by a screen shake effect
  • ENT.FuseTime = 5 // For the grenade projectile type only, how long (in seconds) after being created will the grenade explode?

How to actually make your projectile work on your SWEP?

Primary Attack:

SWEP.Primary.Projectile			 = nil
SWEP.Primary.ProjSpeed			 = 750
SWEP.Primary.ProjInheritVelocity = false

Secondary Attack:

SWEP.Secondary.Projectile			 = ""
SWEP.Secondary.ProjSpeed			 = 750
SWEP.Secondary.ProjInheritVelocity = true
SWEP.Secondary.ProjectileSpawnDelay = 0

(Spawn delay was added solely for the ar2 example, not gonna lie.)

Mag Drop on Reload:

SWEP.MagazineEntity			= ""
Clone this wiki locally