Player.TraceHullAttack

From GMod Wiki

Jump to: navigation, search
Function
Syntax Player:TraceHullAttack( Vector StartPos, Vector EndPos, Vector SizeMin, Vector SizeMax, Integer Damage, Enum DamageType, Float DamageForce, Boolean DamageAnyNPC )
Where is this used?
Description:
Does a trace hull attack, as would be used in a beam or melee weapon.
Returns: Entity
Part of Library: Player
Realm: NewerServer.png
BBCode Link: [b][url=http://wiki.garrysmod.com/?title=Player.TraceHullAttack]Player.TraceHullAttack [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b]



Example

DescriptionThis is how you would use it for a common SWEP
Used onNewerServer.png
Code
 
ply:TraceHullAttack( ply:GetShootPos(),
ply:GetAimVector() * 120,
Vector( -16, -16, -16),
Vector( 36, 36, 36),
100,
DMG_AIRBOAT,
200,
true)
 
OutputTraces a line between the player and a point in front of them. If something is picked up by the trace, 100 damage is dealt to it.


Damagetype Enums

SHARED | 0000000000000000 | 0000000000000000000000000000000 | DMG_GENERIC -- Generic damage.
SHARED | 0000000000000001 | 0000000000000000000000000000001 | DMG_CRUSH -- Damage from props.
SHARED | 0000000000000002 | 0000000000000000000000000000010 | DMG_BULLET -- Damage from bullets.
SHARED | 0000000000000004 | 0000000000000000000000000000100 | DMG_SLASH -- Damage from most melee attacks (that scratch, lacerate, or cut).
SHARED | 0000000000000008 | 0000000000000000000000000001000 | DMG_BURN -- Burn damage (e.g. Igniting something and noclipping in it).
SHARED | 0000000000000016 | 0000000000000000000000000010000 | DMG_VEHICLE
SHARED | 0000000000000032 | 0000000000000000000000000100000 | DMG_FALL -- Damage from high falls.
SHARED | 0000000000000064 | 0000000000000000000000001000000 | DMG_BLAST -- Damage from explosives (ear-ringing effect).
SHARED | 0000000000000128 | 0000000000000000000000010000000 | DMG_CLUB -- Damage from some enemy melee attacks (blunt or unarmed) e.g. Combine melee attack.
SHARED | 0000000000000256 | 0000000000000000000000100000000 | DMG_SHOCK -- Damage from electricity (creates sparks and puff of smoke at damage position).
SHARED | 0000000000000512 | 0000000000000000000001000000000 | DMG_SONIC -- Damage from supersonic objects (unused).
SHARED | 0000000000001024 | 0000000000000000000010000000000 | DMG_ENERGYBEAM -- Damage from energy beams (unused).
SHARED | 0000000000002048 | 0000000000000000000100000000000 | DMG_PREVENT_PHYSICS_FORCE
SHARED | 0000000000004096 | 0000000000000000001000000000000 | DMG_NEVERGIB
SHARED | 0000000000008192 | 0000000000000000010000000000000 | DMG_ALWAYSGIB
SHARED | 0000000000016384 | 0000000000000000100000000000000 | DMG_DROWN -- Drowning damage.
SHARED | 0000000000032768 | 0000000000000001000000000000000 | DMG_PARALYZE -- Damage from paralyzing.
SHARED | 0000000000065536 | 0000000000000010000000000000000 | DMG_NERVEGAS -- Damage from nervegas. (GLaDOS's gas from the ending of Portal)
SHARED | 0000000000131072 | 0000000000000100000000000000000 | DMG_POISON -- Damage from poison (e.g. black headcrabs).
SHARED | 0000000000262144 | 0000000000001000000000000000000 | DMG_RADIATION -- Damage from radiation (Geiger counter will also go off).
SHARED | 0000000000524288 | 0000000000010000000000000000000 | DMG_DROWNRECOVER -- ? (unused) Perhaps health regained after surfacing.
SHARED | 0000000001048576 | 0000000000100000000000000000000 | DMG_ACID -- Damage from dangerous acids. (gives a light-cyan flash ingame)
SHARED | 0000000002097152 | 0000000001000000000000000000000 | DMG_SLOWBURN
SHARED | 0000000004194304 | 0000000010000000000000000000000 | DMG_REMOVENORAGDOLL
SHARED | 0000000008388608 | 0000000100000000000000000000000 | DMG_PHYSGUN -- Damage from the Gravity Gun (e.g. pushing headcrabs).
SHARED | 0000000016777216 | 0000001000000000000000000000000 | DMG_PLASMA -- Turns the player's screen dark and plays sounds until the player's next footstep.
SHARED | 0000000033554432 | 0000010000000000000000000000000 | DMG_AIRBOAT -- Damage from airboat gun.
SHARED | 0000000067108864 | 0000100000000000000000000000000 | DMG_DISSOLVE -- Damage from combine stuff like combine balls and the core.
SHARED | 0000000134217728 | 0001000000000000000000000000000 | DMG_BLAST_SURFACE 
SHARED | 0000000268435456 | 0010000000000000000000000000000 | DMG_DIRECT -- Damage from being on fire.(DMG_BURN relates to external sources hurting you)
SHARED | 0000000536870912 | 0100000000000000000000000000000 | DMG_BUCKSHOT -- Damage from shotguns. (basically the same as DMG_BULLET)
Personal tools
Namespaces
Variants
Actions
Navigation
Lua Scripting
Functions
Hooks
Toolbox