Globals
float AngleDiff( float_1, float_2 )Returns the number of degrees difference between two yaw angles
void AppendToLogFile( string_1, string_2 )Appends a string to a log file on the server
Quaternion AxisAngleToQuaternion( Vector_1, float_2 )(vector,float) constructs a quaternion representing a rotation by angle around the specified vector axis
Vector CalcClosestPointOnEntityOBB( handle_1, Vector_2 )Compute the closest point on the OBB of an entity.
float CalcDistanceBetweenEntityOBB( handle_1, handle_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.
float CalcDistanceToLineSegment2D( Vector_1, Vector_2, Vector_3 )
void CancelEntityIOEvents( ehandle_1 )Create all I/O events for a particular entity
bool CreateEffect( handle_1 )Pass table - Inputs: entity, effect
handle CreateHTTPRequest( string_1, string_2 )Create an HTTP request.
handle CreateHTTPRequestScriptVM( string_1, string_2 )Create an HTTP request.
Vector CrossVectors( Vector_1, Vector_2 )(vector,vector) cross product between two vectors
void DebugBreak( )Breaks in the debugger
void DebugDrawBox( Vector_1, Vector_2, Vector_3, int_4, int_5, int_6, int_7, float_8 )Draw a debug overlay box (origin, mins, maxs, forward, r, g, b, a, duration )
void DebugDrawBoxDirection( Vector_1, Vector_2, Vector_3, Vector_4, Vector_5, float_6, float_7 )Draw a debug forward box (cent, min, max, forward, vRgb, a, duration)
void DebugDrawCircle( Vector_1, Vector_2, float_3, float_4, bool_5, float_6 )Draw a debug circle (center, vRgb, a, rad, ztest, duration)
void DebugDrawClear( )Try to clear all the debug overlay info
void DebugDrawLine( Vector_1, Vector_2, int_3, int_4, int_5, bool_6, float_7 )Draw a debug overlay line (origin, target, r, g, b, ztest, duration)
void DebugDrawLine_vCol( Vector_1, Vector_2, Vector_3, bool_4, float_5 )Draw a debug line using color vec (start, end, vRgb, a, ztest, duration)
void DebugDrawScreenTextLine( float_1, float_2, int_3, string_4, int_5, int_6, int_7, int_8, float_9 )Draw text with a line offset (x, y, lineOffset, text, r, g, b, a, duration)
void DebugDrawSphere( Vector_1, Vector_2, float_3, float_4, bool_5, float_6 )Draw a debug sphere (center, vRgb, a, rad, ztest, duration)
void DebugDrawText( Vector_1, string_2, bool_3, float_4 )Draw text in 3d (origin, text, bViewCheck, duration)
void DebugScreenTextPretty( float_1, float_2, int_3, string_4, int_5, int_6, int_7, int_8, float_9, string_10, int_11, bool_12 )Draw pretty debug text (x, y, lineOffset, text, r, g, b, a, duration, font, size, bBold)
bool DoIncludeScript( string_1, handle_2 )Execute a script (internal)
void DoScriptAssert( bool_1, string_2 )#ScriptAssert:Asserts the passed in value. Prints out a message and brings up the assert dialog.
string DoUniqueString( string_1 )#UniqueString: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.
void EmitSoundOn( string_1, handle_2 )Play named sound on Entity
void EmitSoundOnClient( string_1, handle_2 )Play named sound only on the client for the passed in player
handle EntIndexToHScript( int_1 )Turn an entity index integer to an HScript representing that entity's script instance.
float ExponentialDecay( float_1, float_2, float_3 )Smooth curve decreasing slower as it approaches zero
void FireEntityIOInputNameOnly( ehandle_1, string_2 )Fire Entity's Action Input w/no data
void FireEntityIOInputString( ehandle_1, string_2, string_3 )Fire Entity's Action Input with passed String - you own the memory
void FireEntityIOInputVec( ehandle_1, string_2, Vector_3 )Fire Entity's Action Input with passed Vector - you own the memory
void FireGameEvent( string_1, handle_2 )Fire a game event.
void FireGameEventLocal( string_1, handle_2 )Fire a game event without broadcasting to the client.
float FrameTime( )Get the time spent on the server in the last frame
int GetFrameCount( )Returns the engines current frame count
handle GetListenServerHost( )Get the local player on a listen server.
string GetMapName( )Get the name of the map.
float GetMaxOutputDelay( ehandle_1, string_2 )Get the longest delay for all events attached to an output
Vector GetPhysAngularVelocity( handle_1 )Get Angular Velocity for VPHYS or normal object. Returns a vector of the axis of rotation, multiplied by the degrees of rotation per second.
Vector GetPhysVelocity( handle_1 )Get Velocity for VPHYS or normal object
void InitLogFile( string_1, string_2 )If the given file doesn't exist, creates it with the given contents; does nothing if it exists
bool IsClient( )Returns true if this is lua running from the client.dll.
bool IsDedicatedServer( )Returns true if this server is a dedicated server.
bool IsInToolsMode( )Returns true if this is lua running within tools mode.
bool IsMarkedForDeletion( handle_1 )Returns true if the entity is valid and marked for deletion.
bool IsServer( )Returns true if this is lua running from the server.dll.
bool IsValidEntity( handle_1 )Checks to see if the given hScript is a valid entity
Vector LerpVectors( Vector_1, Vector_2, float_3 )(vector,vector,float) lerp between two vectors by a float factor returning new vector
void LinkLuaModifier( string_1, string_2, int_3 )Link a lua-defined modifier with the associated class ( className, fileName, LuaModifierType).
int ListenToGameEvent( string_1, handle_2, handle_3 )Register as a listener for a game event from script.
table LoadKeyValues( string_1 )Creates a table from the specified keyvalues text file
table LoadKeyValuesFromString( string_1 )Creates a table from the specified keyvalues string
table LocalTime( )Get the current local time
int MakeStringToken( string_1 )Checks to see if the given hScript is a valid entity
void Msg( string_1 )Print a message
handle PlayerInstanceFromIndex( int_1 )Get a script instance of a player by index.
void PrecacheEntityFromTable( string_1, handle_2, handle_3 )Precache an entity from KeyValues in table
void PrecacheEntityListFromTable( handle_1, handle_2 )Precache a list of entity KeyValues tables
void PrintLinkedConsoleMessage( string_1, string_2 )Print a console message with a linked console command
float RandomFloat( float_1, float_2 )Get a random float within a range
int RandomInt( int_1, int_2 )Get a random int within a range
void RegisterSpawnGroupFilterProxy( string_1 )Create a C proxy for a script-based spawn group filter
void ReloadMOTD( )Reloads the MotD file
void RemoveSpawnGroupFilterProxy( string_1 )Remove the C proxy for a script-based spawn group filter
QAngle RotateOrientation( QAngle_1, QAngle_2 )Rotate a QAngle by another QAngle.
Vector RotatePosition( Vector_1, QAngle_2, Vector_3 )Rotate a Vector around a point.
Quaternion RotateQuaternionByAxisAngle( Quaternion_1, Vector_2, float_3 )(quaternion,vector,float) rotates a quaternion by the specified angle around the specified vector axis
QAngle RotationDelta( QAngle_1, QAngle_2 )Find the delta between two QAngles.
Vector RotationDeltaAsAngularVelocity( QAngle_1, QAngle_2 )converts delta QAngle to an angular velocity Vector
void ScreenShake( Vector_1, float_2, float_3, float_4, float_5, int_6, bool_7 )Start a screenshake with the following parameters. vecCenter, flAmplitude, flFrequency, flDuration, flRadius, eCommand( SHAKE_START = 0, SHAKE_STOP = 1 ), bAirShake
void SendToConsole( string_1 )Send a string to the console as a client command
void SetOpvarFloatAll( string_1, string_2, string_3, float_4 )Sets an opvar value for all players
void SetOpvarFloatPlayer( string_1, string_2, string_3, float_4, handle_5 )Sets an opvar value for a single player
void SetPhysAngularVelocity( handle_1, Vector_2 )Set Angular Velocity for VPHYS or normal object, from a vector of the axis of rotation, multiplied by the degrees of rotation per second.
void SetQuestName( string_1 )Set the current quest name.
void SetQuestPhase( int_1 )Set the current quest phase.
void SetRenderingEnabled( ehandle_1, bool_2 )Set rendering on/off for an ehandle
handle SpawnEntityFromTableSynchronous( string_1, handle_2 )Synchronously spawns a single entity from a table
bool SpawnEntityGroupFromTable( handle_1, bool_2, handle_3 )Hierarchically spawn an entity group from a set of spawn tables.
int SpawnEntityListFromTableAsynchronous( handle_1, handle_2 )Asynchronously spawn an entity group from a list of spawn tables. A callback will be triggered when the spawning is complete
handle SpawnEntityListFromTableSynchronous( handle_1 )Synchronously spawn an entity group from a list of spawn tables.
Quaternion SplineQuaternions( Quaternion_1, Quaternion_2, float_3 )(quaternion,quaternion,float) very basic interpolation of v0 to v1 over t on [0,1]
Vector SplineVectors( Vector_1, Vector_2, float_3 )(vector,vector,float) very basic interpolation of v0 to v1 over t on [0,1]
void StartSoundEvent( string_1, handle_2 )Start a sound event
void StartSoundEventFromPosition( string_1, Vector_2 )Start a sound event from position
void StartSoundEventFromPositionReliable( string_1, Vector_2 )Start a sound event from position with reliable delivery
void StartSoundEventFromPositionUnreliable( string_1, Vector_2 )Start a sound event from position with optional delivery
void StartSoundEventReliable( string_1, handle_2 )Start a sound event with reliable delivery
void StartSoundEventUnreliable( string_1, handle_2 )Start a sound event with optional delivery
void StopEffect( handle_1, string_2 )Pass entity and effect name
void StopListeningToAllGameEvents( handle_1 )Stop listening to all game events within a specific context.
bool StopListeningToGameEvent( int_1 )Stop listening to a particular game event.
void StopSoundEvent( string_1, handle_2 )Stops a sound event with optional delivery
void StopSoundOn( string_1, handle_2 )Stop named sound on Entity
float Time( )Get the current server time
bool TraceCollideable( handle_1 )Pass table - Inputs: start, end, ent, (optional mins, maxs) -- outputs: pos, fraction, hit, startsolid, normal
bool TraceHull( handle_1 )Pass table - Inputs: start, end, min, max, mask, ignore -- outputs: pos, fraction, hit, enthit, startsolid
bool TraceLine( handle_1 )Pass table - Inputs: startpos, endpos, mask, ignore -- outputs: pos, fraction, hit, enthit, startsolid
void UTIL_Remove( handle_1 )Removes the specified entity
void UTIL_RemoveImmediate( handle_1 )Immediately removes the specified entity
int UnitFilter( handle_1, int_2, int_3, int_4, int_5 )Check if a unit passes a set of filters. (hNPC, nTargetTeam, nTargetType, nTargetFlags, nTeam
void UnloadSpawnGroup( string_1 )Unload a spawn group by name
void UnloadSpawnGroupByHandle( int_1 )Unload a spawn group by handle
QAngle VectorToAngles( Vector_1 )Get Qangles (with no roll) for a Vector.
void Warning( string_1 )Print a warning
float cvar_getf( string_1 )Gets the value of the given cvar, as a float.
bool cvar_setf( string_1, float_2 )Sets the value of the given cvar, as a float.
bool rr_AddDecisionRule( handle_1 )Add a rule to the decision database.
bool rr_CommitAIResponse( handle_1, handle_2 )Commit the result of QueryBestResponse back to the given entity to play. Call with params (entity, airesponse)
handle rr_GetResponseTargets( )Retrieve a table of all available expresser targets, in the form { name : handle, name: handle }.
bool rr_QueryBestResponse( handle_1, handle_2, handle_3 )Params: (entity, query) : tests 'query' against entity's response system and returns the best response found (or null if none found).