Garry's Mod Wiki

Entity

This is a list of all available methods for all entities, which includes Players, Weapons, NPCs and Vehicles.

For a list of possible members of Scripted Entities see ENT Structure

Methods

Entity:Activate()
Activates the entity. This needs to be used on some entities (like constraints) after being spawned. For some entity types when this function is used after Entity:SetModelScale, the physics object will be recreated with the new scale. Source-sdk-2013This crashes the game with scaled vehicles.
number Entity:AddCallback( string hook, function func )
Add a callback function to a specific event. This is used instead of hooks to avoid calling empty functions unnecessarily. This also allows you to use certain hooks in engine entities (non-scripted entities). This method does not check if the function has already been added to this object before, so if you add the same callback twice, it will be run twice! Make sure to add your callback only once.
Entity:AddEffects( number effect )
Applies an engine effect to an entity. See also Entity:IsEffectActive and Entity:RemoveEffects.
Entity:AddEFlags( number flag )
Adds engine flags.
Entity:AddFlags( number flag )
Adds flags to the entity.
number Entity:AddGesture( number activity, boolean autokill = true )
Adds a gesture animation to the entity and plays it. See Entity:AddGestureSequence and Entity:AddLayeredSequence for functions that takes sequences instead of Enums/ACT. This function only works on BaseAnimatingOverlay entites!
number Entity:AddGestureSequence( number sequence, boolean autokill = true )
Adds a gesture animation to the entity and plays it. See Entity:AddGesture for a function that takes Enums/ACT. See also Entity:AddLayeredSequence. This function only works on BaseAnimatingOverlay entites!
number Entity:AddLayeredSequence( number sequence, number priority )
Adds a gesture animation to the entity and plays it. See Entity:AddGestureSequence for a function that doesn't take priority. See Entity:AddGesture for a function that takes Enums/ACT. This function only works on BaseAnimatingOverlay entites!
Entity:AddSolidFlags( number flags )
Adds solid flag(s) to the entity.
Entity:AddToMotionController( PhysObj physObj )
Adds a PhysObject to the entity's motion controller so that ENTITY:PhysicsSimulate will be called for given PhysObject as well. You must first create a motion controller with Entity:StartMotionController. You can remove added PhysObjects by using Entity:RemoveFromMotionController. Only works on a scripted Entity of anim type
Angle Entity:AlignAngles( Angle from, Angle to )
Returns an angle based on the ones inputted that you can use to align an object. This function doesn't change the angle of the entity on its own (see example).
CSEnt Entity:BecomeRagdollOnClient()
Spawns a clientside ragdoll for the entity, positioning it in place of the original entity, and makes the entity invisible. It doesn't preserve flex values (face posing) as CSRagdolls don't support flex. It does not work on players. Use Player:CreateRagdoll instead. The original entity is not removed, and neither are any ragdolls previously generated with this function. To make the entity re-appear, run Entity:SetNoDraw( false )
boolean Entity:BeingLookedAtByLocalPlayer()
Returns true if the entity is being looked at by the local player and is within 256 units of distance.
Entity:Blocked( Entity entity )
This is used internally - although you're able to use it you probably shouldn't. Dispatches blocked events to this entity's blocked handler. This function is only useful when interacting with entities like func_movelinear.
Vector Entity:BodyTarget( Vector origin, boolean noisy = false )
Returns a centered vector of this entity, NPCs use this internally to aim at their targets. This only works on players and NPCs.
boolean Entity:BoneHasFlag( number boneID, number flag )
Returns whether the entity's bone has the flag or not.
number Entity:BoneLength( number boneID )
Returns the length between given bone's position and the position of given bone's parent.
number Entity:BoundingRadius()
Returns the distance between the center of the bounding box and the furthest bounding box corner.
Entity:CallOnRemove( string identifier, function removeFunc, vararg argn... )
Causes a specified function to be run if the entity is removed by any means. This can later be undone by Entity:RemoveCallOnRemove if you need it to not run. Using players with this function will provide a gimped entity to the callback.
Entity:ClearPoseParameters()
Resets all pose parameters such as aim_yaw, aim_pitch and rotation.
Entity:CollisionRulesChanged()
Declares that the collision rules of the entity have changed, and subsequent calls for GM:ShouldCollide with this entity may return a different value than they did previously. This function must not be called inside of GM:ShouldCollide. Instead, it must be called in advance when the condition is known to change.Failure to use this function correctly will result in a crash of the physics engine.
boolean Entity:CreatedByMap()
Returns whether the entity was created by map or not.
CNewParticleEffect Entity:CreateParticleEffect( string particle, number attachment, table options = nil )
Creates a clientside particle system attached to the entity. See also CreateParticleSystem The particle effect must be precached with PrecacheParticleSystem and the file its from must be added via game.AddParticles before it can be used!
Entity:CreateShadow()
Draws the shadow of an entity.
Entity:DeleteOnRemove( Entity entityToRemove )
Whenever the entity is removed, entityToRemove will be removed also.
Entity:DestroyShadow()
Removes the shadow for the entity. The shadow will be recreated as soon as the entity wakes. Doesn't affect shadows from flashlight/lamps/env_projectedtexture.
Entity:DisableMatrix( string matrixType )
Disables an active matrix.
Entity:DispatchTraceAttack( CTakeDamageInfo damageInfo, table traceRes, Vector dir = traceRes.HitNormal )
Performs a trace attack. Calling this function on the victim entity in ENTITY:OnTakeDamage can cause infinite loops.
Entity:DontDeleteOnRemove( Entity entityToUnremove )
This removes the argument entity from an ent's list of entities to 'delete on remove'
Entity:DrawModel()
Draws the entity or model. If called inside ENTITY:Draw or ENTITY:DrawTranslucent, it only draws the entity's model itself. If called outside of those hooks, it will call both of said hooks depending on Entity:GetRenderGroup, drawing the entire entity again. When drawing an entity more than once per frame in different positions, you should call Entity:SetupBones before each draw; Otherwise, the entity will retain its first drawn position.This is a rendering function that requires a 3d rendering context. T..
Entity:DrawShadow( boolean shouldDraw )
Sets whether an entity's shadow should be drawn.
Entity:DropToFloor()
Move an entity down until it collides with something. The entity needs to already have something below it within 256 units.
Entity:DTVar( string Type, number ID, string Name )
This is used internally - although you're able to use it you probably shouldn't. You should use Entity:NetworkVar instead Sets up a self.dt.NAME alias for a Data Table variable.
Entity:EmitSound( string soundName, number soundLevel = 75, number pitchPercent = 100, number volume = 1, number channel = CHAN_AUTO, CHAN_WEAPON for weapons )
Plays a sound on an entity. If run clientside, the sound will only be heard locally. If used on a player or NPC character with the mouth rigged, the character will "lip-sync". This does not work with all sound files. It is recommended to use sound scripts ( see sound.Add ) over direct file paths. This will allow you to use Entity:StopSound to stop the played sound scripts. When using this function with weapons, use the Weapon itself as the entity, not its owner!Do not use this for looping sounds..
Entity:EnableConstraints( boolean toggleConstraints )
Toggles the constraints of this ragdoll entity on and off.
Entity:EnableCustomCollisions( boolean useCustom )
Flags an entity as using custom lua defined collisions. Fixes entities having spongy player collisions or not hitting traces, such as after Entity:PhysicsFromMesh Internally identical to Entity:AddSolidFlags( bit.bor( FSOLID_CUSTOMRAYTEST, FSOLID_CUSTOMBOXTEST ) ) Do not confuse this function with Entity:SetCustomCollisionCheck, they are not the same.
Entity:EnableMatrix( string matrixType, VMatrix matrix )
Can be used to apply a custom VMatrix to the entity, mostly used for scaling the model by a Vector. To disable it, use Entity:DisableMatrix. If your old scales are wrong due to a recent update, use Entity:SetLegacyTransform as a quick fix. The matrix can also be modified to apply a custom rotation and offset via the VMatrix:SetAngles and VMatrix:SetTranslation functions.This does not scale procedural bones.This disables inverse kinematics of an entity.
number Entity:EntIndex()
Gets the unique entity index of an entity. Entity indices are marked as unused after deletion, and can be reused by newly-created entities
Entity:Extinguish()
Extinguishes the entity if it is on fire. Has no effect if called inside GM:EntityTakeDamage (and the attacker is the flame that's hurting the entity) See also Entity:Ignite.
Angle Entity:EyeAngles()
Returns the direction a player/npc/ragdoll is looking as a world-oriented angle. This can return an incorrect value in pods.This can return an incorrect value in jeeps when used with Player:EnterVehicle.
Vector Entity:EyePos()
Returns the position of an Player/NPC's view.
number Entity:FindBodygroupByName( string name )
Searches for bodygroup with given name.
number Entity:FindTransitionSequence( number currentSequence, number goalSequence )
Returns a transition from the given start and end sequence. This function was only used by HL1 entities and NPCs, before the advent of sequence blending and gestures.
Entity:Fire( string input, string param, number delay = 0 )
Fires an entity's input. You can find inputs for most entities on the Valve Developer Wiki See also Entity:Input and GM:AcceptInput.
Entity:FireBullets( table bulletInfo, boolean suppressHostEvents = false )
Fires a bullet. When used in a hook such as WEAPON:Think or WEAPON:PrimaryAttack, it will use Player:LagCompensation internally. Lag compensation will not work if this function is called in a timer, regardless if the timer was made in a hook.
Entity:FollowBone( Entity parent = NULL, number boneid )
Makes an entity follow another entity's bone. Internally this function calls Entity:SetParent( parent, boneid ) and Entity:AddEffects( EF_FOLLOWBONE ). If the entity vibrates, you probably need to run Entity:SetPredictable( false ) clientside.This function will not work if the target bone's parent bone is invalid or if the bone is not used by VERTEX LOD0
Entity:ForcePlayerDrop()
Forces the Entity to be dropped, when it is being held by a player's gravitygun or physgun.
Entity:FrameAdvance( number interval )
Advances the cycle of an animated entity. Animations that loop will automatically reset the cycle so you don't have to - ones that do not will stop animating once you reach the end of their sequence.
Vector Entity:GetAbsVelocity()
Returns the entity's velocity. Actually binds to CBaseEntity::GetLocalVelocity() which retrieves the velocity of the entity due to its movement in the world from forces such as gravity. Does not include velocity from entity-on-entity collision.
Angle Entity:GetAngles()
Gets the angles of given entity. This returns incorrect results for the local player clientside.This will return the local player's EyeAngles in rendering hooks.This will return Angle(0,0,0) in rendering hooks while paused in single-player.
table Entity:GetAnimInfo( number animIndex )
Returns a table containing the number of frames, flags, name, and FPS of an entity's animation ID. Animation ID is not the same as sequence ID.
number Entity:GetAnimTime()
Returns the last time the entity had an animation update. Returns 0 if the entity doesn't animate.
table Entity:GetAttachment( number attachmentId )
Gets the orientation and position of the attachment by its ID, returns nothing if the attachment does not exist. The update rate of this function is limited by the setting of ENT.AutomaticFrameAdvance for Scripted Entities!This will return improper values for viewmodels if used in GM:CalcView.
table Entity:GetAttachments()
Returns a table containing all attachments of the given entitys model. Returns an empty table or nil in case it's model has no attachments. This can have inconsistent results in single-player.
Vector Entity:GetBaseVelocity()
Returns the entity's base velocity which is their velocity due to forces applied by other entities. This includes entity-on-entity collision or riding a treadmill.
number Entity:GetBloodColor()
Returns the blood color of this entity. This can be set with Entity:SetBloodColor.
number Entity:GetBodygroup( number id )
Gets the exact value for specific bodygroup of given entity.
number Entity:GetBodygroupCount( number bodygroup )
Returns the count of possible values for this bodygroup. This is not the maximum value, since the bodygroups start with 0, not 1.
string Entity:GetBodygroupName( number id )
Gets the name of specific bodygroup for given entity.
table Entity:GetBodyGroups()
Returns a list of all bodygroups of the entity.
number Entity:GetBoneContents( number bone )
Returns the contents of the specified bone.
number Entity:GetBoneController( number boneID )
Returns the value of the bone controller with the specified ID. This is the precursor of pose parameters, and only works for Half Life 1: Source models supporting it.
number Entity:GetBoneCount()
Returns the amount of bones in the entity. Will return -1 for ClientsideModel or undrawn entities until Entity:SetupBones is called on the entity.
VMatrix Entity:GetBoneMatrix( number boneID )
Returns the transformation matrix of a given bone on the entity's model. The matrix contains the transformation used to position the bone in the world. It is not relative to the parent bone. This is equivalent to constructing a VMatrix using Entity:GetBonePosition. This can return the server's matrix during server lag.This can return garbage serverside or a 0,0,0 fourth column (represents position) for v49 models.
string Entity:GetBoneName( number index )
Returns name of given bone id.
number Entity:GetBoneParent( number bone )
Returns parent bone of given bone. Will return -1 for ClientsideModel until Entity:SetupBones is called on the entity.
Vector, Angle Entity:GetBonePosition( number boneIndex )
Returns the position and angle of the given attachment, relative to the world. This function can return entity's GetPos() instead if the entity doesn't have it's bone cache set up. To ensure the bone position is correct use this: local pos = ent:GetBonePosition(0) if pos == ent:GetPos() then pos = ent:GetBoneMatrix(0):GetTranslation() endThis can return garbage serverside or Vector(0,0,0) for v49 models.This can return garbage if a trace passed through the target bone during bone matrix access.
string Entity:GetBoneSurfaceProp( number bone )
Returns the surface property of the specified bone.
Vector, Vector, number Entity:GetBrushPlane( number id )
Returns info about given plane of non-nodraw brush model surfaces of the entity's model. Works on worldspawn as well. This only works on entities with brush models.
number Entity:GetBrushPlaneCount()
Returns the amount of planes of non-nodraw brush model surfaces of the entity's model.
table Entity:GetBrushSurfaces()
Returns a table of brushes surfaces for brush model entities.
table Entity:GetCallbacks( string hook )
Returns the specified hook callbacks for this entity added with Entity:AddCallback The callbacks can then be removed with Entity:RemoveCallback.
table Entity:GetChildBones( number boneid )
Returns ids of child bones of given bone.
table Entity:GetChildren()
Gets the children of the entity - that is, every entity whose move parent is this entity. This function returns Entity:SetMoveParent children, NOT Entity:SetParent! Entity:SetParent however also calls Entity:SetMoveParent. This means that some entities in the returned list might have a NULL Entity:GetParent. This also means that using this function on players will return their weapons on the client but not the server.
string Entity:GetClass()
Returns the classname of a entity. This is often the name of the Lua file or folder containing the files for the entity
Vector, Vector Entity:GetCollisionBounds()
Returns an entity's collision bounding box. In most cases, this will return the same bounding box as Entity:GetModelBounds unless the entity does not have a physics mesh or it has a PhysObj different from the default. This can be out-of-sync between the client and server for weapons.
number Entity:GetCollisionGroup()
Returns the entity's collision group
table Entity:GetColor()
Returns the color the entity is set to. The returned color will not have the color metatable.
Entity, Entity Entity:GetConstrainedEntities()
Returns the two entities involved in a constraint ent, or nil if the entity is not a constraint.
PhysObj, PhysObj Entity:GetConstrainedPhysObjects()
Returns the two entities physobjects involved in a constraint ent, or no value if the entity is not a constraint.
number Entity:GetCreationID()
Returns entity's creation ID. Unlike Entity:EntIndex or Entity:MapCreationID, it will always increase and old values won't be reused.
number Entity:GetCreationTime()
Returns the time the entity was created on, relative to CurTime.
Player Entity:GetCreator()
Gets the creator of the SENT.
boolean Entity:GetCustomCollisionCheck()
Returns whether this entity uses custom collision check set by Entity:SetCustomCollisionCheck.
number Entity:GetCycle()
Returns the frame of the currently played sequence. This will be a number between 0 and 1 as a representation of sequence progress.
Angle Entity:GetDTAngle( number key )
This is used internally - although you're able to use it you probably shouldn't. This is called internally by the Entity:NetworkVar system, you can use this in cases where using NetworkVar is not possible. Get an angle stored in the datatable of the entity.
boolean Entity:GetDTBool( number key )
This is used internally - although you're able to use it you probably shouldn't. This is called internally by the Entity:NetworkVar system, you can use this in cases where using NetworkVar is not possible. Get a boolean stored in the datatable of the entity.
Entity Entity:GetDTEntity( number key )
This is used internally - although you're able to use it you probably shouldn't. This is called internally by the Entity:NetworkVar system, you can use this in cases where using NetworkVar is not possible. Returns an entity stored in the datatable of the entity.
number Entity:GetDTFloat( number key )
This is used internally - although you're able to use it you probably shouldn't. This is called internally by the Entity:NetworkVar system, you can use this in cases where using NetworkVar is not possible. Get a float stored in the datatable of the entity.
number Entity:GetDTInt( number key )
This is used internally - although you're able to use it you probably shouldn't. This is called internally by the Entity:NetworkVar system, you can use this in cases where using NetworkVar is not possible. Get an integer stored in the datatable of the entity.
string Entity:GetDTString( number key )
This is used internally - although you're able to use it you probably shouldn't. This is called internally by the Entity:NetworkVar system, you can use this in cases where using NetworkVar is not possible. Get a string stored in the datatable of the entity.
Vector Entity:GetDTVector( number key )
This is used internally - although you're able to use it you probably shouldn't. This is called internally by the Entity:NetworkVar system, you can use this in cases where using NetworkVar is not possible. Get a vector stored in the datatable of the entity.
table Entity:GetEditingData()
Returns internal data about editable Entity:NetworkVars. This is used internally by DEntityProperties and Editable Entities system. This function will only work on entities which had Entity:InstallDataTable called on them, which is done automatically for players and all Scripted Entities
number Entity:GetEffects()
Returns a bit flag of all engine effect flags of the entity.
number Entity:GetEFlags()
Returns a bit flag of all engine flags of the entity.
number Entity:GetElasticity()
Returns the elasticity of this entity, used by some flying entities such as the Helicopter NPC to determine how much it should bounce around when colliding.
number Entity:GetFlags()
Returns all flags of given entity.
number, number Entity:GetFlexBounds( number flex )
Returns acceptable value range for the flex.
number Entity:GetFlexIDByName( string name )
Returns the ID of the flex based on given name.
string Entity:GetFlexName( number id )
Returns flex name.
number Entity:GetFlexNum()
Returns the number of flexes this entity has.
number Entity:GetFlexScale()
Returns the flex scale of the entity.
number Entity:GetFlexWeight( number flex )
Returns current weight ( value ) of the flex.
Vector Entity:GetForward()
Returns the forward vector of the entity, as a normalized direction vector
number Entity:GetFriction()
Returns how much friction an entity has. Entities default to 1 (100%) and can be higher or even negative.
number Entity:GetGravity()
Gets the gravity multiplier of the entity.
Entity Entity:GetGroundEntity()
Returns the object the entity is standing on.
Vector Entity:GetGroundSpeedVelocity()
Returns the entity's ground speed velocity, which is based on the entity's walk/run speed and/or the ground speed of their sequence ( Entity:GetSequenceGroundSpeed ). Will return an empty Vector if the entity isn't moving on the ground.
number Entity:GetHitBoxBone( number hitbox, number hboxset )
Gets the bone the hit box is attached to.
Vector, Vector Entity:GetHitBoxBounds( number hitbox, number group )
Gets the bounds (min and max corners) of a hit box.
number Entity:GetHitBoxCount( number group )
Gets how many hit boxes are in a given hit box group
number Entity:GetHitBoxGroupCount()
We advise against using this. It may be changed or removed in a future update. You should use Entity:GetHitboxSetCount instead. Returns the number of hit box sets that an entity has. Functionally identical to Entity:GetHitboxSetCount
number Entity:GetHitBoxHitGroup( number hitbox, number hitboxset )
Gets the hit group of a given hitbox in a given hitbox set.
number, string Entity:GetHitboxSet()
Returns entity's current hit box set
number Entity:GetHitboxSetCount()
Returns the amount of hitbox sets in the entity.
any Entity:GetInternalVariable( string VariableName )
An interface for accessing internal key values on entities. See Entity:GetSaveTable for a more detailed explanation. See Entity:SetSaveValue for the opposite of this function.
table Entity:GetKeyValues()
Returns a table containing all key values the entity has. Single key values can usually be retrieved with Entity:GetInternalVariable. This only includes engine defined key values. "targetname" is not an actual key value in-engine, use Entity:GetName for that instead. For custom key values, use GM:EntityKeyValue or ENTITY:KeyValue to capture and store them.Not all key values can be retrieved. Some of them are write-only.
number Entity:GetLayerCycle( number layerID )
Returns the animation cycle/frame for given layer. This function only works on BaseAnimatingOverlay entites!
number Entity:GetLayerDuration( number layerID )
Returns the duration of given layer. This function only works on BaseAnimatingOverlay entites!
number Entity:GetLayerPlaybackRate( number layerID )
Returns the layer playback rate. See also Entity:GetLayerDuration. This function only works on BaseAnimatingOverlay entites!
number Entity:GetLayerSequence( number layerID )
Returns the sequence id of given layer. This function only works on BaseAnimatingOverlay entites!
number Entity:GetLayerWeight( number layerID )
Returns the current weight of the layer. See Entity:SetLayerWeight for more information. This function only works on BaseAnimatingOverlay entites!Next update: is shared
Entity Entity:GetLightingOriginEntity()
Returns the entity that is being used as the light origin position for this entity.
Angle Entity:GetLocalAngles()
Returns the rotation of the entity relative to its parent entity.
Angle Entity:GetLocalAngularVelocity()
Returns the non-VPhysics angular velocity of the entity relative to its parent entity.
Vector Entity:GetLocalPos()
Returns entity's position relative to it's parent.
Angle Entity:GetManipulateBoneAngles( number boneID )
Gets the entity's angle manipulation of the given bone. This is relative to the default angle, so the angle is zero when unmodified.
number Entity:GetManipulateBoneJiggle( number boneID )
Returns the jiggle amount of the entity's bone. See Entity:ManipulateBoneJiggle for more info.
Vector Entity:GetManipulateBonePosition( number boneId )
Gets the entity's position manipulation of the given bone. This is relative to the default position, so it is zero when unmodified.
Vector Entity:GetManipulateBoneScale( number boneID )
Gets the entity's scale manipulation of the given bone. Normal scale is Vector( 1, 1, 1 )
string Entity:GetMaterial()
Returns the material override for this entity. Returns an empty string if no material override exists. Use Entity:GetMaterials to list it's default materials. The server's value takes priority on the client.
table Entity:GetMaterials()
Returns all materials of the entity's model. This function is unaffected by Entity:SetSubMaterial as it returns the original materials. The server's values take priority on the client.The table returned by this function will not contain materials if they are missing from the disk/repository. This means that if you are attempting to find the ID of a material to replace with Entity:SetSubMaterial and there are missing materials on the model, all subsequent materials will be offset in the table, meaning that..
number Entity:GetMaterialType()
Returns the surface material of this entity.
number Entity:GetMaxHealth()
Returns the max health that the entity was given. It can be set via Entity:SetMaxHealth.
string Entity:GetModel()
Gets the model of given entity. This does not necessarily return the model's path, as is the case for brush and virtual models. This is intentional behaviour, however, there is currently no way to retrieve the actual file path.
Vector, Vector Entity:GetModelBounds()
Returns the entity's model bounds. This is different than the collision bounds/hull. This is not scaled with Entity:SetModelScale, and will return the model's original, unmodified mins and maxs.
number Entity:GetModelContents()
Returns the contents of the entity's current model.
number Entity:GetModelPhysBoneCount()
Gets the physics bone count of the entity's model. This is only applicable to anim type Scripted Entities with ragdoll models.
number Entity:GetModelRadius()
Gets the models radius.
Vector, Vector Entity:GetModelRenderBounds()
Returns the entity's model render bounds. By default this will return the same bounds as Entity:GetModelBounds.
number Entity:GetModelScale()
Gets the selected entity's model scale.
number Entity:GetMomentaryRotButtonPos( Angle turnAngle )
Returns the amount a momentary_rot_button entity is turned based on the given angle. 0 meaning completely turned closed, 1 meaning completely turned open. This only works on momentary_rot_button entities.
number Entity:GetMoveCollide()
Returns the move collide type of the entity. The move collide is the way a physics object reacts to hitting an object - will it bounce, slide?
Entity Entity:GetMoveParent()
Returns the movement parent of this entity. See Entity:SetMoveParent for more info.
number Entity:GetMoveType()
Returns the entity's movetype
string Entity:GetName()
Returns the mapping name of this entity.
Angle Entity:GetNetworkAngles()
Gets networked angles for entity.
Angle Entity:GetNetworkedAngle( string key, Angle fallback = Angle( 0, 0, 0 ) )
We advise against using this. It may be changed or removed in a future update. You should use Entity:GetNWAngle instead. Retrieves a networked angle value at specified index on the entity that is set by Entity:SetNetworkedAngle.
boolean Entity:GetNetworkedBool( string key, boolean fallback = false )
We advise against using this. It may be changed or removed in a future update. You should use Entity:GetNWBool instead. Retrieves a networked boolean value at specified index on the entity that is set by Entity:SetNetworkedBool.
Entity Entity:GetNetworkedEntity( string key, Entity fallback = NULL )
We advise against using this. It may be changed or removed in a future update. You should use Entity:GetNWEntity instead. Retrieves a networked float value at specified index on the entity that is set by Entity:SetNetworkedEntity.
number Entity:GetNetworkedFloat( string key, number fallback = 0 )
We advise against using this. It may be changed or removed in a future update. You should use Entity:GetNWFloat instead. Retrieves a networked float value at specified index on the entity that is set by Entity:SetNetworkedFloat. Seems to be the same as Entity:GetNetworkedInt.
number Entity:GetNetworkedInt( string key, number fallback = 0 )
We advise against using this. It may be changed or removed in a future update. You should use Entity:GetNWInt instead. Retrieves a networked integer value at specified index on the entity that is set by Entity:SetNetworkedInt.
string Entity:GetNetworkedString( string key, string fallback )
We advise against using this. It may be changed or removed in a future update. You should use Entity:GetNWString instead. Retrieves a networked string value at specified index on the entity that is set by Entity:SetNetworkedString.
function Entity:GetNetworkedVarProxy( string name )
We advise against using this. It may be changed or removed in a future update. You should be using Entity:GetNWVarProxy instead. Returns callback function for given NWVar of this entity. Currently this function only works for the NW2Var system (accessed by adding a 2 in between Networked and Var for most NetworkedVar functions), which will replace the original one at some point in the future
table Entity:GetNetworkedVarTable()
We advise against using this. It may be changed or removed in a future update. You should be using Entity:GetNWVarTable instead. Returns all the networked variables in an entity.
Vector Entity:GetNetworkedVector( string key, Vector fallback = Vector( 0, 0, 0 ) )
We advise against using this. It may be changed or removed in a future update. You should use Entity:GetNWVector instead. Retrieves a networked vector value at specified index on the entity that is set by Entity:SetNetworkedVector.
Vector Entity:GetNetworkOrigin()
Gets networked origin for entity.
table Entity:GetNetworkVars()
Returns all network vars created by Entity:NetworkVar and Entity:NetworkVarElement and their current values. This is used internally by the duplicator. For NWVars see Entity:GetNWVarTable. This function will only work on entities which had Entity:InstallDataTable called on them, which is done automatically for players and all Scripted Entities
boolean Entity:GetNoDraw()
Returns if the entity's rendering and transmitting has been disabled. This is equivalent to calling Entity:IsEffectActive( EF_NODRAW )
number Entity:GetNumBodyGroups()
Returns the body group count of the entity.
number Entity:GetNumPoseParameters()
Returns the number of pose parameters this entity has.
any Entity:GetNWAngle( string key, any fallback = Angle( 0, 0, 0 ) )
Retrieves a networked angle value at specified index on the entity that is set by Entity:SetNWAngle.
any Entity:GetNWBool( string key, any fallback = false )
Retrieves a networked boolean value at specified index on the entity that is set by Entity:SetNWBool.
any Entity:GetNWEntity( string key, any fallback = NULL )
Retrieves a networked entity value at specified index on the entity that is set by Entity:SetNWEntity.
any Entity:GetNWFloat( string key, any fallback = 0 )
Retrieves a networked float value at specified index on the entity that is set by Entity:SetNWFloat.
any Entity:GetNWInt( string key, any fallback = 0 )
Retrieves a networked integer (whole number) value that was previously set by Entity:SetNWInt. This function will not round decimal values as it actually networks a float internally.
any Entity:GetNWString( string key, any fallback )
Retrieves a networked string value at specified index on the entity that is set by Entity:SetNWString.
function Entity:GetNWVarProxy( any key )
Returns callback function for given NWVar of this entity.
table Entity:GetNWVarTable()
Returns all the networked variables in an entity.
any Entity:GetNWVector( string key, any fallback = Vector( 0, 0, 0 ) )
Retrieves a networked vector value at specified index on the entity that is set by Entity:SetNWVector.
Entity Entity:GetOwner()
Returns the owner entity of this entity. See Entity:SetOwner for more info.
Entity Entity:GetParent()
Returns the parent entity of this entity.
number Entity:GetParentAttachment()
Returns the attachment index of the entity's parent. Returns 0 if the entity is not parented to a specific attachment or if it isn't parented at all. This is set by second argument of Entity:SetParent or the SetParentAttachment input.
number Entity:GetParentPhysNum()
If the entity is parented to an entity that has a model with multiple physics objects (like a ragdoll), this is used to retrieve what physics object number the entity is parented to on it's parent.
VMatrix Entity:GetParentWorldTransformMatrix()
Returns the position and angle of the entity's move parent as a 3x4 matrix (VMatrix is 4x4 so the fourth row goes unused). The first three columns store the angle as a rotation matrix, and the fourth column stores the position vector.
boolean Entity:GetPersistent()
Returns whether the entity is persistent or not. See Entity:SetPersistent for more information on persistence.
Player Entity:GetPhysicsAttacker( number timeLimit )
Returns player who is claiming kills of physics damage the entity deals.
PhysObj Entity:GetPhysicsObject()
Returns the entity's physics object, if the entity has physics. Entities don't have clientside physics objects by default, so this will return [NULL PHYSOBJ] on the client in most cases.
number Entity:GetPhysicsObjectCount()
Returns the number of physics objects an entity has (usually 1 for non-ragdolls)
PhysObj Entity:GetPhysicsObjectNum( number physNum )
Returns a specific physics object from an entity with multiple PhysObjects (like ragdolls) See also Entity:TranslateBoneToPhysBone.
number Entity:GetPlaybackRate()
Returns the playback rate of the main sequence on this entity, with 1.0 being the default speed.
Vector Entity:GetPos()
Gets the position of entity in world.
number Entity:GetPoseParameter( string name )
Returns the pose parameter value
string Entity:GetPoseParameterName( number id )
Returns name of given pose parameter
number, number Entity:GetPoseParameterRange( number id )
Returns pose parameter range
boolean Entity:GetPredictable()
Returns whether this entity is predictable or not. See Entity:SetPredictable for more information
Entity Entity:GetRagdollOwner()
Returns the entity which the ragdoll came from. The opposite of Player:GetRagdollEntity.
Angle Entity:GetRenderAngles()
Returns the entity's render angles, set by Entity:SetRenderAngles in a drawing hook.
Vector, Vector Entity:GetRenderBounds()
Returns render bounds of the entity. Can be overridden by Entity:SetRenderBounds. If the render bounds are not inside players view, the entity will not be drawn!
number Entity:GetRenderFX()
Returns current render FX of the entity.
number Entity:GetRenderGroup()
Returns the render group of the entity.
number Entity:GetRenderMode()
Returns the render mode of the entity.
Vector Entity:GetRenderOrigin()
Returns the entity's render origin, set by Entity:SetRenderOrigin in a drawing hook.
Vector Entity:GetRight()
Returns the rightward vector of the entity, as a normalized direction vector
Vector, Vector Entity:GetRotatedAABB( Vector min, Vector max )
Returns the min and max of the entity's axis-aligned bounding box.
table Entity:GetSaveTable( boolean showAll )
Returns a table of save values for an entity. These tables are not the same between the client and the server, and different entities may have different fields. You can get the list different fields an entity has by looking at it's source code ( the 2013 SDK can be found online, https://github.com/ValveSoftware/source-sdk-2013 ). Accessible fields are defined by each DEFINE_FIELD and DEFINE_KEYFIELD inside the DATADESC block. Take the headcrab, for example: BEGIN_DATADESC( CBaseHeadcrab ) // m_nGibCount..
number Entity:GetSequence()
Return the index of the model sequence that is currently active for the entity.
number Entity:GetSequenceActivity( number seq )
Return activity id out of sequence id. Opposite of Entity:SelectWeightedSequence.
string Entity:GetSequenceActivityName( number sequenceId )
Returns the activity name for the given sequence id.
number Entity:GetSequenceCount()
Returns the amount of sequences ( animations ) the entity's model has.
number Entity:GetSequenceGroundSpeed( number sequenceId )
Returns the ground speed of the entity's sequence.
table Entity:GetSequenceInfo( number sequenceId )
Returns a table of information about an entity's sequence.
table Entity:GetSequenceList()
Returns a list of all sequences ( animations ) the model has.
number Entity:GetSequenceMoveDist( number sequenceId )
Returns an entity's sequence move distance (the change in position over the course of the entire sequence).
boolean, Vector, Angle Entity:GetSequenceMovement( number sequenceId, number startCycle = 0, number endCyclnde = 1 )
Returns the delta movement and angles of a sequence of the entity's model.
number Entity:GetSequenceMoveYaw( number seq )
Returns the change in heading direction in between the start and the end of the sequence.
string Entity:GetSequenceName( number index )
Return the name of the sequence for the index provided. Refer to Entity:GetSequence to find the current active sequence on this entity.
boolean Entity:GetShouldPlayPickupSound()
Checks if the entity plays a sound when picked up by a player. This will return nil if Entity:SetShouldPlayPickupSound has not been called.
boolean Entity:GetShouldServerRagdoll()
Returns if entity should create a server ragdoll on death or a client one.
number Entity:GetSkin()
Returns the skin index of the current skin.
number Entity:GetSolid()
Returns solid type of an entity.
number Entity:GetSolidFlags()
Returns solid flag(s) of an entity.
boolean Entity:GetSpawnEffect()
Returns if we should show a spawn effect on spawn on this entity.
number Entity:GetSpawnFlags()
Returns the bitwise spawn flags used by the entity.
string Entity:GetSubMaterial( number index )
Returns the material override for the given index. Returns "" if no material override exists. Use Entity:GetMaterials to list it's default materials. The server's value takes priority on the client.
table Entity:GetSubModels()
Returns a list of models included into the entity's model in the .qc file.
table Entity:GetTable()
Returns the table that contains all values saved within the entity.
table Entity:GetTouchTrace()
Returns the last trace used in the collision callbacks such as ENTITY:StartTouch, ENTITY:Touch and ENTITY:EndTouch. This returns the last collision trace used, regardless of the entity that caused it. As such, it's only reliable when used in the hooks mentioned above
boolean Entity:GetTransmitWithParent()
Returns true if the TransmitWithParent flag is set or not.
boolean Entity:GetUnFreezable()
Returns if the entity is unfreezable, meaning it can't be frozen with the physgun. By default props are freezable, so this function will typically return false. This will return nil if Entity:SetUnFreezable has not been called.
Vector Entity:GetUp()
Returns the upward vector of the entity, as a normalized direction vector
any Entity:GetVar( any key, any default = nil )
Retrieves a value from entity's Entity:GetTable. Set by Entity:SetVar.
Vector Entity:GetVelocity()
Returns the entity's velocity. Actually binds to CBaseEntity::GetAbsVelocity() on the server and C_BaseEntity::EstimateAbsVelocity() on the client. This returns the total velocity of the entity and is equal to local velocity + base velocity.This can become out-of-sync on the client if the server has been up for a long time.
number Entity:GetWorkshopID()
We advise against using this. It may be changed or removed in a future update. Returns ID of workshop addon that the entity is from. The function currently does nothing and always returns nil
VMatrix Entity:GetWorldTransformMatrix()
Returns the position and angle of the entity as a 3x4 matrix (VMatrix is 4x4 so the fourth row goes unused). The first three columns store the angle as a rotation matrix, and the fourth column stores the position vector. This returns incorrect results for the angular component (columns 1-3) for the local player clientside.This will use the local player's EyeAngles in rendering hooks.Columns 1-3 will be all 0 (angular component) in rendering hooks while paused in single-player.
Entity:GibBreakClient( Vector force, table clr = nil )
Causes the entity to break into its current models gibs, if it has any. You must call Entity:PrecacheGibs on the entity before using this function, or it will not create any gibs. If called on server, the gibs will be spawned on the currently connected clients and will not be synchronized. Otherwise the gibs will be spawned only for the client the function is called on. Note, that this function will not remove or hide the entity it is called on. For more expensive version of this function see Entity:GibBr..
Entity:GibBreakServer( Vector force )
Causes the entity to break into its current models gibs, if it has any. You must call Entity:PrecacheGibs on the entity before using this function, or it will not create any gibs. The gibs will be spawned on the server and be synchronized with all clients. Note, that this function will not remove or hide the entity it is called on. This function is affected by props_break_max_pieces_perframe, props_break_max_pieces and breakable_multiplayer (must be set to 0, which also would make all prop gibs spawn serv..
boolean Entity:HasBoneManipulations()
Returns whether or not the bone manipulation functions have ever been called on given entity. Related functions are Entity:ManipulateBonePosition, Entity:ManipulateBoneAngles, Entity:ManipulateBoneJiggle, and Entity:ManipulateBoneScale. This will return true if the entity's bones have ever been manipulated. Resetting the position/angles/jiggle/scaling to 0,0,0 will not affect this function.
boolean Entity:HasFlexManipulatior()
Returns whether or not the the entity has had flex manipulations performed with Entity:SetFlexWeight or Entity:SetFlexScale.
boolean Entity:HasSpawnFlags( number spawnFlags )
Returns whether this entity has the specified spawnflags bits set.
Vector Entity:HeadTarget( Vector origin )
Returns the position of the head of this entity, NPCs use this internally to aim at their targets. This only works on players and NPCs.
number Entity:Health()
Returns the health of the entity.
Entity:Ignite( number length, number radius = 0 )
Sets the entity on fire. See also Entity:Extinguish.
Entity:InitializeAsClientEntity()
We advise against using this. It may be changed or removed in a future update. Initializes this entity as being clientside only. Only works on entities fully created clientside, and as such it has currently no use due to the lack of clientside ents.Create. This function is automatically called by ents.CreateClientProp, ClientsideModel and ClientsideScene. Calling this on a clientside entity will crash the game.
Entity:Input( string input, Entity activator, Entity caller, any param = nil )
Fires input to the entity with the ability to make another entity responsible. See also Entity:Fire and GM:AcceptInput.
Entity:InstallDataTable()
This is used internally - although you're able to use it you probably shouldn't. Sets up Data Tables from entity to use with Entity:NetworkVar.
Entity:InvalidateBoneCache()
Resets the entity's bone cache values in order to prepare for a model change. This should be called after calling Entity:SetPoseParameter.
boolean Entity:IsConstrained()
Returns true if the entity has constraints attached to it This will only update clientside if the server calls it first. This only checks constraints added through the constraint so this will not react to map constraints.
boolean Entity:IsConstraint()
Returns if entity is constraint or not
boolean Entity:IsDormant()
Returns whether the entity is dormant or not. Client/server entities become dormant when they leave the PVS on the server. Client side entities can decide for themselves whether to become dormant. This mainly applies to PVS.
boolean Entity:IsEffectActive( number effect )
Returns whether an entity has engine effect applied or not.
boolean Entity:IsEFlagSet( number flag )
Checks if given flag is set or not.
boolean Entity:IsFlagSet( number flag )
Checks if given flag(s) is set or not.
boolean Entity:IsInWorld()
Returns whether the entity is inside a wall or outside of the map. Internally this function uses util.IsInWorld, that means that this function only checks Entity:GetPos of the entity. If an entity is only partially inside a wall, or has a weird GetPos offset, this function may not give reliable output.
boolean Entity:IsLagCompensated()
Returns whether the entity is lag compensated or not.
boolean Entity:IsLineOfSightClear( Vector target )
Returns true if the target is in line of sight. This will only work on CBaseCombatCharacter entities.
boolean Entity:IsMarkedForDeletion()
Returns if the entity is going to be deleted in the next frame.
boolean Entity:IsNextBot()
Checks if the entity is a NextBot or not.
boolean Entity:IsNPC()
Checks if the entity is an NPC or not. This will return false for NextBots, see Entity:IsNextBot for that.
boolean Entity:IsOnFire()
Returns whether the entity is on fire.
boolean Entity:IsOnGround()
Returns whether the entity is on ground or not. Internally, this checks if FL_ONGROUND is set on the entity. This function is an alias of Entity:OnGround.
boolean Entity:IsPlayer()
Checks if the entity is a player or not.
boolean Entity:IsPlayerHolding()
Returns true if the entity is being held by a player. Either by physics gun, gravity gun or use-key (+use). If multiple players are holding an object and one drops it, this will return false despite the object still being held.
boolean Entity:IsPlayingGesture( number activity )
Returns whether there's a gesture is given activity being played. This function only works on BaseAnimatingOverlay entites!
boolean Entity:IsRagdoll()
Checks if the entity is a ragdoll.
boolean Entity:IsScripted()
Checks if the entity is a SENT or a built-in entity.
boolean Entity:IsSequenceFinished()
Returns whether the entity's current sequence is finished or not
boolean Entity:IsSolid()
Returns if the entity is solid or not. Very useful for determining if the entity is a trigger or not.
boolean Entity:IsValid()
Returns whether the entity is a valid entity or not. An entity is valid if: It is not a NULL entity It is not the worldspawn entity (game.GetWorld) Instead of calling this method directly, it's a good idea to call the global IsValid instead, however if you're sure the variable you're using is always an entity object it's better to use this method It will check whether the given variable contains an object (an Entity) or nothing at all for you. See examples. NULL entities can still be assigned with key/v..
boolean Entity:IsValidLayer( number layerID )
Returns whether the given layer ID is valid and exists on this entity. This function only works on BaseAnimatingOverlay entites!
boolean Entity:IsVehicle()
Checks if the entity is a vehicle or not.
boolean Entity:IsWeapon()
Checks if the entity is a weapon or not.
boolean Entity:IsWidget()
Returns whether the entity is a widget or not. This is used by the "Edit Bones" context menu property.
boolean Entity:IsWorld()
Returns if the entity is the map's Entity[0] worldspawn
Vector Entity:LocalToWorld( Vector lpos )
Converts a vector local to an entity into a worldspace vector
Angle Entity:LocalToWorldAngles( Angle ang )
Converts a local angle (local to the entity) to a world angle.
number Entity:LookupAttachment( string attachmentName )
Returns the attachment index of the given attachment name.
number Entity:LookupBone( string boneName )
Gets the bone index of the given bone name, returns nothing if the bone does not exist.
number Entity:LookupPoseParameter( string name )
Returns pose parameter ID from its name.
number, number Entity:LookupSequence( string name )
Returns sequence ID from its name.
Entity:MakePhysicsObjectAShadow( boolean allowPhysicsMovement, boolean allowPhysicsRotation )
Turns the Entity:GetPhysicsObject into a physics shadow. It's used internally for the Player's and NPC's physics object, and certain HL2 entities such as the crane. A physics shadow can be used to have static entities that never move by setting both arguments to false. Unlike Entity:PhysicsInitShadow, this function doesn't remove the current physics object.
Entity:ManipulateBoneAngles( number boneID, Angle ang )
Sets custom bone angles. The repeated use of bone manipulation in multiplayer games is highly discouraged due to the huge produced network traffic.
Entity:ManipulateBoneJiggle( number boneID, number enabled )
Manipulates the bone's jiggle status. This allows non jiggly bones to become jiggly.
Entity:ManipulateBonePosition( number boneID, Vector pos )
Sets custom bone offsets.
Entity:ManipulateBoneScale( number boneID, Vector scale )
Sets custom bone scale. When used serverside, this method produces a huge network consumption!This does not scale procedural bones.
number Entity:MapCreationID()
Returns entity's map creation ID. Unlike Entity:EntIndex or Entity:GetCreationID, it will always be the same on same map, no matter how much you clean up or restart it. To be used in conjunction with ents.GetMapCreatedEntity.
Entity:MarkShadowAsDirty()
Refreshes the shadow of the entity.
Entity:MuzzleFlash()
Fires the muzzle flash effect of the weapon the entity is carrying. This only creates a light effect and is often called alongside Weapon:SendWeaponAnim
Vector Entity:NearestPoint( Vector position )
Performs a Ray OBBox intersection from the given position to the origin of the OBBox with the entity and returns the hit position on the OBBox
Entity:NetworkVar( string type, number slot, string name, table extended = nil )
Creates a network variable on the entity and adds Set/Get functions for it. This function should only be called in ENTITY:SetupDataTables. See Entity:NetworkVarNotify for a function to hook NetworkVar changes. Make sure to not call the SetDT* and your custom set methods on the client realm unless you know exactly what you are doing.
Entity:NetworkVarElement( string type, number slot, string element, string name, table extended = nil )
Similarly to Entity:NetworkVar, creates a network variable on the entity and adds Set/Get functions for it. This method stores it's value as a member value of a vector or an angle. This allows to go beyond the normal variable limit of Entity:NetworkVar for Int and Float types, at the expense of Vector and Angle limit. This function should only be called in ENTITY:SetupDataTables. Make sure to not call the SetDT* and your custom set methods on the client realm unless you know exactly what you are doing.
Entity:NetworkVarNotify( string name, function callback )
Creates a callback that will execute when the given network variable changes - that is, when the Set<name>() function is run. The callback is executed before the value is changed, and is called even if the new and old values are the same.This function does not exist on entities in which Entity:InstallDataTable has not been called. By default, this means this function only exists on SENTs (both serverside and clientside) and on players with a Player Class (serverside and clientside LocalPlayer only!)..
Entity:NextThink( number timestamp )
In the case of a scripted entity, this will cause the next ENTITY:Think event to be run at the given time. Does not work clientside! Use Entity:SetNextClientThink instead. This does not work with SWEPs or Nextbots.
Vector Entity:OBBCenter()
Returns the center of an entity's bounding box as a local vector.
Vector Entity:OBBMaxs()
Returns the highest corner of an entity's bounding box as a local vector.
Vector Entity:OBBMins()
Returns the lowest corner of an entity's bounding box as a local vector.
number Entity:ObjectCaps()
Returns the entity's capabilities as a bitfield. In the engine this function is mostly used to check the use type, the save/restore system and level transitions flags. Even though the function is defined shared, it is not guaranteed to return the same value across states. The enums for this are not currently implemented in Lua, however you can access the defines here.
boolean Entity:OnGround()
Returns true if the entity is on the ground, and false if it isn't. Internally, this checks if FL_ONGROUND is set on the entity. This is only updated for players and NPCs, and thus won't inherently work for other entities.
boolean Entity:PassesDamageFilter( CTakeDamageInfo dmg )
Tests whether the damage passes the entity filter. This will call ENTITY:PassesDamageFilter on scripted entities of the type "filter". This function only works on entities of the type "filter". ( filter_* entities, including base game filter entites )
boolean Entity:PassesFilter( Entity caller, Entity ent )
Tests whether the entity passes the entity filter. This will call ENTITY:PassesFilter on scripted entities of the type "filter". This function only works on entities of the type "filter". ( filter_* entities, including base game filter entites )
Entity:PhysicsDestroy()
Destroys the current physics object of an entity. Cannot be used on a ragdoll or the world entity.
boolean Entity:PhysicsFromMesh( table vertices )
Initializes the physics mesh of the entity from a triangle soup defined by a table of vertices. The resulting mesh is hollow, may contain holes, and always has a volume of 0. While this is very useful for static geometry such as terrain displacements, it is advised to use Entity:PhysicsInitConvex or Entity:PhysicsInitMultiConvex for moving solid objects instead. Entity:EnableCustomCollisions needs to be called if you want players to collide with the entity correctly.
boolean Entity:PhysicsInit( number solidType )
Initializes the physics object of the entity using its current model. Deletes the previous physics object if it existed and the new object creation was successful. If the entity's current model has no physics mesh associated to it, no physics object will be created and the previous object will still exist, if applicable. When called clientside, this will not create a valid PhysObj if the model hasn't been precached serverside.If successful, this function will automatically call Entity:SetSolid( solidType..
boolean Entity:PhysicsInitBox( Vector mins, Vector maxs )
Makes the physics object of the entity a AABB. If the volume of the resulting box is 0 (the mins and maxs are the same), the mins and maxs will be changed to Vector( -1, -1, -1 ) and Vector( 1, 1, 1 ), respectively.This function will automatically destroy any previous physics objects if successful and call Entity:SetSolid( SOLID_BBOX ), Entity:SetMoveType( MOVETYPE_VPHYSICS ), and Entity:SetCollisionBounds( mins, maxs ).Clientside physics objects are broken and do not move properly in some cases. Physics..
boolean Entity:PhysicsInitConvex( table points )
Initializes the physics mesh of the entity with a convex mesh defined by a table of points. The resulting mesh is the of all the input points. If successful, the previous physics object will be removed. This is the standard way of creating moving physics objects with a custom convex shape. For more complex, concave shapes, see Entity:PhysicsInitMultiConvex. This will crash if given all Vector(0,0,0)s.Clientside physics objects are broken and do not move properly in some cases. Physics objects should only..
boolean Entity:PhysicsInitMultiConvex( table vertices )
An advanced version of Entity:PhysicsInitConvex which initializes a physics object from multiple convex meshes. This should be used for physics objects with a custom shape which cannot be represented by a single convex mesh. If successful, the previous physics object will be removed. Clientside physics objects are broken and do not move properly in some cases. Physics objects should only created on the server or you will experience incorrect physgun beam position, prediction issues, and other unexpected b..
boolean Entity:PhysicsInitShadow( boolean allowPhysicsMovement = true, boolean allowPhysicsRotation = true )
Initializes the entity's physics object as a physics shadow. Removes the previous physics object if successful. This is used internally for the Player's and NPC's physics object, and certain HL2 entities such as the crane. A physics shadow can be used to have static entities that never move by setting both arguments to false. Clientside physics objects are broken and do not move properly in some cases. Physics objects should only created on the server or you will experience incorrect physgun beam position..
boolean Entity:PhysicsInitSphere( number radius, string physmat )
Makes the physics object of the entity a sphere. This function will automatically destroy any previous physics objects and call Entity:SetSolid( SOLID_BBOX ) and Entity:SetMoveType( MOVETYPE_VPHYSICS ).Clientside physics objects are broken and do not move properly in some cases. Physics objects should only created on the server or you will experience incorrect physgun beam position, prediction issues, and other unexpected behavior.
boolean Entity:PhysicsInitStatic( number solidType )
Initializes a static physics object of the entity using its current model. If successful, the previous physics object is removed. This is what used by entities such as func_breakable, prop_dynamic, item_suitcharger, prop_thumper and npc_rollermine while it is in its "buried" state in the Half-Life 2 Campaign. If the entity's current model has no physics mesh associated to it, no physics object will be created. This function will automatically call Entity:SetSolid( solidType ).Clientside physics..
Entity:PhysWake()
Wakes up the entity's physics object
number, Entity Entity:PlayScene( string scene, number delay = 0 )
Makes the entity play a .vcd scene.
Entity:PointAtEntity( Entity target )
Changes an entities angles so that it faces the target entity.
number Entity:PrecacheGibs()
Precaches gibs for the entity's model. Normally this function should be ran when the entity is spawned, for example the ENTITY:Initialize, after Entity:SetModel is called. This is required for Entity:GibBreakServer and Entity:GibBreakClient to work.
Entity:RagdollSolve()
Normalizes the ragdoll. This is used alongside Kinect in Entity:SetRagdollBuildFunction, for more info see ragdoll_motion entity.
Entity:RagdollStopControlling()
Sets the function to build the ragdoll. This is used alongside Kinect in Entity:SetRagdollBuildFunction, for more info see ragdoll_motion entity.
Entity:RagdollUpdatePhysics()
Makes the physics objects follow the set bone positions. This is used alongside Kinect in Entity:SetRagdollBuildFunction, for more info see ragdoll_motion entity.
Entity:Remove()
Removes the entity it is used on.
Entity:RemoveAllDecals()
Removes all decals from the entities surface.
Entity:RemoveAllGestures()
Removes and stops all gestures. This function only works on BaseAnimatingOverlay entites!
Entity:RemoveCallback( string hook, number callbackid )
Removes a callback previously added with Entity:AddCallback
Entity:RemoveCallOnRemove( string identifier )
Removes a function previously added via Entity:CallOnRemove.
Entity:RemoveEffects( number effect )
Removes an engine effect applied to an entity.
Entity:RemoveEFlags( number flag )
Removes specified engine flag
Entity:RemoveFlags( number flag )
Removes specified flag(s) from the entity
Entity:RemoveFromMotionController( PhysObj physObj )
Removes a PhysObject from the entity's motion controller so that ENTITY:PhysicsSimulate will no longer be called for given PhysObject. You must first create a motion controller with Entity:StartMotionController. Only works on a scripted Entity of anim type
Entity:RemoveGesture( number activity )
Removes and stops the gesture with given activity. This function only works on BaseAnimatingOverlay entites!
Entity:RemoveInternalConstraint( number num = -1 )
Breaks internal Ragdoll constrains, so you can for example separate an arm from the body of a ragdoll and preserve all physics. The visual mesh will still stretch as if it was properly connected unless the ragdoll model is specifically designed to avoid that.
Entity:RemoveSolidFlags( number flags )
Removes solid flag(s) from the entity.
Entity:ResetSequence( number sequence )
Plays an animation on the entity. This may not always work on engine entities. This will not reset the animation on viewmodels, use Entity:SendViewModelMatchingSequence instead.This will not work properly if called directly after calling Entity:SetModel. Consider waiting until the next Tick. Will not work on players due to the animations being reset every frame by the base gamemode animation system. See GM:CalcMainActivity. For custom scripted entities you will want to apply example from ENTITY:Think to m..
Entity:ResetSequenceInfo()
Reset entity sequence info such as playback rate, ground speed, last event check, etc.
Entity:Respawn()
Makes the entity/weapon respawn. Only usable on HL2 pickups and any weapons. Seems to be buggy with weapons. Very unreliable.
Entity:RestartGesture( number activity, boolean addIfMissing = true, boolean autokill = true )
Restarts the entity's animation gesture. If the given gesture is already playing, it will reset it and play it from the beginning. This function only works on BaseAnimatingOverlay entites.
number Entity:SelectWeightedSequence( number act )
Returns sequence ID corresponding to given activity ID. Opposite of Entity:GetSequenceActivity. Similar to Entity:LookupSequence. See also Entity:SelectWeightedSequenceSeeded.
number Entity:SelectWeightedSequenceSeeded( number act, number seed )
Returns the sequence ID corresponding to given activity ID, and uses the provided seed for random selection. The seed should be the same server-side and client-side if used in a predicted environment. See Entity:SelectWeightedSequence for a provided-seed version of this function.
Entity:SendViewModelMatchingSequence( number seq )
Sends sequence animation to the view model. It is recommended to use this for view model animations, instead of Entity:ResetSequence. This function is only usable on view models. Sequences 0-6 will not be looped regardless if they're marked as a looped animation or not.
number Entity:SequenceDuration( number seqid = nil )
Returns length of currently played sequence. This will return incorrect results for weapons and viewmodels clientside in thirdperson.
Entity:SetAbsVelocity( Vector velocity )
Sets the entity's velocity. Actually binds to CBaseEntity::SetLocalVelocity() which sets the entity's velocity due to movement in the world from forces such as gravity. Does not include velocity from entity-on-entity collision or other world movement.
Entity:SetAngles( Angle angles )
Sets the angles of the entity. To set a player's angles, use Player:SetEyeAngles instead.
Entity:SetAnimation( number playerAnim )
Sets a player's third-person animation. Mainly used by Weapons to start the player's weapon attack and reload animations.
Entity:SetAnimTime( number time )
Sets the start time (relative to CurTime) of the current animation, which is used to determine Entity:GetCycle. Should be less than CurTime to play an animation from the middle.
Entity:SetAttachment( Entity ent, number attachment )
We advise against using this. It may be changed or removed in a future update. You should be using Entity:SetParent instead. Parents the sprite to an attachment on another model. Works only on env_sprite. Despite existing on client, it doesn't actually do anything on client.
Entity:SetBloodColor( number bloodColor )
Sets the blood color this entity uses.
Entity:SetBodygroup( number bodygroup, number value )
Sets an entities' bodygroup.
Entity:SetBodyGroups( string bodygroups )
Sets the bodygroups from a string. A convenience function for Entity:SetBodygroup.
Entity:SetBoneController( number boneControllerID, number value )
Sets the specified value on the bone controller with the given ID of this entity, it's used in HL1 to change the head rotation of NPCs, turret aiming and so on. This is the precursor of pose parameters, and only works for Half Life 1: Source models supporting it.
Entity:SetBoneMatrix( number boneid, VMatrix matrix )
Sets the bone matrix of given bone to given matrix. See also Entity:GetBoneMatrix. Despite existing serverside, it does nothing.
Entity:SetBonePosition( number bone, Vector pos, Angle ang )
Sets the bone position and angles.
Entity:SetCollisionBounds( Vector mins, Vector maxs )
Sets the collision bounds for the entity, which are used for triggers ( Entity:SetTrigger, ENTITY:Touch ), determining if rendering is necessary clientside, and collision ( If Entity:SetSolid set as SOLID_BBOX ). Input bounds are relative to Entity:GetPos! See also Entity:SetCollisionBoundsWS.
Entity:SetCollisionBoundsWS( Vector vec1, Vector vec2 )
Sets the collision bounds for the entity, which are used for triggers ( Entity:SetTrigger, ENTITY:Touch ), determining if rendering is necessary clientside, and collision ( If Entity:SetSolid set as SOLID_BBOX ). Input bounds are in world coordinates! See also Entity:SetCollisionBounds.
Entity:SetCollisionGroup( number group )
Sets the entity's collision group.
Entity:SetColor( table color = Color(255, 0, 255, 255) )
Sets the color of an entity. Some entities may need a custom render mode set for transparency to work. See example 2. Entities also must have a proper render group set for transparency to work.
Entity:SetCreator( Player ply )
Sets the creator of the Entity. This is set automatically in Sandbox gamemode when spawning SENTs, but is never used/read by default.
Entity:SetCustomCollisionCheck( boolean enable )
Marks the entity to call GM:ShouldCollide. Not to be confused with Entity:EnableCustomCollisions.
Entity:SetCycle( number value )
Sets the progress of the current animation to a specific value between 0 and 1. This does not work with viewmodels.
Entity:SetDTAngle( number key, Angle ang )
This is used internally - although you're able to use it you probably shouldn't. This is called internally by the Entity:NetworkVar system, you can use this in cases where using NetworkVar is not possible. Sets the specified angle on the entity's datatable.
Entity:SetDTBool( number key, boolean bool )
This is used internally - although you're able to use it you probably shouldn't. This is called internally by the Entity:NetworkVar system, you can use this in cases where using NetworkVar is not possible. Sets the specified bool on the entity's datatable.
Entity:SetDTEntity( number key, Entity ent )
This is used internally - although you're able to use it you probably shouldn't. This is called internally by the Entity:NetworkVar system, you can use this in cases where using NetworkVar is not possible. Sets the specified entity on this entity's datatable.
Entity:SetDTFloat( number key, number float )
This is used internally - although you're able to use it you probably shouldn't. This is called internally by the Entity:NetworkVar system, you can use this in cases where using NetworkVar is not possible. Sets the specified float on the entity's datatable.
Entity:SetDTInt( number key, number integer )
This is used internally - although you're able to use it you probably shouldn't. This is called internally by the Entity:NetworkVar system, you can use this in cases where using NetworkVar is not possible. Sets the specified integer on the entity's datatable.
Entity:SetDTString( number key, string str )
This is used internally - although you're able to use it you probably shouldn't. This is called internally by the Entity:NetworkVar system, you can use this in cases where using NetworkVar is not possible. Sets the specified string on the entity's datatable. The length of these strings are capped at 512 characters.
Entity:SetDTVector( number key, Vector vec )
This is used internally - although you're able to use it you probably shouldn't. This is called internally by the Entity:NetworkVar system, you can use this in cases where using NetworkVar is not possible. Sets the specified vector on the entity's datatable.
Entity:SetElasticity( number elasticity )
Sets the elasticity of this entity, used by some flying entities such as the Helicopter NPC to determine how much it should bounce around when colliding.
Entity:SetEntity( string name, Entity entity )
Allows you to set the Start or End entity attachment for the rope.
Entity:SetEyeTarget( Vector pos )
Sets the position an entity's eyes look toward.
Entity:SetFlexScale( number scale )
Sets the flex scale of the entity. This does not work on ClientsideModels or ClientsideRagdolls.
Entity:SetFlexWeight( number flex, number weight )
Sets the flex weight.
Entity:SetFriction( number friction )
Sets how much friction an entity has when sliding against a surface. Entities default to 1 (100%) and can be higher or even negative. This only multiplies the friction of the entity, to change the value itself use PhysObj:SetMaterial.Works only for MOVETYPE_STEP entities.This has no effect on players.Issue Tracker: 1395
Entity:SetGravity( number gravityMultiplier )
Sets the gravity multiplier of the entity. This function is not predicted.
Entity:SetGroundEntity( Entity ground )
Sets the ground the entity is standing on.
Entity:SetHealth( number newHealth )
Sets the health of the entity. You may want to take Entity:GetMaxHealth into account when calculating what to set health to, in case a gamemode has a different max health than 100.
Entity:SetHitboxSet( number id )
Sets the current Hitbox set for the entity.
Entity:SetIK( boolean useIK = false )
Enables or disable the inverse kinematic usage of this entity.
Entity:SetKeyValue( string key, string value )
Sets Hammer key values on an entity. You can look up which entities have what key values on the Valve Developer Community on entity pages. A list of basic entities can be found here. Alternatively you can look at the .fgd files shipped with Garry's Mod in the bin/ folder with a text editor to see the key values as they appear in Hammer.
Entity:SetLagCompensated( boolean enable )
This allows the entity to be lag compensated during Player:LagCompensation. Players are lag compensated by default and there's no need to call this function for them. It's best to not enable lag compensation on parented entities, as the system does not handle it that well ( they will be moved back but then the entity will lag behind ). Parented entities move back with the parent if it's lag compensated, so if you are making some kind of armor piece you shouldn't do anything. As a side note for parented en..
Entity:SetLayerBlendIn( number layerID, number blendIn )
This function only works on BaseAnimatingOverlay entites!
Entity:SetLayerBlendOut( number layerID, number blendOut )
This function only works on BaseAnimatingOverlay entites!
Entity:SetLayerCycle( number layerID, number cycle )
Sets the animation cycle/frame of given layer. This function only works on BaseAnimatingOverlay entites!
Entity:SetLayerDuration( number layerID, number duration )
Sets the duration of given layer. This internally overrides the Entity:SetLayerPlaybackRate. This function only works on BaseAnimatingOverlay entites!
Entity:SetLayerLooping( number layerID, boolean loop )
Sets whether the layer should loop or not. This function only works on BaseAnimatingOverlay entites!
Entity:SetLayerPlaybackRate( number layerID, number rate )
Sets the layer playback rate. See also Entity:SetLayerDuration. This function only works on BaseAnimatingOverlay entites!Next update: is shared
Entity:SetLayerPriority( number layerID, number priority )
Sets the priority of given layer. This function only works on BaseAnimatingOverlay entites!
Entity:SetLayerSequence( number layerID, number seq )
Sets the sequence of given layer. This function only works on BaseAnimatingOverlay entites!
Entity:SetLayerWeight( number layerID, number weight )
Sets the layer weight. This influences how strongly the animation should be overriding the normal animations of the entity. This function only works on BaseAnimatingOverlay entites!Next update: is shared
Entity:SetLegacyTransform( boolean enabled )
This forces an entity to use the bone transformation behaviour from versions prior to 8 July 2014. This behaviour affects Entity:EnableMatrix and Entity:SetModelScale and is incorrect, therefore this function be used exclusively as a quick fix for old scripts that rely on it.
Entity:SetLightingOriginEntity( Entity lightOrigin )
Sets the entity to be used as the light origin position for this entity.
Entity:SetLocalAngles( Angle ang )
Sets angles relative to angles of Entity:GetParent
Entity:SetLocalAngularVelocity( Angle angVel )
Sets the entity's angular velocity (rotation speed).
Entity:SetLocalPos( Vector pos )
Sets local position relative to the parented position. This is for use with Entity:SetParent to offset position.
Entity:SetLocalVelocity( Vector velocity )
Sets the entity's local velocity which is their velocity due to movement in the world from forces such as gravity. Does not include velocity from entity-on-entity collision or other world movement. Same as Entity:SetAbsVelocity, but clamps the given velocity, and is not recommended to be used because of that.
Entity:SetLOD( number lod = -1 )
Sets the Level Of Detail model to use with this entity. This may not work for all models if the model doesn't include any LOD sub models. This function works exactly like the clientside r_lod convar and takes priority over it.
Entity:SetMaterial( string materialName )
Sets the rendering material override of the entity. To set a Lua material created with CreateMaterial, just prepend a "!" to the material name. If you wish to override a single material on the model, use Entity:SetSubMaterial instead. To apply materials to models, that material must have VertexLitGeneric shader. For that reason you cannot apply map textures onto models, map textures use a different material shader - LightmappedGeneric, which can be used on brush entities.The server's value takes..
Entity:SetMaxHealth( number maxhealth )
Sets the maximum health for entity. Note, that you can still set entity's health above this amount with Entity:SetHealth.
Entity:SetModel( string modelName )
Sets the model of the entity. This does not update the physics of the entity - see Entity:PhysicsInit. This silently fails when given an empty string.
Entity:SetModelName( string modelname )
Alter the model name returned by Entity:GetModel. Does not affect the entity's actual model.
Entity:SetModelScale( number scale, number deltaTime = 0 )
Scales the model of the entity, if the entity is a Player or an NPC the hitboxes will be scaled as well. For some entities, calling Entity:Activate after this will scale the collision bounds and PhysObj as well; be wary as there's no optimization being done internally and highly complex collision models might crash the server. This is the same system used in TF2 for the Mann Vs Machine robots. To resize the entity along any axis, use Entity:EnableMatrix instead. If your old scales are wrong, use Entity:Se..
Entity:SetMoveCollide( number moveCollideType )
Sets the move collide type of the entity. The move collide is the way a physics object reacts to hitting an object - will it bounce, slide?
Entity:SetMoveParent( Entity Parent )
Sets the Movement Parent of an entity to another entity. Similar to Entity:SetParent, except the object's coordinates are not translated automatically before parenting.
Entity:SetMoveType( number movetype )
Sets the entity's move type. This should be called before initializing the physics object on the entity, unless it will override SetMoveType such as Entity:PhysicsInitBox. Despite existing on client, it doesn't actually do anything on client.
Entity:SetName( string mappingName )
Sets the mapping name of the entity.
Entity:SetNetworkAngles( Angle angle )
Alters the entity's perceived serverside angle on the client.
Entity:SetNetworkedAngle( string key, Angle value = Angle( 0, 0, 0 ) )
We advise against using this. It may be changed or removed in a future update. You should use Entity:SetNWAngle instead. Sets a networked angle value at specified index on the entity. The value then can be accessed with Entity:GetNetworkedAngle both from client and server. Running this function clientside will only set it clientside for the client it is called on.
Entity:SetNetworkedBool( string key, boolean value = false )
We advise against using this. It may be changed or removed in a future update. You should use Entity:SetNWBool instead. Sets a networked boolean value at specified index on the entity. The value then can be accessed with Entity:GetNetworkedBool both from client and server. Running this function clientside will only set it clientside for the client it is called on.
Entity:SetNetworkedEntity( string key, Entity value = NULL )
We advise against using this. It may be changed or removed in a future update. You should use Entity:SetNWEntity instead. Sets a networked entity value at specified index on the entity. The value then can be accessed with Entity:GetNetworkedEntity both from client and server. Running this function clientside will only set it clientside for the client it is called on.
Entity:SetNetworkedFloat( string key, number value = 0 )
We advise against using this. It may be changed or removed in a future update. You should use Entity:SetNWFloat instead. Sets a networked float value at specified index on the entity. The value then can be accessed with Entity:GetNetworkedFloat both from client and server. Seems to be the same as Entity:GetNetworkedInt. Running this function clientside will only set it clientside for the client it is called on.
Entity:SetNetworkedInt( string key, number value = 0 )
We advise against using this. It may be changed or removed in a future update. You should use Entity:SetNWInt instead. Sets a networked integer value at specified index on the entity. The value then can be accessed with Entity:GetNetworkedInt both from client and server. Running this function clientside will only set it clientside for the client it is called on.
Entity:SetNetworkedNumber( any index, number number )
Sets a networked number at the specified index on the entity.
Entity:SetNetworkedString( string key, string value )
We advise against using this. It may be changed or removed in a future update. You should use Entity:SetNWString instead. Sets a networked string value at specified index on the entity. The value then can be accessed with Entity:GetNetworkedString both from client and server. Running this function clientside will only set it clientside for the client it is called on.
Entity:SetNetworkedVarProxy( string name, function callback )
We advise against using this. It may be changed or removed in a future update. You should be using Entity:SetNWVarProxy instead. Sets callback function to be called when given NWVar changes. Currently this function only works for the NW2Var system (accessed by adding a 2 in between Networked and Var for most NetworkedVar functions), which will replace the original one at some point in the future
Entity:SetNetworkedVector( string key, Vector value = Vector( 0, 0, 0 ) )
We advise against using this. It may be changed or removed in a future update. You should use Entity:SetNWVector instead. Sets a networked vector value at specified index on the entity. The value then can be accessed with Entity:GetNetworkedVector both from client and server. Running this function clientside will only set it clientside for the client it is called on.
Entity:SetNetworkOrigin( Vector origin )
Virtually changes entity position for clients. Does the same thing as Entity:SetPos when used serverside.
Entity:SetNextClientThink( number nextthink )
Sets the next time the clientside ENTITY:Think is called.
Entity:SetNoDraw( boolean shouldNotDraw )
Sets if the entity's model should render at all. If set on the server, this entity will no longer network to clients, and for all intents and purposes cease to exist clientside.
Entity:SetNotSolid( boolean IsNotSolid )
Sets whether the entity is solid or not.
Entity:SetNWAngle( string key, Angle value )
Sets a networked angle value on the entity. The value can then be accessed with Entity:GetNWAngle both from client and server. Running this function clientside will only set it for the client it is called on.
Entity:SetNWBool( string key, boolean value )
Sets a networked boolean value on the entity. The value can then be accessed with Entity:GetNWBool both from client and server. Running this function clientside will only set it for the client it is called on.
Entity:SetNWEntity( string key, Entity value )
Sets a networked entity value on the entity. The value can then be accessed with Entity:GetNWEntity both from client and server. Running this function clientside will only set it for the client it is called on.
Entity:SetNWFloat( string key, number value )
Sets a networked float (number) value on the entity. The value can then be accessed with Entity:GetNWFloat both from client and server. Unlike Entity:SetNWInt, floats don't have to be whole numbers. Running this function clientside will only set it for the client it is called on.
Entity:SetNWInt( string key, number value )
Sets a networked integer (whole number) value on the entity. The value can then be accessed with Entity:GetNWInt both from client and server. See Entity:SetNWFloat for numbers that aren't integers. Running this function clientside will only set it for the client it is called on.This function will not round decimal values as it actually networks a float internally.
Entity:SetNWString( string key, string value )
Sets a networked string value on the entity. The value can then be accessed with Entity:GetNWString both from client and server. Running this function clientside will only set it for the client it is called on.
Entity:SetNWVarProxy( any key, function callback )
Sets a function to be called when the NWVar changes.
Entity:SetNWVector( string key, Vector value )
Sets a networked vector value on the entity. The value can then be accessed with Entity:GetNWVector both from client and server. Running this function clientside will only set it for the client it is called on.
Entity:SetOwner( Entity owner = NULL )
Sets the owner of this entity, disabling all physics interaction with it. This function is generally used to disable physics interactions on projectiles being fired by their owner, but can also be used for normal ownership in case physics interactions are not involved at all. The Gravity gun will be able to pick up the entity even if the owner can't collide with it, the Physics gun however will not.
Entity:SetParent( Entity parent = NULL, number attachmentId = -1 )
Sets the parent of this entity, making it move with its parent. This does not work on the world.This can cause undefined physics behaviour when used on entities that don't support parenting. See the Valve developer wiki for more information.
Entity:SetParentPhysNum( number bone )
Sets the parent of an entity to another entity with the given physics bone number. Similar to Entity:SetParent, except it is parented to a physbone. This function is useful mainly for ragdolls. Despite this function being available server side, it doesn't actually do anything server side.
Entity:SetPersistent( boolean persist )
Sets whether or not the given entity is persistent. A persistent entity will be saved on server shutdown and loaded back when the server starts up. Additionally, by default persistent entities cannot be grabbed with the physgun and tools cannot be used on them. In sandbox, this can be set on an entity by opening the context menu, right clicking the entity, and choosing "Make Persistent". Persistence can only be enabled with the sbox_persist convar, which works as an identifier for the current se..
Entity:SetPhysConstraintObjects( PhysObj Phys1, PhysObj Phys2 )
When called on a constraint entity, sets the two physics objects to be constrained. Usage is not recommended as the Constraint library provides easier ways to deal with constraints.
Entity:SetPhysicsAttacker( Player ent, number timeLimit = 5 )
Sets the player who gets credit if this entity kills something with physics damage within the time limit. This can only be called on props, "anim" type SENTs and vehicles.
Entity:SetPlaybackRate( number fSpeed )
Allows you to set how fast an entity's animation will play, with 1.0 being the default speed.
Entity:SetPos( Vector position )
Moves the entity to the specified position. If the new position doesn't take effect right away, you can use Entity:SetupBones to force it to do so. This issue is especially common when trying to render the same entity twice or more in a single frame at different positions.Entities with Entity:GetSolid of SOLID_BBOX will have their angles reset!This will fail inside of predicted functions called during player movement processing. This includes WEAPON:PrimaryAttack and WEAPON:Think.Some entities, such as ra..
Entity:SetPoseParameter( string poseName, number poseValue )
Sets the specified pose parameter to the specified value. You should call Entity:InvalidateBoneCache after calling this function. Avoid calling this in draw hooks, especially when animating things, as it might cause visual artifacts.
Entity:SetPredictable( boolean setPredictable )
Sets whether an entity should be predictable or not. When an entity is set as predictable, its DT vars can be changed during predicted hooks. This is useful for entities which can be controlled by player input. Any datatable value that mismatches from the server will be overridden and a prediction error will be spewed. Weapons are predictable by default, and the drive system uses this function to make the controlled prop predictable as well. Visit for a list of all predicted hooks, and the Prediction pag..
Entity:SetPreventTransmit( Player player, boolean stopTransmitting )
Prevents the server from sending any further information about the entity to a player. This does not work for nextbots.When using this function, Entity:SetFlexScale will conflict with this function. Instead, consider using Entity:SetFlexScale on the client.
Entity:SetRagdollAng( number boneid, Angle pos )
Sets the bone angles. This is used alongside Kinect in Entity:SetRagdollBuildFunction, for more info see ragdoll_motion entity.
Entity:SetRagdollBuildFunction( function func )
Sets the function to build the ragdoll. This is used alongside Kinect, for more info see ragdoll_motion entity.
Entity:SetRagdollPos( number boneid, Vector pos )
Sets the bone position. This is used alongside Kinect in Entity:SetRagdollBuildFunction, for more info see ragdoll_motion entity.
Entity:SetRenderAngles( Angle newAngles )
Sets the render angles of the Entity.
Entity:SetRenderBounds( Vector mins, Vector maxs, Vector add = Vector( 0, 0, 0 ) )
Sets the render bounds for the entity. For world space coordinates see Entity:SetRenderBoundsWS.
Entity:SetRenderBoundsWS( Vector mins, Vector maxs, Vector add = Vector( 0, 0, 0 ) )
Sets the render bounds for the entity in world space coordinates. For relative coordinates see Entity:SetRenderBounds.
Entity:SetRenderClipPlane( Vector planeNormal, number planePosition )
Used to specify a plane, past which an object will be visually clipped.
Entity:SetRenderClipPlaneEnabled( boolean enabled )
Enables the use of clipping planes to "cut" objects.
Entity:SetRenderFX( number renderFX )
Sets entity's render FX.
Entity:SetRenderMode( number renderMode )
Sets the render mode of the entity.
Entity:SetRenderOrigin( Vector newOrigin )
Set the origin in which the Entity will be drawn from.
boolean Entity:SetSaveValue( string name, any value )
Sets a save value for an entity. You can see a full list of an entity's save values by creating it and printing Entity:GetSaveTable(). See Entity:GetInternalVariable for the opposite of this function. This does not type-check entity keys. Setting an entity key to a non-entity value will treat it as NULL.
Entity:SetSequence( number sequenceId )
Sets the entity's model sequence. If the specified sequence is already active, the animation will not be restarted. See Entity:ResetSequence for a function that restarts the animation even if it is already playing. In some cases you want to run Entity:ResetSequenceInfo to make this function run. This will not work properly if called directly after calling Entity:SetModel. Consider waiting until the next Tick. Will not work on players due to the animations being reset every frame by the base gamemode anima..
Entity:SetShouldPlayPickupSound( boolean playsound = false )
Sets whether or not the entity should make a physics contact sound when it's been picked up by a player.
Entity:SetShouldServerRagdoll( boolean serverragdoll )
Sets if entity should create a server ragdoll on death or a client one. Player ragdolls created with this enabled will have an owner set, see Entity:SetOwner for more information on what effects this has.This is reset for players when they respawn. (Entity:Spawn)
Entity:SetSkin( number skinIndex )
Sets the skin of the entity.
Entity:SetSolid( number solid_type )
Sets the solidity of an entity.
Entity:SetSolidFlags( number flags )
Sets solid flag(s) for the entity. This overrides any other flags the entity might have had. See Entity:AddSolidFlags for adding flags.
Entity:SetSpawnEffect( boolean spawnEffect )
Sets whether the entity should use a spawn effect when it is created on the client. See Entity:GetSpawnEffect for more information on how the effect is applied. This function will only have an effect when the entity spawns. After that it will do nothing even is set to true.
Entity:SetSubMaterial( number index = nil, string material = "nil" )
Overrides a single material on the model of this entity. To set a Lua material created with CreateMaterial, just prepend a "!" to the material name. The server's value takes priority on the client.
Entity:SetTable( table tab )
Changes the table that can be accessed by indexing an entity. Each entity starts with its own table by default.
Entity:SetTransmitWithParent( boolean onoff )
When this flag is set the entity will only transmit to the player when its parent is transmitted. This is useful for things like viewmodel attachments since without this flag they will transmit to everyone (and cause the viewmodels to transmit to everyone too). In the case of scripted entities, this will override ENTITY:UpdateTransmitState
Entity:SetTrigger( boolean maketrigger )
Marks the entity as a trigger, so it will generate ENTITY:StartTouch, ENTITY:Touch and ENTITY:EndTouch callbacks. Internally this is stored as FSOLID_TRIGGER flag.
Entity:SetUnFreezable( boolean freezable = false )
Sets whether an entity can be unfrozen, meaning that it cannot be unfrozen using the physgun.
Entity:SetupBones()
Forces the entity to reconfigure its bones. You might need to call this after changing your model's scales or when manually drawing the entity multiple times at different positions. This calls the BuildBonePositions callback added via Entity:AddCallback, so avoid calling this function inside it to prevent an infinite loop.
Entity:SetupPhonemeMappings( string fileRoot )
Initializes the class names of an entity's phoneme mappings (mouth movement data). This is called by default with argument "phonemes" when a flex-based entity (such as an NPC) is created. TF2 phonemes can be accessed by using a path such as "player/scout/phonemes/phonemes" , check TF2's "tf2_misc_dir.vpk" with GCFScape for other paths, however it seems that TF2 sounds don't contain phoneme definitions anymore after being converted to mp3 and only rely on VCD animations, this..
Entity:SetUseType( number useType )
Sets the use type of an entity, affecting how often ENTITY:Use will be called for Lua entities.
Entity:SetVar( any key, any value )
Allows to quickly set variable to entity's Entity:GetTable. This will not network the variable to client(s). You want Entity:SetNWString and similar functions for that
Entity:SetVelocity( Vector velocity )
Sets the entity's velocity. For entities with physics, consider using PhysObj:SetVelocity on the PhysObj of the entity. Actually binds to CBaseEntity::SetBaseVelocity() which sets the entity's velocity due to forces applied by other entities.If applied to a player, this will actually ADD velocity, not set it.
Entity:SetWeaponModel( string viewModel, Weapon weapon = NULL )
Sets the model and associated weapon to this viewmodel entity. This is used internally when the player switches weapon. View models are not drawn without a weapons associated to them.This will silently fail if the entity is not a viewmodel.
number Entity:SkinCount()
Returns the amount of skins the entity has.
boolean Entity:SnatchModelInstance( Entity srcEntity )
Moves the model instance from the source entity to this entity. This can be used to transfer decals that have been applied on one entity to another. Both entities must have the same model.
Entity:Spawn()
Initializes the entity and starts its networking. If called on a player, it will respawn them. This calls ENTITY:Initialize on Lua-defined entities.
number Entity:StartLoopingSound( string sound )
Starts a "looping" sound. As with any other sound playing methods, this function expects the sound file to be looping itself and will not automatically loop a non looping sound file as one might expect. This function is almost identical to CreateSound, with the exception of the sound being created in the STATIC channel and with normal attenuation. See also Entity:StopLoopingSound
Entity:StartMotionController()
Starts a motion controller in the physics engine tied to this entity's PhysObj, which enables the use of ENTITY:PhysicsSimulate. The motion controller can later be destroyed via Entity:StopMotionController. Motion controllers are used internally to control other Entities' PhysObjects, such as the Gravity Gun, +use pickup and the Physics Gun. This function should be called every time you recreate the Entity's PhysObj. Or alternatively you should call Entity:AddToMotionController on the new PhysObj. Also se..
Entity:StopAndDestroyParticles()
Stops all particle effects parented to the entity and immediately destroys them.
Entity:StopLoopingSound( number id )
Stops a sound created by Entity:StartLoopingSound.
Entity:StopMotionController()
Stops the motion controller created with Entity:StartMotionController.
Entity:StopParticleEmission()
Stops all particle effects parented to the entity. This is ran automatically on every client by Entity:StopParticles if called on the server.
Entity:StopParticles()
Stops any attached to the entity .pcf particles using ParticleEffectAttach. On client, this is the same as Entity:StopParticleEmission. ( and you should use StopParticleEmission instead ) On server, this is the same as running Entity:StopParticleEmission on every client.
Entity:StopParticlesNamed( string name )
Stops all particle effects parented to the entity with given name.
Entity:StopParticlesWithNameAndAttachment( string name, number attachment )
Stops all particle effects parented to the entity with given name on given attachment.
Entity:StopSound( string sound )
Stops emitting the given sound from the entity, especially useful for looping sounds.
Entity:TakeDamage( number damageAmount, Entity attacker, Entity inflictor )
Applies the specified amount of damage to the entity with DMG_GENERIC flag. Calling this function on the victim entity in ENTITY:OnTakeDamage can cause infinite loops.
Entity:TakeDamageInfo( CTakeDamageInfo damageInfo )
Applies the damage specified by the damage info to the entity. Calling this function on the victim entity in ENTITY:OnTakeDamage can cause infinite loops.
Entity:TakePhysicsDamage( CTakeDamageInfo dmginfo )
Applies forces to our physics object in response to damage.
boolean Entity:TestPVS( any testPoint )
Check if the given position or entity is within this entity's PVS. See also Entity:IsDormant. The function won't take in to account AddOriginToPVS and the like.
number Entity:TranslateBoneToPhysBone( number boneID )
Returns the ID of a PhysObj attached to the given bone. To be used with Entity:GetPhysicsObjectNum. See Entity:TranslatePhysBoneToBone for reverse function.
number Entity:TranslatePhysBoneToBone( number physNum )
Returns the boneID of the bone the given PhysObj is attached to. See Entity:TranslateBoneToPhysBone for reverse function.
Entity:Use( Entity activator, Entity caller, number useType, number value )
Simulates a +use action on an entity.
Entity:UseClientSideAnimation()
Does nothing on server. Animations will be handled purely clientside instead of a fixed animtime, enabling interpolation. This does not affect layers and gestures.
Entity:UseTriggerBounds( boolean enable, number boundSize = 0 )
Enables or disables trigger bounds. This will give the entity a "trigger box" that extends around its bounding box by boundSize units in X/Y and (boundSize / 2) in +Z (-Z remains the same). The trigger box is world aligned and will work regardless of the object's solidity and collision group. Valve use trigger boxes for all pickup items. Their bloat size is 24, a surprisingly large figure. The trigger boxes can be made visible as a light blue box by using the ent_bbox console command while looki..
number Entity:ViewModelIndex()
Returns the index of this view model, it can be used to identify which one of the player's view models this entity is.
boolean Entity:Visible( Entity target )
Returns whether the target/given entity is visible from the this entity. This is meant to be used only with NPCs. Differences from a simple trace include: If target has FL_NOTARGET, returns false If ai_ignoreplayers is turned on and target is a player, returns false Reacts to ai_LOS_mode: If 1, does a simple trace with COLLISION_GROUP_NONE and MASK_BLOCKLOS If not, does a trace with MASK_BLOCKLOS_AND_NPCS ( - CONTENTS_BLOCKLOS is target is player ) and a custom LOS filter ( CTraceFilterLOS ) Retu..
boolean Entity:VisibleVec( Vector pos )
Returns true if supplied vector is visible from the entity's line of sight. This is achieved similarly to a trace.
number Entity:WaterLevel()
Returns an integer that represents how deep in water the entity is. 0 - The entity isn't in water. 1 - Slightly submerged (at least to the feet). 2 - The majority of the entity is submerged (at least to the waist). 3 - Completely submerged.
Entity:Weapon_SetActivity( number act, number duration )
Sets the activity of the entity's active weapon. This does nothing on the client.Only works for CBaseCombatCharacter entities, which includes players and NPCs.
number Entity:Weapon_TranslateActivity( number act )
Calls and returns WEAPON:TranslateActivity on the weapon the entity ( player or NPC ) carries. Despite existing on client, it doesn't actually do anything on client.
Vector, Vector Entity:WorldSpaceAABB()
Returns two vectors representing the minimum and maximum extent of the entity's bounding box.
Vector Entity:WorldSpaceCenter()
Returns the center of the entity according to its collision model.
Vector Entity:WorldToLocal( Vector wpos )
Converts a worldspace vector into a vector local to an entity
Angle Entity:WorldToLocalAngles( Angle ang )
Converts world angles to local angles ( local to the entity )