VScript API
IMPORTANT
VScript is currently discontinued and all progress on it has been halted. This documentation is provided as-is and may not be accurate.
⚠️ The current state of VScript ⚠️
As of the mirage update, VScript is intentionally disabled by Valve. This means that the lua runtime is no longer available in the base game. While there are patches that re-enable VScript, we do not recommend using them as they might stop working at any point in time. Valve has been working on a new scripting system (Pulse) for a while now, but it is not yet1 available to the public.
Class Methods
CBaseEntity
Function | Signature | Description |
---|---|---|
AddEffects | void AddEffects( int nFlags ) | Adds the render effect flag. |
ApplyAbsVelocityImpulse | void ApplyAbsVelocityImpulse( Vector vecImpulse ) | Apply a Velocity Impulse |
ApplyLocalAngularVelocityImpulse | void ApplyLocalAngularVelocityImpulse( Vector angImpulse ) | Apply an Ang Velocity Impulse |
Attribute_GetFloatValue | float Attribute_GetFloatValue( string pName, float flDefault ) | Get float value for an entity attribute. |
Attribute_GetIntValue | int Attribute_GetIntValue( string pName, int nDefault ) | Get int value for an entity attribute. |
Attribute_SetFloatValue | void Attribute_SetFloatValue( string pName, float flValue ) | Set float value for an entity attribute. |
Attribute_SetIntValue | void Attribute_SetIntValue( string pName, int nValue ) | Set int value for an entity attribute. |
DeleteAttribute | void DeleteAttribute( string pName ) | Delete an entity attribute. |
EmitSound | void EmitSound( string soundname ) | Plays a sound from this entity. |
EmitSoundParams | void EmitSoundParams( string soundname, int nPitch, float flVolume, float flDelay ) | Plays/modifies a sound from this entity. changes sound if nPitch and/or flVol or flSoundTime is > 0. |
EyeAngles | QAngle EyeAngles( ) | Get the qangles that this entity is looking at. |
EyePosition | Vector EyePosition( ) | Get vector to eye position - absolute coords. |
FirstMoveChild | handle FirstMoveChild( ) | If in hierarchy, get the first move child |
FollowEntity | void FollowEntity( handle hEnt, bool bBoneMerge ) | hEntity to follow, bool bBoneMerge |
FollowEntityMerge | void FollowEntityMerge( handle hEnt, string pszBoneOrAttachName ) | hEntity to follow, string BoneOrAttachName |
GatherCriteria | void GatherCriteria( handle hResult ) | Returns a table containing the criteria that would be used for response queries on this entity. This is the same as the table that is passed to response rule script function callbacks. |
GetAbsOrigin | Vector GetAbsOrigin( ) | Returns the world space origin of the entity |
GetAbsScale | float GetAbsScale( ) | Get the absolute entity scale |
GetAngles | QAngle GetAngles( ) | Get the entity pitch, yaw, roll as QAngle |
GetAnglesAsVector | Vector GetAnglesAsVector( ) | Get entity pitch, yaw, roll as a Vector. |
GetAngularVelocity | Vector GetAngularVelocity( ) | Get the local angular velocity - returns a Vector of pitch,yaw,roll |
GetBaseVelocity | Vector GetBaseVelocity( ) | Get Base? velocity. |
GetBoundingMaxs | Vector GetBoundingMaxs( ) | Get a vector containing max bounds, centered on object. |
GetBoundingMins | Vector GetBoundingMins( ) | Get a vector containing min bounds, centered on object. |
GetBounds | table GetBounds( ) | Get a table containing the 'Mins' & 'Maxs' vector bounds, centered on object. |
GetCenter | Vector GetCenter( ) | Get vector to center of object - absolute coords |
GetChildren | handle GetChildren( ) | Get the entities parented to this entity. |
GetContext | table GetContext( string name ) | Looks up a context and returns it if available. May return string, float, or null (if the context isn't found). |
GetForwardVector | Vector GetForwardVector( ) | Get the forward vector of the entity. |
GetHealth | int GetHealth( ) | Get the health of this entity. |
GetLeftVector | Vector GetLeftVector( ) | Get the left vector of the entity. |
GetLocalAngles | QAngle GetLocalAngles( ) | Get entity local pitch, yaw, roll as a QAngle |
GetLocalAngularVelocity | QAngle GetLocalAngularVelocity( ) | Maybe local angvel |
GetLocalOrigin | Vector GetLocalOrigin( ) | Get entity local origin as a Vector |
GetLocalScale | float GetLocalScale( ) | Get the entity scale relative to that of its parent |
GetLocalVelocity | Vector GetLocalVelocity( ) | Get Entity relative velocity. |
GetMass | float GetMass( ) | Get the mass of an entity. (returns 0 if it doesn't have a physics object) |
GetMaxHealth | int GetMaxHealth( ) | Get the maximum health of this entity. |
GetModelName | string GetModelName( ) | Returns the name of the model. |
GetMoveParent | handle GetMoveParent( ) | If in hierarchy, retrieves the entity's parent. |
GetOrigin | Vector GetOrigin( ) | Returns this entity's local origin |
GetOwner | handle GetOwner( ) | Gets this entity's owner |
GetOwnerEntity | handle GetOwnerEntity( ) | Get the owner entity, if there is one |
GetRightVector | Vector GetRightVector( ) | Get the right vector of the entity. WARNING: This produces a left-handed coordinate system. Use GetLeftVector instead (which is aligned with the y axis of the entity). |
GetRootMoveParent | handle GetRootMoveParent( ) | If in hierarchy, walks up the hierarchy to find the root parent. |
GetSoundDuration | float GetSoundDuration( string soundname, string actormodel ) | Returns float duration of the sound. Takes soundname and optional actormodelname. |
GetSpawnGroupHandle | int GetSpawnGroupHandle( ) | Returns the spawn group handle of this entity |
GetTeam | int GetTeam( ) | Get the team number of this entity. |
GetTeamNumber | int GetTeamNumber( ) | Get the team number of this entity. |
GetUpVector | Vector GetUpVector( ) | Get the up vector of the entity. |
GetVelocity | Vector GetVelocity( ) | World space velocity of the entity |
HasAttribute | bool HasAttribute( string pName ) | See if an entity has a particular attribute. |
IsAlive | bool IsAlive( ) | Is this entity alive? |
IsNPC | bool IsNPC( ) | Is this entity an CAI_BaseNPC? |
IsPlayerController | bool IsPlayerController( ) | Is this entity a player controller? |
IsPlayerPawn | bool IsPlayerPawn( ) | Is this entity a player pawn? |
Kill | void Kill( ) | Deletes the entity (UTIL_Remove()). If run on a player, this will kick them from the server |
NextMovePeer | handle NextMovePeer( ) | Return the next entity in the same movement hierarchy |
OverrideFriction | void OverrideFriction( float duration, float friction ) | Takes duration, value for a temporary override. |
PrecacheScriptSound | void PrecacheScriptSound( string soundname ) | Precache a sound for later playing. |
RemoveEffects | void RemoveEffects( int nFlags ) | Removes the render effect flag. |
SetAbsAngles | void SetAbsAngles( float fPitch, float fYaw, float fRoll ) | Set entity pitch, yaw, roll by component. |
SetAbsOrigin | void SetAbsOrigin( Vector origin ) | Sets the world space entity origin |
SetAbsScale | void SetAbsScale( float flScale ) | Set the absolute scale of the entity |
SetAngles | void SetAngles( float fPitch, float fYaw, float fRoll ) | Set entity pitch, yaw, roll by component. |
SetAngularVelocity | void SetAngularVelocity( float pitchVel, float yawVel, float rollVel ) | Set the local angular velocity - takes float pitch,yaw,roll velocities |
SetConstraint | void SetConstraint( Vector vPos ) | Set the position of the constraint. |
SetContext | void SetContext( string pName, string pValue, float duration ) | Store any key/value pair in this entity's dialog contexts. Value must be a string. Will last for duration (set 0 to mean 'forever'). |
SetContextNum | void SetContextNum( string pName, float fValue, float duration ) | Store any key/value pair in this entity's dialog contexts. Value must be a number (int or float). Will last for duration (set 0 to mean 'forever'). |
SetContextThink | void SetContextThink( string pszContextName, handle hThinkFunc, float flInterval ) | Set a think function on this entity. |
SetEntityName | void SetEntityName( string pName ) | Set the targetname of an entity. |
SetForwardVector | void SetForwardVector( Vector v ) | Set the orientation of the entity to have this forward vector. |
SetFriction | void SetFriction( float flFriction ) | Set PLAYER friction, ignored for objects. |
SetGravity | void SetGravity( float flGravity ) | Set PLAYER gravity, ignored for objects. |
SetHealth | void SetHealth( int nHealth ) | Set the health of this entity. |
SetLocalAngles | void SetLocalAngles( float fPitch, float fYaw, float fRoll ) | Set entity local pitch, yaw, roll by component |
SetLocalOrigin | void SetLocalOrigin( Vector origin ) | Set entity local origin from a Vector |
SetLocalScale | void SetLocalScale( float flScale ) | Set the entity scale relative to the entity's parent |
SetMass | void SetMass( float flMass ) | Set the mass of an entity. (does nothing if it doesn't have a physics object) |
SetMaxHealth | void SetMaxHealth( int amt ) | Set the maximum health of this entity. |
SetOrigin | void SetOrigin( Vector v ) | Set entity absolute origin |
SetOwner | void SetOwner( handle pOwner ) | Sets this entity's owner |
SetParent | void SetParent( handle hParent, string pAttachmentname ) | Set the parent for this entity. |
SetTeam | void SetTeam( int iTeamNum ) | Set entity team. If run on a live player, this will set their health to 0 |
SetVelocity | void SetVelocity( Vector vecVelocity ) | Sets the world space velocity of the entity |
StopSound | void StopSound( string soundname ) | Stops a named sound playing from this entity. |
TakeDamage | int TakeDamage( handle hInfo ) | Apply damage to this entity. Use CreateDamageInfo() to create a damageinfo object. |
TransformPointEntityToWorld | Vector TransformPointEntityToWorld( Vector vPoint ) | Returns the input Vector transformed from entity to world space |
TransformPointWorldToEntity | Vector TransformPointWorldToEntity( Vector vPoint ) | Returns the input Vector transformed from world to entity space |
Trigger | void Trigger( ) | Fires off this entity's OnTrigger responses. |
ValidatePrivateScriptScope | void ValidatePrivateScriptScope( ) | Validates the private script scope and creates it if one doesn't exist. |
CBaseEntity Hooks
Adding a function with this signature to the entity script causes it to be called from code at the appropriate moment.
Function | Signature | Description |
---|---|---|
Activate | void Activate( int activateType ) | Called on Activate, after the entity has spawned. If the entity is spawned on map load, Activate is called after all entities have spawned. The activateType parameter contains an enumeration. |
OnBreak | void OnBreak( handle inflictor ) | Called when a breakable entity is broken |
OnEntText | string OnEntText( ) | Called every frame when ent_text is enabled on the entity. Return a string to be added to the ent_text printout |
OnTakeDamage | void OnTakeDamage( table damageTable ) | Called when the entity takes damage. Table format: {inflictor = handle, damage_direction = Vector, damage_position = Vector, damage_force = Vector, damage = int, attacker = handle} |
Precache | void Precache( CScriptPrecacheContext context ) | Called when the entity is precached. Used to precache any additional resources needed by the script using the global Precache family of script functions |
Spawn | void Spawn( CScriptKeyValues spawnkeys) | Called on Spawn, just after the entity has been created, but before it has been initialized. Passes a CScriptKeyValues handle that can be used to query the entity spawn keyvalues. |
UpdateOnRemove | void UpdateOnRemove() | Called before the entity is killed |
CBaseAnimGraph
Function | Signature | Description |
---|---|---|
GetGraphParameter | table GetGraphParameter( string pszParam ) | Get the value of the given animGraph parameter |
SetGraphLookTarget | void SetGraphLookTarget( Vector vValue ) | Pass the desired look target in world space to the graph |
SetGraphParameter | void SetGraphParameter( string pszParam, table svArg ) | Set the specific param value, type is inferred from the type in script |
SetGraphParameterBool | void SetGraphParameterBool( string szName, bool bValue ) | Set the specific param on or off |
SetGraphParameterEnum | void SetGraphParameterEnum( string szName, int nValue ) | Pass the enum (int) value to the specified param |
SetGraphParameterFloat | void SetGraphParameterFloat( string szName, float flValue ) | Pass the float value to the specified param |
SetGraphParameterInt | void SetGraphParameterInt( string szName, int nValue ) | Pass the int value to the specified param |
SetGraphParameterVector | void SetGraphParameterVector( string szName, Vector vValue ) | Pass the vector value to the specified param in the graph |
CBaseFlex
Function | Signature | Description |
---|---|---|
GetCurrentScene | handle GetCurrentScene( ) | Returns the instance of the oldest active scene entity (if any). |
GetSceneByIndex | handle GetSceneByIndex( int index ) | Returns the instance of the scene entity at the specified index. |
ScriptPlayScene | float ScriptPlayScene( string pszScene, float flDelay ) | Play specified vcd file |
CBaseModelEntity
Function | Signature | Description |
---|---|---|
GetAttachmentAngles | Vector GetAttachmentAngles( int iAttachment ) | Get the attachment id's angles as a p,y,r vector. |
GetAttachmentForward | Vector GetAttachmentForward( int iAttachment ) | Get the attachment id's forward vector. |
GetAttachmentOrigin | Vector GetAttachmentOrigin( int iAttachment ) | Get the attachment id's origin vector. |
GetMaterialGroupHash | unsigned GetMaterialGroupHash( ) | Get the material group hash of this entity. |
GetMaterialGroupMask | uint64 GetMaterialGroupMask( ) | Get the mesh group mask of this entity. |
GetModelScale | float GetModelScale( ) | Get scale of entity's model. |
GetRenderAlpha | int GetRenderAlpha( ) | Get the alpha modulation of this entity. |
GetRenderColor | Vector GetRenderColor( ) | Get the render color of the entity. |
ScriptLookupAttachment | int ScriptLookupAttachment( string pAttachmentName ) | Get the named attachment id. |
SetBodygroup | void SetBodygroup( int iGroup, int iValue ) | Sets a bodygroup. |
SetBodygroupByName | void SetBodygroupByName( string pName, int iValue ) | Sets a bodygroup by name. |
SetLightGroup | void SetLightGroup( string pLightGroup ) | Sets the light group of the entity. |
SetMaterialGroup | void SetMaterialGroup( string pMaterialGroup ) | Set the material group of this entity. |
SetMaterialGroupHash | void SetMaterialGroupHash( unsigned nHash ) | Set the material group hash of this entity. |
SetMaterialGroupMask | void SetMaterialGroupMask( uint64 nMeshGroupMask ) | Set the mesh group mask of this entity. |
SetModel | void SetModel( string pModelName ) | Changes the model of the entity. Make sure the new model is precached before using |
SetModelScale | void SetModelScale( float flScale ) | Set scale of entity's model. |
SetRenderAlpha | void SetRenderAlpha( int nAlpha ) | Set the alpha modulation of this entity. |
SetRenderColor | void SetRenderColor( int r, int g, int b ) | Sets the render color of the entity. |
SetRenderMode | void SetRenderMode( int nMode ) | Sets the render mode of the entity. |
SetSingleMeshGroup | void SetSingleMeshGroup( string pMeshGroupName ) | Set a single mesh group for this entity. |
SetSize | void SetSize( Vector mins, Vector maxs ) | |
SetSkin | void SetSkin( int iSkin ) | Set skin |
CBasePlayerController
Function | Signature | Description |
---|---|---|
GetPawn | handle GetPawn( ) | Returns the pawn for this controller |
CBasePlayerPawn
Function | Signature | Description |
---|---|---|
GetController | handle GetController( ) | Returns the controller for this pawn |
GetEquippedWeapons | table GetEquippedWeapons( ) | Returns an array of all the equipped weapons |
GetWeaponCount | int GetWeaponCount( ) | Gets the number of weapons currently equipped |
IsNoclipping | bool IsNoclipping( ) | Returns true if the player is in noclip mode. |
CBaseTrigger
Function | Signature | Description |
---|---|---|
Disable | void Disable( ) | Disable's the trigger |
Enable | void Enable( ) | Enable the trigger |
IsTouching | bool IsTouching( handle entity ) | Checks whether the passed entity is touching the trigger. |
CBodyComponent
Function | Signature | Description |
---|---|---|
AddImpulseAtPosition | void AddImpulseAtPosition( Vector Vector_1, Vector Vector_2 ) | Apply an impulse at a worldspace position to the physics |
AddVelocity | void AddVelocity( Vector linearVelocity, Vector angVelocity ) | Add linear and angular velocity to the physics object |
DetachFromParent | void DetachFromParent( ) | Detach from its parent |
GetSequence | int GetSequence( ) | Returns the active sequence |
IsAttachedToParent | bool IsAttachedToParent( ) | Is attached to parent |
LookupSequence | int LookupSequence( string name ) | Returns a sequence id given a name |
SequenceDuration | float SequenceDuration( string pSequenceName ) | Returns the duration in seconds of the specified sequence |
SetAngularVelocity | void SetAngularVelocity( Vector angVelocity ) | |
SetMaterialGroup | void SetMaterialGroup( utlstringtoken pMaterialGroup ) | |
SetVelocity | void SetVelocity( Vector velocity ) |
CCustomGameEventManager
Function | Signature | Description |
---|---|---|
RegisterListener | int RegisterListener( string EventName, function CallbackFunction ) | Register a callback to be called when a particular custom event arrives. Returns a listener ID that can be used to unregister later. |
Send_ServerToAllClients | void Send_ServerToAllClients( string EventName, table EventData ) | |
Send_ServerToPlayer | void Send_ServerToPlayer( handle player, string EventName, table EventData ) | |
Send_ServerToTeam | void Send_ServerToTeam( int TeamNumber, string EventName, table EventData ) | |
UnregisterListener | void UnregisterListener( int ListnerID ) | Unregister a specific listener |
CDebugOverlayScriptHelper
Function | Signature | Description |
---|---|---|
Axis | void Axis( Vector Vector_1, Quaternion Quaternion_2, float float_3, bool bool_4, float float_5 ) | Draws an axis. Specify origin + orientation in world space. |
Box | void Box( Vector Vector_1, Vector Vector_2, int int_3, int int_4, int int_5, int int_6, bool bool_7, float float_8 ) | Draws a world-space axis-aligned box. Specify bounds in world space. |
BoxAngles | void BoxAngles( Vector Vector_1, Vector Vector_2, Vector Vector_3, Quaternion Quaternion_4, int int_5, int int_6, int int_7, int int_8, bool bool_9, float float_10 ) | Draws an oriented box at the origin. Specify bounds in local space. |
Capsule | void Capsule( Vector Vector_1, Quaternion Quaternion_2, float float_3, float float_4, int int_5, int int_6, int int_7, int int_8, bool bool_9, float float_10 ) | Draws a capsule. Specify base in world space. |
Circle | void Circle( Vector Vector_1, Quaternion Quaternion_2, float float_3, int int_4, int int_5, int int_6, int int_7, bool bool_8, float float_9 ) | Draws a circle. Specify center in world space. |
CircleScreenOriented | void CircleScreenOriented( Vector Vector_1, float float_2, int int_3, int int_4, int int_5, int int_6, bool bool_7, float float_8 ) | Draws a circle oriented to the screen. Specify center in world space. |
Cone | void Cone( Vector Vector_1, Vector Vector_2, float float_3, float float_4, int int_5, int int_6, int int_7, int int_8, bool bool_9, float float_10 ) | Draws a wireframe cone. Specify endpoint and direction in world space. |
Cross | void Cross( Vector Vector_1, float float_2, int int_3, int int_4, int int_5, int int_6, bool bool_7, float float_8 ) | Draws a screen-aligned cross. Specify origin in world space. |
Cross3D | void Cross3D( Vector Vector_1, float float_2, int int_3, int int_4, int int_5, int int_6, bool bool_7, float float_8 ) | Draws a world-aligned cross. Specify origin in world space. |
Cross3DOriented | void Cross3DOriented( Vector Vector_1, Quaternion Quaternion_2, float float_3, int int_4, int int_5, int int_6, int int_7, bool bool_8, float float_9 ) | Draws an oriented cross. Specify origin in world space. |
DrawTickMarkedLine | void DrawTickMarkedLine( Vector Vector_1, Vector Vector_2, float float_3, int int_4, int int_5, int int_6, int int_7, int int_8, bool bool_9, float float_10 ) | Draws a dashed line. Specify endpoints in world space. |
EntityAttachments | void EntityAttachments( ehandle ehandle_1, float float_2, float float_3 ) | Draws the attachments of the entity |
EntityAxis | void EntityAxis( ehandle ehandle_1, float float_2, bool bool_3, float float_4 ) | Draws the axis of the entity origin |
EntityBounds | void EntityBounds( ehandle ehandle_1, int int_2, int int_3, int int_4, int int_5, bool bool_6, float float_7 ) | Draws bounds of an entity |
EntitySkeleton | void EntitySkeleton( ehandle ehandle_1, float float_2 ) | Draws the skeleton of the entity |
EntityText | void EntityText( ehandle ehandle_1, int int_2, string string_3, int int_4, int int_5, int int_6, int int_7, float float_8 ) | Draws text on an entity |
FilledRect2D | void FilledRect2D( Vector2D Vector2D_1, Vector2D Vector2D_2, int int_3, int int_4, int int_5, int int_6, float float_7 ) | Draws a screen-space filled 2D rectangle. Coordinates are in pixels. |
HorzArrow | void HorzArrow( Vector Vector_1, Vector Vector_2, float float_3, int int_4, int int_5, int int_6, int int_7, bool bool_8, float float_9 ) | Draws a horizontal arrow. Specify endpoints in world space. |
Line | void Line( Vector Vector_1, Vector Vector_2, int int_3, int int_4, int int_5, int int_6, bool bool_7, float float_8 ) | Draws a line between two points |
Line2D | void Line2D( Vector2D Vector2D_1, Vector2D Vector2D_2, int int_3, int int_4, int int_5, int int_6, float float_7 ) | Draws a line between two points in screenspace |
PopDebugOverlayScope | void PopDebugOverlayScope( ) | Pops the identifier used to group overlays. Overlays marked with this identifier can be deleted in a big batch. |
PushAndClearDebugOverlayScope | void PushAndClearDebugOverlayScope( utlstringtoken utlstringtoken_1 ) | Pushes an identifier used to group overlays. Deletes all existing overlays using this overlay id. |
PushDebugOverlayScope | void PushDebugOverlayScope( utlstringtoken utlstringtoken_1 ) | Pushes an identifier used to group overlays. Overlays marked with this identifier can be deleted in a big batch. |
RemoveAllInScope | void RemoveAllInScope( utlstringtoken utlstringtoken_1 ) | Removes all overlays marked with a specific identifier, regardless of their lifetime. |
SolidCone | void SolidCone( Vector Vector_1, Vector Vector_2, float float_3, float float_4, int int_5, int int_6, int int_7, int int_8, bool bool_9, float float_10 ) | Draws a solid cone. Specify endpoint and direction in world space. |
Sphere | void Sphere( Vector Vector_1, float float_2, int int_3, int int_4, int int_5, int int_6, bool bool_7, float float_8 ) | Draws a wireframe sphere. Specify center in world space. |
SweptBox | void SweptBox( Vector Vector_1, Vector Vector_2, Vector Vector_3, Vector Vector_4, Quaternion Quaternion_5, int int_6, int int_7, int int_8, int int_9, float float_10 ) | Draws a swept box. Specify endpoints in world space and the bounds in local space. |
Text | void Text( Vector Vector_1, int int_2, string string_3, float float_4, int int_5, int int_6, int int_7, int int_8, float float_9 ) | Draws 2D text. Specify origin in world space. |
Texture | void Texture( string string_1, Vector2D Vector2D_2, Vector2D Vector2D_3, int int_4, int int_5, int int_6, int int_7, Vector2D Vector2D_8, Vector2D Vector2D_9, float float_10 ) | Draws a screen-space texture. Coordinates are in pixels. |
Triangle | void Triangle( Vector Vector_1, Vector Vector_2, Vector Vector_3, int int_4, int int_5, int int_6, int int_7, bool bool_8, float float_9 ) | Draws a filled triangle. Specify vertices in world space. |
VectorText3D | void VectorText3D( Vector Vector_1, Quaternion Quaternion_2, string string_3, int int_4, int int_5, int int_6, int int_7, bool bool_8, float float_9 ) | Draws 3D text. Specify origin + orientation in world space. |
VertArrow | void VertArrow( Vector Vector_1, Vector Vector_2, float float_3, int int_4, int int_5, int int_6, int int_7, bool bool_8, float float_9 ) | Draws a vertical arrow. Specify endpoints in world space. |
YawArrow | void YawArrow( Vector Vector_1, float float_2, float float_3, float float_4, int int_5, int int_6, int int_7, int int_8, bool bool_9, float float_10 ) | Draws a arrow associated with a specific yaw. Specify endpoints in world space. |
CEntities
Function | Signature | Description |
---|---|---|
CreateByClassname | handle CreateByClassname( string classname ) | Creates an entity by classname |
FindAllByClassname | table FindAllByClassname( string classname ) | Finds all entities by class name. Returns an array containing all the found entities. |
FindAllByClassnameWithin | table FindAllByClassnameWithin( string classname, Vector origin, float radius ) | Find entities by class name within a radius. |
FindAllByModel | table FindAllByModel( string modelName ) | Find entities by model name. |
FindAllByName | table FindAllByName( string targetname ) | Find all entities by name. Returns an array containing all the found entities in it. |
FindAllByNameWithin | table FindAllByNameWithin( string targetname, Vector origin, float radius ) | Find entities by name within a radius. |
FindAllByTarget | table FindAllByTarget( string targetname ) | Find entities by targetname. |
FindAllInSphere | table FindAllInSphere( Vector origin, float radius ) | Find entities within a radius. |
FindByClassname | handle FindByClassname( handle startFrom, string classname ) | Find entities by class name. Pass 'null' to start an iteration, or reference to a previously found entity to continue a search |
FindByClassnameNearest | handle FindByClassnameNearest( string classname, Vector origin, float maxRadius ) | Find entities by class name nearest to a point. |
FindByClassnameWithin | handle FindByClassnameWithin( handle startFrom, string classname, Vector origin, float radius ) | Find entities by class name within a radius. Pass 'null' to start an iteration, or reference to a previously found entity to continue a search |
FindByModel | handle FindByModel( handle startFrom, string modelName ) | Find entities by model name. Pass 'null' to start an iteration, or reference to a previously found entity to continue a search |
FindByModelWithin | handle FindByModelWithin( handle startFrom, string modelName, Vector origin, float radius ) | Find entities by model name within a radius. Pass 'null' to start an iteration, or reference to a previously found entity to continue a search |
FindByName | handle FindByName( handle startFrom, string targetname ) | Find entities by name. Pass 'null' to start an iteration, or reference to a previously found entity to continue a search |
FindByNameNearest | handle FindByNameNearest( string targetname, Vector origin, float maxRadius ) | Find entities by name nearest to a point. |
FindByNameWithin | handle FindByNameWithin( handle startFrom, string targetname, Vector origin, float radius ) | Find entities by name within a radius. Pass 'null' to start an iteration, or reference to a previously found entity to continue a search |
FindByTarget | handle FindByTarget( handle startFrom, string targetname ) | Find entities by targetname. Pass 'null' to start an iteration, or reference to a previously found entity to continue a search |
FindInSphere | handle FindInSphere( handle startFrom, Vector origin, float radius ) | Find entities within a radius. Pass 'null' to start an iteration, or reference to a previously found entity to continue a search |
First | handle First( ) | Begin an iteration over the list of entities |
GetLocalPlayerController | handle GetLocalPlayerController( ) | Get the local player controller. |
GetLocalPlayerPawn | handle GetLocalPlayerPawn( ) | Get the local player pawn. |
Next | handle Next( handle startFrom ) | Continue an iteration over the list of entities, providing reference to a previously found entity |
CEntityInstance
Function | Signature | Description |
---|---|---|
ConnectOutput | void ConnectOutput( string output, string functionName ) | Adds an I/O connection that will call the named function on this entity when the specified output fires. |
Destroy | void Destroy( ) | |
DisconnectOutput | void DisconnectOutput( string output, string functionName ) | Removes a connected script function from an I/O event on this entity. |
DisconnectRedirectedOutput | void DisconnectRedirectedOutput( string output, string functionName, handle entity ) | Removes a connected script function from an I/O event on the passed entity. |
FireOutput | void FireOutput( string outputName, handle activator, handle caller, table parameters, float delay ) | Fire an entity output |
GetClassname | string GetClassname( ) | |
GetDebugName | string GetDebugName( ) | Get the entity name w/help if not defined (i.e. classname/etc) |
GetEntityHandle | ehandle GetEntityHandle( ) | Get the entity as an EHANDLE |
GetEntityIndex | int GetEntityIndex( ) | |
GetIntAttr | int GetIntAttr( string key ) | Get Integer Attribute |
GetName | string GetName( ) | |
GetOrCreatePrivateScriptScope | handle GetOrCreatePrivateScriptScope( ) | Retrieve, creating if necessary, the private per-instance script-side data associated with an entity |
GetOrCreatePublicScriptScope | handle GetOrCreatePublicScriptScope( ) | Retrieve, creating if necessary, the public script-side data associated with an entity |
GetPrivateScriptScope | handle GetPrivateScriptScope( ) | Retrieve the private per-instance script-side data associated with an entity |
GetPublicScriptScope | handle GetPublicScriptScope( ) | Retrieve the public script-side data associated with an entity |
RedirectOutput | void RedirectOutput( string output, string functionName, handle entity ) | Adds an I/O connection that will call the named function on the passed entity when the specified output fires. |
RemoveSelf | void RemoveSelf( ) | Delete this entity |
SetIntAttr | void SetIntAttr( string key, int value ) | Set Integer Attribute |
entindex | int entindex( ) |
CEnvEntityMaker
Function | Signature | Description |
---|---|---|
SpawnEntity | void SpawnEntity( ) | Create an entity at the location of the maker |
SpawnEntityAtEntityOrigin | void SpawnEntityAtEntityOrigin( handle hEntity ) | Create an entity at the location of a specified entity instance |
SpawnEntityAtLocation | void SpawnEntityAtLocation( Vector vecAlternateOrigin, Vector vecAlternateAngles ) | Create an entity at a specified location and orientaton, orientation is Euler angle in degrees (pitch, yaw, roll) |
SpawnEntityAtNamedEntityOrigin | void SpawnEntityAtNamedEntityOrigin( string pszName ) | Create an entity at the location of a named entity |
CEnvProjectedTexture
Function | Signature | Description |
---|---|---|
SetFarRange | void SetFarRange( float flRange ) | Set light maximum range |
SetLinearAttenuation | void SetLinearAttenuation( float flAtten ) | Set light linear attenuation value |
SetNearRange | void SetNearRange( float flRange ) | Set light minimum range |
SetQuadraticAttenuation | void SetQuadraticAttenuation( float flAtten ) | Set light quadratic attenuation value |
SetVolumetrics | void SetVolumetrics( bool bOn, float flIntensity, float flNoise, int nPlanes, float flPlaneOffset ) | Turn on/off light volumetrics: bool bOn, float flIntensity, float flNoise, int nPlanes, float flPlaneOffset |
CHostage
Function | Signature | Description |
---|---|---|
IsBeingCarried | bool IsBeingCarried( ) | Get whether the hostage is currently being carried or not |
CInfoData
Function | Signature | Description |
---|---|---|
QueryColor | Vector QueryColor( utlstringtoken tok, Vector vDefault ) | Query color data for this key |
QueryFloat | float QueryFloat( utlstringtoken tok, float flDefault ) | Query float data for this key |
QueryInt | int QueryInt( utlstringtoken tok, int nDefault ) | Query int data for this key |
QueryNumber | float QueryNumber( utlstringtoken tok, float flDefault ) | Query number data for this key |
QueryString | string QueryString( utlstringtoken tok, string pDefault ) | Query string data for this key |
QueryVector | Vector QueryVector( utlstringtoken tok, Vector vDefault ) | Query vector data for this key |
CInfoWorldLayer
Function | Signature | Description |
---|---|---|
HideWorldLayer | void HideWorldLayer( ) | Hides this layer |
ShowWorldLayer | void ShowWorldLayer( ) | Shows this layer |
CLogicRelay
Function | Signature | Description |
---|---|---|
Trigger | void Trigger( handle hActivator, handle hCaller ) | Triggers the logic_relay |
CMarkupVolumeTagged
Function | Signature | Description |
---|---|---|
HasTag | bool HasTag( string pszTagName ) | Returns whether this volume have the given tag. |
CNativeOutputs
Function | Signature | Description |
---|---|---|
constructor | CNativeOutputs( ) | Creates a new CNativeOutputs object. |
AddOutput | void AddOutput( string outputName, string description ) | Add an output |
Init | void Init( int numOutputs ) | Initialize with number of outputs |
CPhysicsProp
Function | Signature | Description |
---|---|---|
DisableMotion | void DisableMotion( ) | Disable motion for the prop |
EnableMotion | void EnableMotion( ) | Enable motion for the prop |
SetDynamicVsDynamicContinuous | void SetDynamicVsDynamicContinuous( bool bIsDynamicVsDynamicContinuousEnabled ) | Enable/disable dynamic vs dynamic continuous collision traces |
CPointClientUIWorldPanel
Function | Signature | Description |
---|---|---|
AcceptUserInput | void AcceptUserInput( ) | Tells the panel to accept user input. |
AddCSSClasses | void AddCSSClasses( string pszClasses ) | Adds CSS class(es) to the panel |
IgnoreUserInput | void IgnoreUserInput( ) | Tells the panel to ignore user input. |
IsGrabbable | bool IsGrabbable( ) | Returns whether this entity is grabbable. |
RemoveCSSClasses | void RemoveCSSClasses( string pszClasses ) | Remove CSS class(es) from the panel |
CPointTemplate
Function | Signature | Description |
---|---|---|
DeleteCreatedSpawnGroups | void DeleteCreatedSpawnGroups( ) | Deletes any spawn groups that this point_template has spawned. Note: The point_template will not be deleted by this. |
ForceSpawn | void ForceSpawn( ) | Spawns all of the entities the point_template is pointing at. |
GetSpawnedEntities | handle GetSpawnedEntities( ) | Get the list of the most recent spawned entities |
SetSpawnCallback | void SetSpawnCallback( handle hCallbackFunc, handle hCallbackScope ) | SetSpawnCallback( hCallbackFunc, hCallbackScope, hCallbackData ) : Set a callback for when the template spawns entities. The spawned entities will be passed in as an array. |
CPointWorldText
Function | Signature | Description |
---|---|---|
SetMessage | void SetMessage( string pMessage ) | Set the message on this entity. |
CSceneEntity
Function | Signature | Description |
---|---|---|
AddBroadcastTeamTarget | void AddBroadcastTeamTarget( int team ) | Adds a team (by index) to the broadcast list |
Cancel | void Cancel( ) | Cancel scene playback |
EstimateLength | float EstimateLength( ) | Returns length of this scene in seconds. |
FindCamera | handle FindCamera( ) | Get the camera |
FindNamedEntity | handle FindNamedEntity( string reference ) | Given an entity reference, such as !target, get actual entity from scene object |
IsPaused | bool IsPaused( ) | If this scene is currently paused. |
IsPlayingBack | bool IsPlayingBack( ) | If this scene is currently playing. |
LoadSceneFromString | bool LoadSceneFromString( string sceneName, string vcd ) | Given a dummy scene name and a vcd string, load the scene |
RemoveBroadcastTeamTarget | void RemoveBroadcastTeamTarget( int team ) | Removes a team (by index) from the broadcast list |
Start | void Start( handle activator ) | Start scene playback, takes activatorEntity as param |
CScriptKeyValues
Function | Signature | Description |
---|---|---|
GetValue | table GetValue( string key ) | Reads a spawn key |
CScriptParticleManager
Function | Signature | Description |
---|---|---|
CreateParticle | int CreateParticle( string particleName, int particleAttach, handle owningEntity ) | Creates a new particle effect |
CreateParticleForPlayer | int CreateParticleForPlayer( string particleName, int particleAttach, handle owningEntity, handle owningPlayer ) | Creates a new particle effect that only plays for the specified player |
DestroyParticle | void DestroyParticle( int particleID, bool bDestroyImmediately ) | Destroy a particle, if bDestroyImmediately destroy it without playing end caps. |
GetParticleReplacement | string GetParticleReplacement( string string_1, handle handle_2 ) | |
ReleaseParticleIndex | void ReleaseParticleIndex( int particleId ) | Frees the specified particle index |
SetParticleAlwaysSimulate | void SetParticleAlwaysSimulate( int int_1 ) | |
SetParticleControl | void SetParticleControl( int particleId, int controlIndex, Vector controlData ) | Set the control point data for a control on a particle effect |
SetParticleControlEnt | void SetParticleControlEnt( int particleId, int controlIndex, handle entity, ParticleAttachment_t attachType, string attachment, Vector origin, bool bool_7 ) | Attaches the control point to an entity |
SetParticleControlOffset | void SetParticleControlOffset( int iIndex, int iPoint, Vector vecOffset ) | Set the linear offset for a control on a particle effect |
SetParticleControlTransform | void SetParticleControlTransform( int iIndex, int iPoint, Vector vOrigin, QAngle qAngles ) | Set the transform for a control on a particle effect |
SetParticleControlTransformForward | void SetParticleControlTransformForward( int iIndex, int iPoint, Vector vOrigin, Vector vecForward ) | Set the origin and forward direction for a control on a particle effect |
CScriptPrecacheContext
Function | Signature | Description |
---|---|---|
AddResource | void AddResource( string path ) | Precaches a specific resource |
GetValue | table GetValue( string name ) | Reads a spawn key |
Convars
Function | Signature | Description |
---|---|---|
GetBool | bool GetBool( string name ) | Returns the convar as a boolean flag. |
GetCommandClient | handle GetCommandClient( ) | Returns the player who issued this console command. |
GetFloat | float GetFloat( string name ) | Returns the convar as a float. May return null if no such convar. |
GetInt | int GetInt( string name ) | Returns the convar as an int. May return null if no such convar. |
GetStr | string GetStr( string name ) | Returns the convar as a string. May return null if no such convar. |
RegisterCommand | void RegisterCommand( string name, handle function, string helpString, int flags ) | Register a console command. |
RegisterConvar | void RegisterConvar( string name, string defaultValue, string helpString, int flags ) | Register a new console variable. |
SetBool | void SetBool( string name, bool val ) | Sets the value of the convar to the bool. |
SetFloat | void SetFloat( string name, float val ) | Sets the value of the convar to the float. |
SetInt | void SetInt( string name, int val ) | Sets the value of the convar to the int. |
SetStr | void SetStr( string name, string val ) | Sets the value of the convar to the string. |
GlobalSys
Function | Signature | Description |
---|---|---|
CommandLineCheck | table CommandLineCheck( string name ) | Returns true if the command line param was used, otherwise false. |
CommandLineFloat | table CommandLineFloat( string name, float float_2 ) | Returns the command line param as a float. |
CommandLineInt | table CommandLineInt( string name, int int_2 ) | Returns the command line param as an int. |
CommandLineStr | table CommandLineStr( string name, string string_2 ) | Returns the command line param as a string. |
SteamInfo
Function | Signature | Description |
---|---|---|
IsPublicUniverse | bool IsPublicUniverse( ) | Is the script connected to the public Steam universe |
CTakeDamageInfo
DamageInfo handle returned by CreateDamageInfo()
Function | Signature | Description |
---|---|---|
AddDamage | void AddDamage( float flAddAmount ) | Add flAddAmount to the damage value |
AddDamageType | void AddDamageType( int bitsDamageType ) | Add bitsDamageType to damage types |
GetAmmoType | int GetAmmoType( ) | Returns the ammo type |
GetAttacker | handle GetAttacker( ) | Returns the attacker's entity |
GetDamage | float GetDamage( ) | Returns the damage value |
GetDamageCustom | int GetDamageCustom( ) | |
GetDamageForce | Vector GetDamageForce( ) | Returns the directional Vector |
GetDamagePosition | Vector GetDamagePosition( ) | Returns the position Vector of the damage |
GetDamageType | int GetDamageType( ) | Returns the damage type |
GetInflictor | handle GetInflictor( ) | Returns the inflictor's entity (usually the weapon) |
GetOriginalDamage | float GetOriginalDamage( ) | |
GetReportedPosition | Vector GetReportedPosition( ) | |
HasDamageType | bool HasDamageType( int bitsToTest ) | Returns whether or not bitsToTest exists in the damage type |
IsNull | bool IsNull( ) | |
ScaleDamage | void ScaleDamage( float flScaleAmount ) | Scales the damage value by flScaleAmount |
SetAmmoType | void SetAmmoType( int iAmmoType ) | Sets the ammo type to iAmmoType |
SetAttacker | void SetAttacker( handle hAttacker ) | Sets the attacker's entity to hAttacker |
SetDamage | void SetDamage( float flDamage ) | Sets the damage value to flDamage |
SetDamageCustom | void SetDamageCustom( int iDamageCustom ) | |
SetDamageForce | void SetDamageForce( Vector damageForce ) | Sets the directional Vector to damageForce |
SetDamagePosition | void SetDamagePosition( Vector damagePosition ) | Sets the positional Vector to damagePosition |
SetDamageType | void SetDamageType( int bitsDamageType ) | Sets the damage type to bitsDamageType |
SetOriginalDamage | void SetOriginalDamage( float flOriginalDamage ) | |
SetReportedPosition | void SetReportedPosition( Vector reportedPosition ) |
QAngle
Function | Signature | Description |
---|---|---|
constructor | QAngle( float pitch, float yaw, float roll ) | Creates a new QAngle |
__add | QAngle __add( QAngle a, QAngle b ) | Adds two QAngles together. Overloaded with + operator. Use RotateOrientation() instead to properly rotate angles. |
__eq | bool __eq( QAngle a, QAngle b ) | Tests for equality. Overloaded with == operator |
__tostring | string __tostring( ) | Converts the QAngle into a string. Overloaded with .. operator |
Forward | Vector Forward( ) | Returns the forward Vector |
Left | Vector Left( ) | Returns the left Vector |
Up | Vector Up( ) | Returns the Up Vector |
QAngle Members
Variable | Description |
---|---|
x | Pitch angle |
y | Yaw angle |
z | Roll angle |
Vector
Function | Signature | Description |
---|---|---|
constructor | Vector( float x, float y, float z ) | Creates a new Vector |
__add | Vector __add( Vector a, Vector b ) | Adds two Vectors together. Overloaded with + operator |
__div | Vector __div( Vector a, Vector b ) | Divides a by b. Overloaded with / operator |
__eq | bool __eq( Vector a, Vector b ) | Tests for equality. Overloaded with == operator |
__len | float __len( ) | Returns the length of the Vector. Overloaded with # operator |
__mul | Vector __mul( Vector a, Vector/Scalar b ) | Multiplies a Vector with scalar or another Vector. Overloaded with * operator |
__sub | Vector __sub( Vector a, Vector b ) | Subtracts b from a. Overloaded with - operator |
__tostring | string __tostring( ) | Converts the Vector into a string. Overloaded with .. operator |
__unm | Vector __unm( ) | Reverse the Vector. Overloaded with unary - |
Cross | Vector Cross( Vector a, Vector b ) | Cross product of two vectors |
Dot | float Dot( Vector a, Vector b ) | Dot product of two vectors |
Length | float Length( ) | Length of the Vector |
Length2D | float Length2D( ) | Length of the Vector in the XY plane |
Lerp | Vector Lerp( Vector target, float time ) | Linear interpolation between the vector and the passed in target over time = [0,1] |
Normalized | Vector Normalized( ) | Returns the unit Vector |
Vector Members
Variable | Description |
---|---|
x | X-Axis |
y | Y-Axis |
z | Z-Axis |
Global Functions
Debug
Function | Signature | Description |
---|---|---|
DebugBreak | void DebugBreak( ) | Breaks in the debugger |
DebugDrawBox | void DebugDrawBox( Vector center, Vector mins, Vector maxs, int r, int g, int b, int a, float duration ) | Draw a debug overlay box |
DebugDrawBoxDirection | void DebugDrawBoxDirection( Vector center, Vector min, Vector max, Vector forward, Vector vRgb, float a, float duration ) | Draw a debug forward box |
DebugDrawCircle | void DebugDrawCircle( Vector center, Vector vRgb, float a, float rad, bool ztest, float duration ) | Draw a debug circle |
DebugDrawClear | void DebugDrawClear( ) | Try to clear all the debug overlay info |
DebugDrawLine | void DebugDrawLine( Vector origin, Vector target, int r, int g, int b, bool ztest, float duration ) | Draw a debug overlay line |
DebugDrawLine_vCol | void DebugDrawLine_vCol( Vector start, Vector end, Vector vRgb, bool ztest, float duration ) | Draw a debug line using color vec |
DebugDrawScreenTextLine | void DebugDrawScreenTextLine( float x, float y, int lineOffset, string text, int r, int g, int b, int a, float duration ) | Draw text with a line offset |
DebugDrawSphere | void DebugDrawSphere( Vector center, Vector vRgb, float a, float rad, bool ztest, float duration ) | Draw a debug sphere |
DebugDrawText | void DebugDrawText( Vector origin, string text, bool bViewCheck, float duration ) | Draw text in 3d |
DebugScreenTextPretty | void DebugScreenTextPretty( float x, float y, int lineOffset, string text, int r, int g, int b, int a, float duration, string font, int size, bool bBold ) | Draw pretty debug text |
DoScriptAssert | void DoScriptAssert( bool assertion, string message ) | Asserts the passed in value. Prints out a message and brings up the assert dialog. |
Printing
Function | Signature | Description |
---|---|---|
Msg | void Msg( string message ) | Print a message |
PrintLinkedConsoleMessage | void PrintLinkedConsoleMessage( string message, string command ) | Print a console message with a linked console command |
Say | void Say( handle entity, string message, bool isTeamOnly ) | Have Entity say string, and isTeamOnly or not |
ScriptPrintMessageCenterAll | void ScriptPrintMessageCenterAll( string message ) | Prints an alert message in the center print method to all players. |
ScriptPrintMessageCenterAllWithParams | void ScriptPrintMessageCenterAllWithParams( string message, string string_2, string string_3, string string_4 ) | Prints an alert message in the center print method to all players. Needs to pass token/message. param1, param2, param3. Can pass null if you need less than 3. |
ScriptPrintMessageCenterTeam | void ScriptPrintMessageCenterTeam( int team, string message ) | Prints an alert message in the center print method to the specified team. 0 = None. 1 = Spectators. 2 = Terrorists. 3 = Counter-Terrorists |
ScriptPrintMessageChatAll | void ScriptPrintMessageChatAll( string message ) | Prints a message in chat to all players. |
ScriptPrintMessageChatTeam | void ScriptPrintMessageChatTeam( int team, string message ) | Prints a message in chat to the specified team. 0 = None. 1 = Spectators. 2 = Terrorists. 3 = Counter-Terrorists |
ShowMessage | void ShowMessage( string message ) | Print a hud message on all clients |
UTIL_MessageText | void UTIL_MessageText( int userID, string message, int r, int g, int b, int a ) | Sends colored text to one client. |
UTIL_MessageTextAll | void UTIL_MessageTextAll( string message, int r, int g, int b, int a ) | Sends colored text to all clients. |
UTIL_MessageTextAll_WithContext | void UTIL_MessageTextAll_WithContext( string message, int r, int g, int b, int a, table context ) | Sends colored text to all clients. (Valid context keys: player_id, value, team_id) |
UTIL_MessageText_WithContext | void UTIL_MessageText_WithContext( int userID, string message, int r, int g, int b, int a, table context ) | Sends colored text to one client. (Valid context keys: player_id, value, team_id) |
UTIL_ResetMessageText | void UTIL_ResetMessageText( int userID ) | Clear all message text on one client. |
UTIL_ResetMessageTextAll | void UTIL_ResetMessageTextAll( ) | Clear all message text from all clients. |
Warning | void Warning( string warning ) | Print a warning |
Training Course
Function | Signature | Description |
---|---|---|
ScriptGetBestTrainingCourseTime | int ScriptGetBestTrainingCourseTime( ) | Gets the player's best time for completing the timed course. |
ScriptGetPlayerCompletedTraining | bool ScriptGetPlayerCompletedTraining( ) | Returns true if the player has completed the initial portion of the training map. |
ScriptGetValveTrainingCourseTime | int ScriptGetValveTrainingCourseTime( ) | Gets Valve's best time for completing the timed course. |
ScriptHighlightAmmoCounter | void ScriptHighlightAmmoCounter( ) | Sends an event that is just used by the instructor system to show a hint highlighting the ammo counter. |
ScriptSetBestTrainingCourseTime | void ScriptSetBestTrainingCourseTime( int time ) | Sets the player's best time for completing the timed course. |
ScriptSetMiniScoreHidden | void ScriptSetMiniScoreHidden( bool isVisible ) | Toggles the visibility of the miniscoreboard hud element. |
ScriptSetPlayerCompletedTraining | void ScriptSetPlayerCompletedTraining( bool isCompleted ) | Sets whether the player has completed the initial portion of the training map. |
ScriptSetRadarHidden | void ScriptSetRadarHidden( bool isHidden ) | Toggles the visibility of the radar hud element. |
ScriptShowExitDoorMsg | void ScriptShowExitDoorMsg( ) | Shows a message box in trainign when the player exits through the exit door |
ScriptShowFinishMsgBox | void ScriptShowFinishMsgBox( ) | Shows a message box to let players know what to do next after finishing the training course. |
ScriptTrainingGivePlayerAmmo | void ScriptTrainingGivePlayerAmmo( ) | Refills ammo to max for all weapons the player has (only works in training). |
Co-op Strike
Function | Signature | Description |
---|---|---|
ScriptCoopCollectBonusCoin | void ScriptCoopCollectBonusCoin( ) | Marks one of the bonus coins as collected. |
ScriptCoopExtendRoundDurationTime | void ScriptCoopExtendRoundDurationTime( float time ) | Extends the round time after checkpoint during the mission. |
ScriptCoopGiveC4sToCTs | void ScriptCoopGiveC4sToCTs( int c4Count ) | Will give the number of specified C4s to all alive CT players. |
ScriptCoopMissionGetMissionNumber | int ScriptCoopMissionGetMissionNumber( ) | Gets the mission number for the current map - maps can have multiple missions on them. |
ScriptCoopMissionRespawnDeadPlayers | void ScriptCoopMissionRespawnDeadPlayers( ) | Respawns players only. |
ScriptCoopMissionSetDeadPlayerRespawnEnabled | void ScriptCoopMissionSetDeadPlayerRespawnEnabled( bool isEnabled ) | Controls whether player respawns can happen. |
ScriptCoopMissionSetNextRespawnIn | void ScriptCoopMissionSetNextRespawnIn( float float_1, bool bool_2 ) | Set the next respawn wave to happen in this many seconds. |
ScriptCoopMissionSpawnFirstEnemies | void ScriptCoopMissionSpawnFirstEnemies( int int_1 ) | Spawns the first wave of enemies in coop. |
ScriptCoopMissionSpawnNextWave | void ScriptCoopMissionSpawnNextWave( int int_1 ) | Tells the next wave of enemies to spawn in coop. Also respawns player. |
ScriptCoopResetRoundStartTime | void ScriptCoopResetRoundStartTime( ) | Resets the round time and starts the mission. |
ScriptCoopSetBotQuotaAndRefreshSpawns | void ScriptCoopSetBotQuotaAndRefreshSpawns( int quota ) | Sets the bot quota considering the # of players connected and refreshes the spawns. |
ScriptCoopToggleEntityOutlineHighlights | void ScriptCoopToggleEntityOutlineHighlights( bool isEnabled ) | Highlights all dropped weapons for players, or removes all highlights. |
Premier Mode
Function | Signature | Description |
---|---|---|
ScriptLobbyMapVetoFinished | void ScriptLobbyMapVetoFinished( string mapName, bool bool_2, bool bool_3, string string_4 ) | Switch to the selected map after lobby map veto finished. |
Sounds
Function | Signature | Description |
---|---|---|
EmitSoundOn | void EmitSoundOn( string soundName, handle entity ) | Play named sound on Entity |
EmitSoundOnClient | void EmitSoundOnClient( string soundName, handle client ) | Play named sound only on the client for the passed in player |
StartSoundEvent | void StartSoundEvent( string soundEvent, handle handle_2 ) | Start a sound event |
StartSoundEventFromPosition | void StartSoundEventFromPosition( string soundEvent, Vector position ) | Start a sound event from position |
StartSoundEventFromPositionReliable | void StartSoundEventFromPositionReliable( string soundEvent, Vector position ) | Start a sound event from position with reliable delivery |
StartSoundEventFromPositionUnreliable | void StartSoundEventFromPositionUnreliable( string soundEvent, Vector position ) | Start a sound event from position with optional delivery |
StartSoundEventReliable | void StartSoundEventReliable( string soundEvent, handle handle_2 ) | Start a sound event with reliable delivery |
StartSoundEventUnreliable | void StartSoundEventUnreliable( string soundEvent, handle handle_2 ) | Start a sound event with optional delivery |
StopSoundEvent | void StopSoundEvent( string soundEvent, handle handle_2 ) | Stops a sound event with optional delivery |
StopSoundOn | void StopSoundOn( string soundName, handle playingEntity ) | Stop named sound on Entity |
Utilities
Function | Signature | Description |
---|---|---|
DeepPrint | void DeepPrint( debugInstance, string prefix ) | Print out a class/array/instance/table to the console |
DeepString | void DeepString( debugInstance, string prefix ) | Print out a class/array/instance/table to a string |
DeepPrintTable | void DeepPrintTable( debugInstance, string prefix, bool isPublicScriptScope ) | Print out a table (and subtables) to the console |
Deg2Rad | float Deg2Rad( float deg ) | Convert degrees to radians |
Rad2Deg | float Rad2Deg( float rad ) | Convert radians to degrees |
Clamp | float Clamp( float val, float min, float max ) | Clamp the value between the min and max |
Lerp | float Lerp( float time, float float_1, float float_2 ) | Linear interpolation of float values over time [0,1] |
VectorDistanceSq | float VectorDistanceSq( Vector Vector_1, Vector Vector_2 ) | Distance between two vectors squared (faster than calculating the plain distance) |
VectorDistance | float VectorDistance( Vector Vector_1, Vector Vector_2 ) | Distance between two vectors |
VectorLerp | Vector VectorLerp( float time, Vector Vector_1, Vector Vector_2 ) | Linear interpolation of vector values over [0,1]. The native function LerpVectors performs the same task |
VectorIsZero | bool VectorIsZero( Vector Vector_1 ) | Returns whether the vector is a zero vector or not |
RemapVal | float RemapVal( float input, float a, float b, float c, float d ) | Remap a value in the range [a,b] to [c,d]. |
RemapValClamped | float RemapValClamped( float input, float a, float b, float c, float d ) | Remap a value in the range [a,b] to [c,d], clamping the output to the range. |
min | float min( float x, float y ) | Returns the smallest value of the inputs |
max | float max( float x, float y ) | Returns the largest value of the inputs |
abs | float abs( float val ) | Returns the absolute value of a float |
Merge | table Merge( table t1, table t2 ) | Merges two tables into a third, overwriting any matching keys |
Other
Function | Signature | Description |
---|---|---|
AngleDiff | float AngleDiff( float angle_1, float angle_2 ) | Returns the number of degrees difference between two yaw angles |
AnglesToVector | Vector AnglesToVector( QAngle QAngle_1 ) | Generate a vector given a QAngles |
AppendToLogFile | void AppendToLogFile( string string_1, string string_2 ) | AppendToLogFile is deprecated. Print to the console for logging instead. Appends a string to a log file on the server. |
AxisAngleToQuaternion | Quaternion AxisAngleToQuaternion( Vector axis, float angle ) | Constructs a quaternion representing a rotation by angle around the specified vector axis |
CalcClosestPointOnEntityOBB | Vector CalcClosestPointOnEntityOBB( handle entity, Vector position ) | Compute the closest point on the OBB of an entity. |
CalcDistanceBetweenEntityOBB | float CalcDistanceBetweenEntityOBB( handle entity_1, handle entity_2 ) | Compute the distance between two entity OBB. A negative return value indicates an input error. A return value of zero indicates that the OBBs are overlapping. |
CalcDistanceToLineSegment2D | float CalcDistanceToLineSegment2D( Vector P, Vector vLineA, Vector vLineB ) | Get the closest point from P to the (infinite) line through vLineA and vLineB and calculate the shortest distance from P to the line. |
CancelEntityIOEvents | void CancelEntityIOEvents( ehandle entityEhandle ) | Create all I/O events for a particular entity |
CreateDamageInfo | handle CreateDamageInfo( handle hInflictor, handle hAttacker, Vector force, Vector hitPos, float flDamage, int damageTypes ) | Allocate a damageinfo object, used as an argument to TakeDamage(). Call DestroyDamageInfo( hInfo ) to free the object. |
CreateEffect | bool CreateEffect( table keys ) | Pass table - Inputs: entity, effect |
CreateSceneEntity | handle CreateSceneEntity( string sceneName ) | Create a scene entity to play the specified scene. |
CreateTrigger | handle CreateTrigger( Vector origin, Vector mins, Vector maxs ) | Creates and returns an AABB trigger |
CreateTriggerRadiusApproximate | handle CreateTriggerRadiusApproximate( Vector origin, float radius ) | Creates and returns an AABB trigger thats bigger than the radius provided |
CreateUniformRandomStream | handle CreateUniformRandomStream( int iSeed ) | Creates a separate random number stream. |
CrossVectors | Vector CrossVectors( Vector Vector_1, Vector Vector_2 ) | Cross product between two vectors |
DestroyDamageInfo | void DestroyDamageInfo( CTakeDamageInfo info ) | Free a damageinfo object that was created with CreateDamageInfo(). |
DoEntFire | void DoEntFire( string target, string input, string parameter, float delay, handle activator, handle caller ) | #EntFire:Generate and entity i/o event |
DoEntFireByInstanceHandle | void DoEntFireByInstanceHandle( handle target, string input, string parameter, float delay, handle activator, handle caller ) | Generate and entity i/o event |
DoIncludeScript | bool DoIncludeScript( string scriptFileName, handle scope ) | Execute a script (internal) |
DoUniqueString | string DoUniqueString( string root ) | Generate a string guaranteed to be unique across the life of the script VM, with an optional root string. Useful for adding data to tables when not sure what keys are already in use in that table. |
EntIndexToHScript | handle EntIndexToHScript( int entIndex ) | Turn an entity index integer to an HScript representing that entity's script instance. |
ExponentialDecay | float ExponentialDecay( float decayTo, float decayTime, float dt ) | Smooth curve decreasing slower as it approaches zero |
FireEntityIOInputNameOnly | void FireEntityIOInputNameOnly( ehandle entityEhandle, string inputName ) | Fire Entity's Action Input w/no data |
FireEntityIOInputString | void FireEntityIOInputString( ehandle entityEhandle, string inputName, string value ) | Fire Entity's Action Input with passed String - you own the memory |
FireEntityIOInputVec | void FireEntityIOInputVec( ehandle entityEhandle, string inputName, Vector value ) | Fire Entity's Action Input with passed Vector - you own the memory |
FireGameEvent | void FireGameEvent( string eventName, table parameters ) | Fire a game event. |
FireGameEventLocal | void FireGameEventLocal( string eventName, table parameters ) | Fire a game event without broadcasting to the client. |
FrameTime | float FrameTime( ) | Get the time spent on the server in the last frame |
GetActiveSpawnGroupHandle | int GetActiveSpawnGroupHandle( ) | Returns the currently active spawn group handle |
GetFrameCount | int GetFrameCount( ) | Returns the engines current frame count |
GetListenServerHost | handle GetListenServerHost( ) | Get the local player on a listen server. |
GetMapName | string GetMapName( ) | Get the name of the map. |
GetMaxOutputDelay | float GetMaxOutputDelay( ehandle entityEhandle, string outputName ) | Get the longest delay for all events attached to an output |
GetPhysAngularVelocity | Vector GetPhysAngularVelocity( handle entity ) | Get Angular Velocity for VPHYS or normal object. Returns a vector of the axis of rotation, multiplied by the degrees of rotation per second. |
GetPhysVelocity | Vector GetPhysVelocity( handle entity ) | Get Velocity for VPHYS or normal object |
InitLogFile | void InitLogFile( string string_1, string string_2 ) | InitLogFile is deprecated. Print to the console for logging instead. If the given file doesn't exist, creates it with the given contents; does nothing if it exists. |
IsClient | bool IsClient( ) | Returns true if this is lua running from the client.dll. |
IsDedicatedServer | bool IsDedicatedServer( ) | Returns true if this server is a dedicated server. |
IsInToolsMode | bool IsInToolsMode( ) | Returns true if this is lua running within tools mode. |
IsMarkedForDeletion | bool IsMarkedForDeletion( handle entity ) | Returns true if the entity is valid and marked for deletion. |
IsServer | bool IsServer( ) | Returns true if this is lua running from the server.dll. |
IsValidEntity | bool IsValidEntity( handle entity ) | Checks to see if the given hScript is a valid entity |
LerpVectors | Vector LerpVectors( Vector startVector, Vector endVector, float factor ) | lerp between two vectors by a float factor returning new vector |
ListenToGameEvent | int ListenToGameEvent( string eventname, function callback, table context ) | Register as a listener for a game event from script. |
LoadKeyValues | table LoadKeyValues( string textFile ) | Creates a table from the specified keyvalues text file |
LoadKeyValuesFromString | table LoadKeyValuesFromString( string keyValues ) | Creates a table from the specified keyvalues string |
LocalTime | table LocalTime( ) | Get the current local time |
MakeStringToken | int MakeStringToken( string string_1 ) | Checks to see if the given hScript is a valid entity |
ManuallyTriggerSpawnGroupCompletion | void ManuallyTriggerSpawnGroupCompletion( int int_1 ) | Triggers the creation of entities in a manually-completed spawn group |
Plat_FloatTime | float Plat_FloatTime( ) | Get the current float time from the engine |
PlayerInstanceFromIndex | handle PlayerInstanceFromIndex( int index ) | Get a script instance of a player by index. |
PrecacheEntityFromTable | void PrecacheEntityFromTable( string classname, handle spawnKeyValues, handle context ) | Precache an entity from KeyValues in table |
PrecacheEntityListFromTable | void PrecacheEntityListFromTable( table groupSpawnTables, handle context ) | Precache a list of entity KeyValues tables |
PrecacheResource | void PrecacheResource( string modelName, handle context ) | Manually precache a single model |
QSlerp | QAngle QSlerp( QAngle fromAngle, QAngle toAngle, float time ) | Spherical lerp of angle from->to based on time |
RandomFloat | float RandomFloat( float min, float max ) | Get a random float within a range |
RandomInt | int RandomInt( int min, int max ) | Get a random int within a range (inclusive) |
RegisterSpawnGroupFilterProxy | void RegisterSpawnGroupFilterProxy( string string_1 ) | Create a C proxy for a script-based spawn group filter |
ReloadMOTD | void ReloadMOTD( ) | Reloads the MotD file |
RemoveSpawnGroupFilterProxy | void RemoveSpawnGroupFilterProxy( string string_1 ) | Remove the C proxy for a script-based spawn group filter |
RotateOrientation | QAngle RotateOrientation( QAngle QAngle_1, QAngle QAngle_2 ) | Rotate a QAngle by another QAngle. |
RotatePosition | Vector RotatePosition( Vector rotationOrigin, QAngle rotationAngle, Vector vectorToRotate ) | Rotate a Vector around a point. |
RotateQuaternionByAxisAngle | Quaternion RotateQuaternionByAxisAngle( Quaternion Quaternion_1, Vector axis, float angle ) | Rotates a quaternion by the specified angle around the specified vector axis |
RotationDelta | QAngle RotationDelta( QAngle src, QAngle dest ) | Find the delta between two QAngles. |
RotationDeltaAsAngularVelocity | Vector RotationDeltaAsAngularVelocity( QAngle QAngle_1, QAngle QAngle_2 ) | Converts delta QAngle to an angular velocity Vector |
ScreenShake | void ScreenShake( Vector vecCenter, float flAmplitude, float flFrequency, float flDuration, float flRadius, int eCommand, bool bAirShake ) | Start a screenshake. eCommand values: SHAKE_START = 0, SHAKE_STOP = 1 |
ScriptGetGameMode | int ScriptGetGameMode( ) | Gets the current game mode. |
ScriptGetGameType | int ScriptGetGameType( ) | Gets the current game type. |
ScriptGetRoundsPlayed | int ScriptGetRoundsPlayed( ) | Get the number of rounds played so far. |
ScriptIsLocalPlayerUsingController | bool ScriptIsLocalPlayerUsingController( ) | Returns whether the player is playing with a controller or not. |
ScriptIsWarmupPeriod | bool ScriptIsWarmupPeriod( ) | Is it warmup or not. |
SendToConsole | void SendToConsole( string command ) | Send a string to the console as a client command |
SendToServerConsole | void SendToServerConsole( string command ) | Send a string to the console as a server command |
SetOpvarFloatAll | void SetOpvarFloatAll( string string_1, string string_2, string string_3, float float_4 ) | Sets an opvar value for all players |
SetOpvarFloatPlayer | void SetOpvarFloatPlayer( string string_1, string string_2, string string_3, float float_4, handle handle_5 ) | Sets an opvar value for a single player |
SetPhysAngularVelocity | void SetPhysAngularVelocity( handle entity, Vector angVel ) | Set Angular Velocity for VPHYS or normal object, from a vector of the axis of rotation, multiplied by the degrees of rotation per second. |
SetQuestName | void SetQuestName( string string_1 ) | Set the current quest name. |
SetQuestPhase | void SetQuestPhase( int int_1 ) | Set the current quest phase. |
SetRenderingEnabled | void SetRenderingEnabled( ehandle entityEhandle, bool isEnabled ) | Set rendering on/off for an ehandle |
SpawnEntityFromTableAsynchronous | void SpawnEntityFromTableAsynchronous( string classname, table spawnKeyValues, function callback, handle handle_4 ) | Asynchronously spawns a single entity from a table |
SpawnEntityFromTableSynchronous | handle SpawnEntityFromTableSynchronous( string classname, table spawnKeyValues ) | Synchronously spawns a single entity from a table |
SpawnEntityGroupFromTable | bool SpawnEntityGroupFromTable( table groupSpawnTables, bool bAsync, function callback ) | Hierarchically spawn an entity group from a set of spawn tables. |
SpawnEntityListFromTableAsynchronous | int SpawnEntityListFromTableAsynchronous( table groupSpawnTables, function callback ) | Asynchronously spawn an entity group from a list of spawn tables. A callback will be triggered when the spawning is complete |
SpawnEntityListFromTableSynchronous | handle SpawnEntityListFromTableSynchronous( table groupSpawnTables ) | Synchronously spawn an entity group from a list of spawn tables. |
SplineQuaternions | Quaternion SplineQuaternions( Quaternion q0, Quaternion q1, float t ) | Very basic interpolation of q0 to q1 over t on [0,1] |
SplineVectors | Vector SplineVectors( Vector v0, Vector v1, float t ) | Very basic interpolation of v0 to v1 over t on [0,1] |
StopEffect | void StopEffect( handle entity, string effectName ) | Pass entity and effect name |
StopListeningToAllGameEvents | void StopListeningToAllGameEvents( table context ) | Stop listening to all game events within a specific context. |
StopListeningToGameEvent | bool StopListeningToGameEvent( int eventlistener ) | Stop listening to a particular game event. |
Time | float Time( ) | Get the current server time |
TraceCollideable | bool TraceCollideable( table parameters ) | Pass table - Inputs: start, end, ent, (optional mins, maxs) -- outputs: pos, fraction, hit, startsolid, normal |
TraceHull | bool TraceHull( table parameters ) | Pass table - Inputs: start, end, min, max, mask, ignore -- outputs: pos, fraction, hit, enthit, startsolid |
TraceLine | bool TraceLine( table parameters ) | Pass table - Inputs: startpos, endpos, mask, ignore -- outputs: pos, fraction, hit, enthit, startsolid |
UTIL_Remove | void UTIL_Remove( handle entity ) | Removes the specified entity |
UTIL_RemoveImmediate | void UTIL_RemoveImmediate( handle entity ) | Immediately removes the specified entity |
UnloadSpawnGroup | void UnloadSpawnGroup( string name ) | Unload a spawn group by name |
UnloadSpawnGroupByHandle | void UnloadSpawnGroupByHandle( int int_1 ) | Unload a spawn group by handle |
UserIDToControllerHScript | handle UserIDToControllerHScript( int userid ) | Turn a userid integer (typically, fields named 'userid' in game events) to an HScript representing the associated player controller's script instance. |
VectorToAngles | QAngle VectorToAngles( Vector input ) | Get Qangles (with no roll) for a Vector. |
cvar_getf | float cvar_getf( string cvarName ) | Gets the value of the given cvar, as a float. |
cvar_setf | bool cvar_setf( string cvarName, float value ) | Sets the value of the given cvar, as a float. |
- It is not confirmed whether Pulse will be available to the public at all.↩