Skip to content

Projectile Base: Overview & Examples

Vuthakral edited this page Mar 15, 2022 · 1 revision

Overview

On this page, you will find several working examples of full entity lua files for Draconic Projectiles from various existing addons. At the bottom of this page, there is a description for what each individual setting does which the base provides.

Raw Code Paste #1

This is the code from the Draconic Halo UNSC SWEPs addon's SPNKr rocket. It provides an example of how to create a rocket with custom lua/particle effects.

Click to reveal code block
ENT.Base	= "draconic_projectile_base"

ENT.PrintName		= "SPNKr Rocket"
ENT.Author			= "Vuthakral"

ENT.Model = "models/vuthakral/halo/weapons/spnkr_rocket.mdl"

ENT.ProjectileType		 = "lua_explosive"
ENT.Damage 				 = 225
ENT.DamageType 			 = DMG_BLAST
ENT.Mass				 = 50
ENT.Gravity 			 = false
ENT.ExplodePressure		 = 5
ENT.AffectRadius		 = 300
ENT.ExplodeShakePower 	 = 25
ENT.ExplodeShakeTime  	 = 0.5	
ENT.ExplodeShakeDistance = 500

ENT.LoopingSound		= "drc.SPNKr_rocket_flight"
ENT.ExplodeSoundNear	= "drc.SPNKr_rocket_explode"
ENT.ExplodeSoundFar		= "drc.SPNKr_rocket_explode_dist"


ENT.SpawnEffect		= "drc_halo_spnkr_rocket_flash"
ENT.Effect			= "drc_halo_spnkr_rocket"
ENT.LuaExplEffect	= "drc_halo_spnkr_rocket_explode"

ENT.TrailMat		= "effects/draconic_halo/hunter_beam"
ENT.TrailColor		= Color(255, 255, 0)
ENT.TrailAdditive	= true
ENT.TrailStartWidth	= 30
ENT.TrailEndWidth	= 0
ENT.TrailLifeTime	= 0.1

ENT.SpriteMat		= "sprites/glow04_noz"
ENT.SpriteWidthMin	= 20
ENT.SpriteWidthMax	= 25
ENT.SpriteHeightMin = 20
ENT.SpriteHeightMax = 25
ENT.SpriteColor		= Color(200, 200, 20)

ENT.Light			= true
ENT.LightColor		= Color(150, 100, 0)
ENT.LightBrightness	= 2.5
ENT.LightRange		= 250
ENT.LightType		= 0

Raw Code Paste #2

This is from the needler needle of the Draconic Halo Covenant SWEPs, which provides an example of how to set up an automatically-tracking projectile.

Click to reveal code block.
ENT.Base	= "draconic_projectile_base"

ENT.PrintName		= "needle_t33"
ENT.Author			= "Vuthakral"

ENT.Model = "models/vuthakral/halo/weapons/w_needle.mdl"

ENT.Damage 	= 3
ENT.Mass	= 1
ENT.Force	= 5
ENT.Gravity = false
ENT.ProjectileType	= "supercombine"
ENT.ExplosionType	= "lua"

ENT.Tracking		= true
ENT.TrackFraction	= 0.75

ENT.SuperCombineRequirement		= 7
ENT.SuperDamage					= 100
ENT.SuperDamageType 			= DMG_BLAST
ENT.SuperCombineType 			= "lua"
ENT.SuperExplodePressure		= 5
ENT.SuperExplodeShakePower 		= 5
ENT.SuperExplodeShakeTime  		= 0.5	
ENT.SuperExplodeShakeDistance 	= 500

ENT.ExplodeSoundNear	= "drc.Needler_explosion"
ENT.ExplodeSoundFar		= ""

ENT.ENearSC	= "drc.Needler_supercombine"

ENT.ExplodeShakePower 		= 0
ENT.ExplodeShakeTime  		= 0	
ENT.ExplodeShakeDistance 	= 0

ENT.FuseTime	= 5
ENT.ExplodePressure			= 0

ENT.AffectRadius	= 10
ENT.SuperAffectRadius	= 35

ENT.SpawnEffect		= nil
ENT.Effect			= nil
ENT.LuaExplEffect	= "drc_halo_nr_impact"
ENT.LuaExplEffect	= "drc_halo_nr_impact"
ENT.SuperLuaExplEffect	= "drc_halo_ne_sc"

ENT.SpriteMat		= "sprites/glow04_noz"
ENT.SpriteWidthMin	= 50
ENT.SpriteWidthMax	= 40
ENT.SpriteHeightMin = 10
ENT.SpriteHeightMax = 15
ENT.SpriteColor		= Color(255, 0, 255)

ENT.TrailMat		= "effects/draconic_halo/hunter_beam"
ENT.TrailColor		= Color(255, 0, 255)
ENT.TrailAdditive	= true
ENT.TrailStartWidth	= 10
ENT.TrailEndWidth	= 0
ENT.TrailLifeTime	= 0.3

Explanation on all projectile base settings:

  • ENT.PrintName = "Name of Your Entity -- The name which would show up in the spawn menu if this entity were spawnable.
  • ENT.Author = "Your Name -- The name of the author of the projectile
  • ENT.Category = "Draconic Projectiles" -- Set to your category as it would appear in the spawnmenu.
  • ENT.Spawnable = false -- Generally should be left to false, as this prevents it from showing up in the spawnmenu.
  • ENT.AdminSpawnable = false -- Make it so only admins can spawn this entity from the spawnmenu (still requires ENT.Spawnable = true to work.)


  • ENT.Model = "path/to/model.mdl" -- Model the projectile uses. MUST be forward-facing.
  • ENT.HideModel = true/false -- Whether or not the model should be drawn
  • ENT.HideShadow = true/false -- Whether or not the model's shadow should be drawn


  • ENT.Mass = nil -- The mass of the projectile entity


  • ENT.Damage = 25 -- The flat damage value the projectile will deal on impact. Or scaled down from the center of an explosion.
  • ENT.DamageType = DMG_GENERIC -- https://wiki.facepunch.com/gmod/Enums/DMG
  • ENT.Force = 5 -- Extra force to apply to physics objects on impact. Mass of the object can already cause a decent impact force.
  • ENT.Gravity = true/false -- Whether or not the projectile should be affected by gravity
  • ENT.DoesRadialDamage = true/false-- Whether or not the projectile does damage to objects it passes by. Damage scales outwards from the center based on ENT.Damage.
  • ENT.ProjectileType = "point" -- https://github.com/Vuthakral/Draconic_Base/wiki/Projectile-Base:-Types-of-Projectiles
  • ENT.Explosive = true/false -- Whether or not this projectile explodes.
  • ENT.ExplosionType = "hl2" -- "hl2", "lua", or "Scripted". This value is more often than not handled internally. Read the "Projectile Types" page for more in-depth information.
  • ENT.RemoveInWater = true/false -- Self explanatory.


  • ENT.EMP = true/false -- Whether or not this projectile has EMP properties. Shuts down any vehicles it hits, and strips players/NPCs/nextbots of armour or shields.
  • ENT.EMPTime = 5 -- How long the EMP effect lasts on vehicles
  • ENT.EMPSound = "sound.name" -- Sound to play when an EMP is triggered


  • ENT.TimerFrequency = 1 -- How long (in seconds) for scripted effects to occur between. Affects how often fire ticks damage and other radial passive effects.
  • ENT.GravitySpherePower = 0 -- Force to be applied outwards from the proejctile every tick of ENT.TimerFrequency. Positive values push away while negative ones pull things in.


  • ENT.Tracking = true/false -- Whether or not this projectile entity natively tracks targets.
  • ENT.TrackType = "Tracking" -- "Tracking" or "Guided". Tracking types move towards an entity or towards a given position. Guided moves towards where the user is aiming.
  • ENT.TrackFraction = 0.5 -- The "fraction" of how much angle deviation the projectile should have whenever it updates. A value of 0.5 means it will angle halfway towards its target every time it updates, providing a nice realistic tracking curve for missiles. A fraction of 1 makes it turn rapidly, but still gradually. The higher you go, the faster the projectile will arc towards its target and become harder to avoid.


  • ENT.SuperCombineRequirement = 0 -- Number of projectiles needed of this type to cause a supercombine. Only works on projectiles with the type supercombine, read more here: https://github.com/Vuthakral/Draconic_Base/wiki/Projectile-Base:-Types-of-Projectiles#supercombine
  • ENT.SuperDamage = 100 -- Damage a supercombine explosion should do
  • ENT.SuperAffectRadius = 0.0001 -- The distance (in hammer units) which is affected in a radius from the projectile.
  • ENT.SuperDamageType = DMG_GENERIC -- https://wiki.facepunch.com/gmod/Enums/DMG
  • ENT.SuperCombineType = "hl2" -- "hl2", "lua", or "Scripted"
  • ENT.SuperExplodePressure = 100 -- "Pressure" the explosion should have behind it. This is the physical force with which the explosion will hurl objects affected by it.
  • ENT.SuperExplodeShakePower = 5 -- "Power" of the screen shake effect
  • ENT.SuperExplodeShakeTime = 0.5 -- Time (in seconds) for the screen shake to last
  • ENT.SuperExplodeShakeDistance = 500 -- Distance (in hammer units) for the screen shake to affect players by.


  • ENT.ExplodeShakePower = 5 -- "Power" of the screen shake effect
  • ENT.ExplodeShakeTime = 0.5 --Time (in seconds) for the screen shake to last
  • ENT.ExplodeShakeDistance = 500 -- Distance (in hammer units) for the screen shake to affect players by.


  • ENT.FuseTime = 5 -- Time (in seconds) it takes for a fuse to burn down which triggers the explosive properties of a projectile.
  • ENT.ManualDetonation = true/false -- Whether or not this projectile requires manual custom code input (firing self:Detonate()) to trigger an explosion.
  • ENT.DetonateSoundNear = nil -- The sound which plays in normal space when detonating. (E.g. a remote detonator beeping)
  • ENT.DetonateSoundFar = nil -- The sound which plays in distant space when detonating. (E.g. a warning siren)
  • ENT.DetonationDelay = 1 -- Time (in seconds) for the detonation to take before triggering the explosion. (Unaffected by ENT.FuseTime as this is basically its own system.)


  • ENT.LoopingSound = "sound.name" -- The looping sound for this projectile to emit while it exists.
  • ENT.ExplodeSoundNear = "sound.name" -- The primary "BOOM" in an explosion sound.
  • ENT.ExplodeSoundFar = "sound.name" -- The distant echo of an explosion sound.


  • ENT.ExplodePressure = 5 -- "Pressure" the explosion should have behind it. This is the physical force with which the explosion will hurl objects affected by it.
  • ENT.AffectRadius = 0.0001 -- The distance (in hammer units) which is affected in a radius from the projectile.


  • ENT.SpawnEffect = "nameofeffect" -- Particle or lua effect to be created when this projectile is spawned.
  • ENT.Effect = "nameofeffect" -- Particle or lua effect to be created every tick on the projectile
  • ENT.LuaExplEffect = "nameofeffect" -- The particle or lua effect to be created when a lua explosion is triggered on a projectile.
  • ENT.SuperLuaExplEffect = "nameofeffect -- The particle or lua effect to be created when a supercombine explosion is triggered.
  • ENT.ImpactEffect = "nameofeffect" -- The particle or lua effect to be created when the projectile impacts with something. (e.g. explosion effects)
  • ENT.ImpactSound = "sound.name" -- The sound to emit when the projectile impacts with something. Not to be confused with ENT.ExplodeSoundNear. This triggers on non-explosive projectiles.


  • ENT.TrailMat = "material" -- Trail #1 material
  • ENT.TrailColor = Color(255, 255, 255) -- Self explanatory
  • ENT.TrailAdditive = true/false -- Self explanatory
  • ENT.TrailStartWidth = 20 -- Self explanatory
  • ENT.TrailEndWidth = 0 -- Self explanatory
  • ENT.TrailLifeTime = 1 -- Self explanatory


  • ENT.TrailMat2 = "material" -- Trail #2 material
  • ENT.TrailColor2 = Color(255, 255, 255) -- Self explanatory
  • ENT.TrailAdditive2 = true/false -- Self explanatory
  • ENT.TrailStartWidth2 = 20 -- Self explanatory
  • `ENT.TrailEndWidth2 = 0`` -- Self explanatory
  • ENT.TrailLifeTime2 = 1 -- Self explanatory




  • ENT.SpriteMat = "materialname" -- Spite #1 material path
  • ENT.SpriteWidthMin = 10 -- Min width
  • ENT.SpriteWidthMax = 10 -- Max width
  • ENT.SpriteHeightMin = 10 -- Min height
  • ENT.SpriteHeightMax = 10 -- Max height; these four values allow you to create a random flickering effect for the sprites attached to your projectile.
  • ENT.SpriteColor = Color(0, 255, 0) -- Self explanatory


  • ENT.SpriteMat2 = "materialname" -- Spite #1 material path
  • ENT.SpriteWidthMin2 = 10 -- Min width
  • ENT.SpriteWidthMax2 = 10 -- Max width
  • ENT.SpriteHeightMin2 = 10 -- Min height
  • ENT.SpriteHeightMax2 = 10 -- Max height; these four values allow you to create a random flickering effect for the sprites attached to your projectile.
  • ENT.SpriteColor2 = Color(0, 255, 0) -- Self explanatory
Clone this wiki locally