Scripting API
This is the VScript API for Half-Life: Alyx.
Contents
- 1 Global
- 2 Classes
- 2.1 CBaseEntity
- 2.2 CEntityInstance
- 2.3 CBaseModelEntity
- 2.4 CBasePlayer
- 2.5 CHL2_Player
- 2.6 CBaseAnimating
- 2.7 CBaseFlex
- 2.8 CBaseCombatCharacter
- 2.9 CBodyComponent
- 2.10 CEntities
- 2.11 CAI_BaseNPC
- 2.12 CBaseTrigger
- 2.13 CEnvTimeOfDay2
- 2.14 CEnvEntityMaker
- 2.15 CEntityScriptFramework
- 2.16 CInfoWorldLayer
- 2.17 CLogicRelay
- 2.18 CMarkupVolumeTagged
- 2.19 CScriptPrecacheContext
- 2.20 CScriptKeyValues
- 2.21 CNativeOutputs
- 2.22 CEnvProjectedTexture
- 2.23 CInfoData
- 2.24 CPhysicsProp
- 2.25 CDebugOverlayScriptHelper
- 2.26 CSceneEntity
- 2.27 CCustomGameEventManager
- 2.28 CParticleSystem
- 2.29 CPointClientUIWorldPanel
- 2.30 CPointTemplate
- 2.31 CPointWorldText
- 2.32 CPropHMDAvatar
- 2.33 CPropVRHand
- 2.34 CScriptParticleManager
- 2.35 SteamInfo
- 2.36 CTakeDamageInfo
- 2.37 Convars
- 2.38 Decider
- 2.39 GlobalSys
- 2.40 Uint64
- 2.41 QAngle
- 2.42 Quarternion
- 2.43 Vector
- 3 Enumerations
- 4 See also
- 5 External links
Global
Global functions. These can be called without any class.
Math
Function | Signature | Description |
---|---|---|
AngleDiff | float AngleDiff(float ang1, float ang2)
|
Returns the number of degrees difference between two yaw angles |
AnglesToVector | Vector AnglesToVector(QAngle angle)
|
Generate a vector given a QAngles |
AxisAngleToQuaternion | Quaternion AxisAngleToQuaternion(Vector axis, float angle)
|
(vector,float) constructs a quaternion representing a rotation by angle around the specified vector axis. Bug: The Quaternion class is non-functional [todo tested in?] |
CalcClosestPointOnEntityOBB | Vector CalcClosestPointOnEntityOBB(handle entity, Vector position)
|
Compute the closest point relative to a vector on the OBB of an entity. |
CalcDistanceBetweenEntityOBB | float CalcDistanceBetweenEntityOBB(handle entity1, handle entity2)
|
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. |
CrossVectors | Vector CrossVectors(Vector v1, Vector v2)
|
Calculate the cross product between two vectors (also available as a Vector class method). |
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. |
ExponentialDecay | float ExponentialDecay(float decayTo, float decayTime, float dt)
|
Smooth curve decreasing slower as it approaches zero. |
LerpVectors | Vector LerpVectors(Vector v1, Vector v2, float t)
|
Linear interpolation of vector values over [0,1]. |
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. |
RotateOrientation | QAngle RotateOrientation(QAngle angle1, QAngle angle2)
|
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 quat, Vector axis, float angle)
|
Rotates a quaternion by the specified angle around the specified vector axis. Bug: The Quaternion class is non-functional [todo tested in?] |
RotationDelta | QAngle RotationDelta(Qangle src, Qangle dest,)
|
Find the delta between two QAngles. |
RotationDeltaAsAngularVelocity | Vector RotationDeltaAsAngularVelocity(Qangle angle1, Qangle angle2,)
|
converts delta QAngle to an angular velocity Vector. |
SplineQuaternions | Quaternion SplineQuaternions(Quaternion q0, Quaternion q1, float 't')
|
Very basic interpolation of quaternions q0 to q1 over time 't' on [0,1]. Bug: The Quaternion class is non-functional [todo tested in?] |
SplineVectors | Vector SplineVectors(Vector v0, Vector v1, float t)
|
Very basic interpolation of vectors v0 to v1 over time t on [0,1]. |
VectorToAngles | QAngle VectorToAngles(Vector input)
|
Get QAngles for a Vector. |
utilsinit.lua
Functions automatically included from the utilsinit.lua core library.
Function | Signature | Description |
---|---|---|
abs | float abs(float val)
|
Absolute value. |
Clamp | float Clamp(float val, float min, float max)
|
Clamp the value between the min and max. |
Deg2Rad | float Deg2Rad(float deg)
|
Convert degrees to radians. |
Rad2Deg | float Rad2Deg(float rad)
|
Convert radians to degrees. |
Lerp | float Lerp(float t, float a, float b)
|
Linear interpolation of float values over [0,1]. |
max | float max(float x, float x)
|
Returns the largest value of the inputs. |
min | float min(float x, float x)
|
Returns the smallest value of the inputs. |
Merge | table Merge(table t1, table t2)
|
Merges two tables into a third, overwriting any matching keys. |
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. |
VectorDistanceSq | float VectorDistanceSq(Vector v1, Vector v2)
|
Distance between two vectors squared (faster than calculating the plain distance). |
VectorDistance | float VectorDistance(Vector v1, Vector v2)
|
Distance between two vectors. |
VectorLerp | Vector VectorLerp(float t, Vector v1, Vector v2)
|
Linear interpolation of vector values over [0,1]. The native function LerpVectors performs the same task. |
VectorIsZero | bool VectorIsZero(Vector vec)
|
Check if the vector is a zero vector. |
Printing & Drawing
Function | Signature | Description |
---|---|---|
AppendToLogFile | void AppendToLogFile(string string_1, string string_2)
|
Appends a string to a log file on the server Warning:Deprecated
|
DebugDrawBox | void DebugDrawBox(Vector origin, Vector mins, Vector maxs, int r, int g, int b, int a, float duration)
|
Draw a debug overlay box |
DebugDrawBoxDirection | void DebugDrawBoxDirection(Vector origin, Vector mins, Vector maxs, Vector orientation, Vector rgb, float a, float duration)
|
Draw box oriented to a Vector direction |
DebugDrawCircle | void DebugDrawCircle(Vector origin, Vector rgb, float a, float radius, bool noDepthTest, 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 noDepthTest, float duration)
|
Draw a debug overlay line |
DebugDrawLine_vCol | void DebugDrawLine_vCol(Vector Vector_1, Vector Vector_2, Vector Vector_3, bool bool_4, float float_5)
|
Draw a debug line using color vec (start, end, vRgb, a, ztest, duration) |
DebugDrawScreenTextLine | void DebugDrawScreenTextLine(float float_1, float float_2, int int_3, string string_4, int int_5, int int_6, int int_7, int int_8, float float_9)
|
Draw text with a line offset (x, y, lineOffset, text, r, g, b, a, duration) |
DebugDrawSphere | void DebugDrawSphere(Vector Vector_1, Vector Vector_2, float float_3, float float_4, bool bool_5, float float_6)
|
Draw a debug sphere (center, vRgb, a, rad, ztest, duration) |
DebugDrawText | void DebugDrawText(Vector Vector_1, string string_2, bool bool_3, float float_4)
|
Draw text in 3d (origin, text, bViewCheck, duration) |
DebugScreenTextPretty | void DebugScreenTextPretty(float float_1, float float_2, int int_3, string string_4, int int_5, int int_6, int int_7, int int_8, float float_9, string string_10, int int_11, bool bool_12)
|
Draw pretty debug text (x, y, lineOffset, text, r, g, b, a, duration, font, size, bBold) |
Msg | void Msg(string message)
|
Print a message to the console. |
PrintLinkedConsoleMessage | void PrintLinkedConsoleMessage(string string_1, string string_2)
|
Print a console message with a linked console command |
Say | void Say(handle entity, string message, bool teamOnly)
|
Have Entity say message, and teamOnly or not |
ShowMessage | void ShowMessage(string string_1)
|
Print a hud message on all clients |
UTIL_MessageText | void UTIL_MessageText(int playerId, string message, int r, int g, int b, int a)
|
Displays a message for a specific player |
UTIL_MessageText_WithContext | void UTIL_MessageText_WithContext(int playerId, string message, int r, int g, int b, int a, table context)
|
Sends a message to a specific player in the message box with a context table |
UTIL_MessageTextAll | void UTIL_MessageTextAll(string message, int r, int g, int b, int a)
|
Sends a message to everyone in the message box |
UTIL_MessageTextAll_WithContext | void UTIL_MessageTextAll_WithContext(string message, int r, int g, int b, int a, table context)
|
Sends a message to everyone in the message box with a context table |
UTIL_ResetMessageText | void UTIL_ResetMessageText(int playerId)
|
Resets the message text for the player |
UTIL_ResetMessageTextAll | void UTIL_ResetMessageTextAll()
|
Resets the message text for all players |
Warning | void Warning(string "msg")
|
Print a warning |
Entity Manipulation
Function | Signature | Description |
---|---|---|
CancelEntityIOEvents | void CancelEntityIOEvents(EHANDLE entityEhandle)
|
Cancel all I/O events for a particular entity |
ConnectOutputs | void ConnectOutputs(table scope)
|
Connects all output script functions of the passed entity script scope to the entity outputs. Todo: Document function name format: "^On.*Output$"
|
CreateDamageInfo | CTakeDamageInfo CreateDamageInfo (handle, hInflictor, handlehAttacker,Vector force, Vector hitPos, float flDamage, int damageTypes)
|
Allocate a CTakeDamageInfo object, used as an argument to CBaseEntity::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 enabled AABB trigger |
CreateTriggerRadiusApproximate | handle CreateTriggerRadiusApproximate(Vector origin, float radius)
|
Creates and returns an AABB trigger thats bigger than the radius provided |
DestroyDamageInfo | void DestroyDamageInfo(CTakeDamageInfo info)
|
Free a CTakeDamageInfo object that was created with CreateDamageInfo(). |
DoEntFire | void DoEntFire(string target, string action, string value, float delay, handle activator, handle caller)
|
Internal native function for EntFire() .
|
DoEntFireByInstanceHandle | void DoEntFireByInstanceHandle(handle target, string action, string value, float delay, handle activator, handle caller)
|
Internal native function for EntFireByHandle() .
|
EntFire | void EntFire(table scope, string target, string action, string value = "", float delay = 0.0, handle activator = scope.thisEntity)
|
Generate an entity I/O event on all entities matching the specified target name. The script scope of the calling entity should be passed to the first parameter. |
EntFireByHandle | void EntFireByHandle(handle self, handle target, string action, string value = "", float delay = 0.0, handle activator = self)
|
Generate an entity I/O event on the specified entity. The calling entity should be passed to the first parameter. |
EntIndexToHScript | handle EntIndexToHScript(int entindex)
|
Turn an entity index integer to an HScript representing that entity's script instance. |
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 ( hEntity, szActionName, vector ) |
GetMaxOutputDelay | float GetMaxOutputDelay(EHANDLE entityEhandle, string inputName)
|
Get the longest delay for all events attached to an output |
GetPhysAngularVelocity | Vector GetPhysAngularVelocity(CBaseEntity entity)
|
Get Angular Velocity for VPHYS or normal object. Returns a vector of the axis of rotation, multiplied by the rotation in radians per second. |
GetPhysVelocity | Vector GetPhysVelocity(CBaseEntity entity)
|
Get Velocity for VPHYS or normal object. |
IsValidEntity | bool IsValidEntity(CBaseEntity entity)
|
Returns the validity of the entity. Opposite of IsNull()
|
PlayerInstanceFromIndex | handle PlayerInstanceFromIndex(int index)
|
Get a script instance of a player by player ID. |
PrecacheEntityFromTable | void PrecacheEntityFromTable(string classname, table spawnKeys, handle context)
|
Precache an entity from KeyValues in table |
PrecacheEntityListFromTable | void PrecacheEntityListFromTable(table groupSpawnTables, handle context)
|
Precache a list of entity KeyValues tables |
PrecacheModel | void PrecacheModel(string modelName, handle context)
|
Manually precache a single model. |
PrecacheResource | void PrecacheResource(string resourceType, string resourcePath, handle context)
|
model_folder|sound|soundfile|particle|particle_folder" |
SetPhysAngularVelocity | void SetPhysAngularVelocity(CBaseEntity entity, Vector angVel)
|
Set Angular Velocity for VPHYS or normal object, from a vector of the axis of rotation, multiplied by the rotation in radians per second. |
SetRenderingEnabled | void SetRenderingEnabled(EHANDLE entityEhandle, bool enabled)
|
Set rendering on/off for an EHANDLE. Bug:Unstable in Half-Life: Alyx. May cause hard crash. [todo tested in?] |
SpawnEntityFromTableAsynchronous | void SpawnEntityFromTableAsynchronous(string classname, table spawnKeys, function callback, handle unknown)
|
Asynchronously spawns a single entity from a table. A callback will be triggered when the spawning is complete, passing the handle of the entity as a parameter. |
SpawnEntityFromTableSynchronous | handle SpawnEntityFromTableSynchronous(string classname, table spawnKeys)
|
Synchronously spawns a single entity from a table |
SpawnEntityGroupFromTable | bool SpawnEntityGroupFromTable(table groupSpawnTables, bool bAsync, handle callback)
|
Hierarchically spawn an entity group from a set of spawn tables. |
SpawnEntityListFromTableAsynchronous | int SpawnEntityListFromTableAsynchronous(table groupSpawnTables, handle callback)
|
Asynchronously spawn an entity group from a list of spawn tables. A callback will be triggered when the spawning is complete, passing a list of spawned entities. |
SpawnEntityListFromTableSynchronous | handle SpawnEntityListFromTableSynchronous((table groupSpawnTables)
|
Synchronously spawn an entity group from a list of spawn tables. |
StopEffect | void StopEffect(handle entity, string effectName)
|
|
UTIL_Remove | void UTIL_Remove(handle entity)
|
Deletes the entity |
UTIL_RemoveImmediate | void UTIL_RemoveImmediate(handle entity)
|
Deletes the entity with no delay. Warning:Incorrect usage may cause crashes
|
Tracing
Function | Signature | Description |
---|---|---|
TraceCollideable | bool TraceCollideable(table parameters)
|
Does a raytrace against a single entity. Input and output parameters are stored in the specified table. |
TraceHull | bool TraceHull(table parameters)
|
Traces a axis aligned bounding box along a line. Input and output parameters are stored in the specified table. |
TraceLine | bool TraceLine(table parameters)
|
Does a raytrace along a line. Input and output parameters are stored in the specified table. |
Sound
Function | Signature | Description |
---|---|---|
EmitGlobalSound | void EmitGlobalSound(string soundName)
|
Play named sound for all players. |
EmitSoundOn | void EmitSoundOn(string string_1, handle handle_2)
|
Play named sound on Entity |
EmitSoundOnClient | void EmitSoundOnClient(string string_1, handle handle_2)
|
Play named sound only on the client for the passed in player |
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 ( szStackName, szOperatorName, szOpvarName, flOpvarValue, hEnt ) |
StartSoundEvent | void StartSoundEvent(string string_1, handle handle_2)
|
Start a sound event |
StartSoundEventFromPosition | void StartSoundEventFromPosition(string string_1, Vector Vector_2)
|
Start a sound event from position |
StartSoundEventFromPositionReliable | void StartSoundEventFromPositionReliable(string string_1, Vector Vector_2)
|
Start a sound event from position with reliable delivery |
StartSoundEventFromPositionUnreliable | void StartSoundEventFromPositionUnreliable(string string_1, Vector Vector_2)
|
Start a sound event from position with optional delivery |
StartSoundEventReliable | void StartSoundEventReliable(string string_1, handle handle_2)
|
Start a sound event with reliable delivery |
StartSoundEventUnreliable | void StartSoundEventUnreliable(string string_1, handle handle_2)
|
Start a sound event with optional delivery |
StopSoundEvent | void StopSoundEvent(string string_1, handle handle_2)
|
Stops a sound event |
StopSoundOn | void StopSoundOn(string soundName, handle playingEntity)
|
Stop named sound on Entity |
Miscellaneous
Function | Signature | Description |
---|---|---|
cvar_getf | float cvar_getf(string string_1)
|
Gets the value of the given cvar, as a float. |
cvar_setf | bool cvar_setf(string string_1, float float_2)
|
Sets the value of the given cvar, as a float. |
DebugBreak | void DebugBreak()
|
Breaks in the debugger |
DoIncludeScript | bool DoIncludeScript(string scriptFileName, handle scope)
|
Internal native function for IncludeScript() .
|
DoScriptAssert | void DoScriptAssert(bool assertion, string message)
|
Internal native function for ScriptAssert() .
|
DoUniqueString | string DoUniqueString(string root)
|
Internal native function for UniqueString() .
|
FireGameEvent | void FireGameEvent(string eventName, handle parameterTable)
|
Fire a pre-defined event, which can be found either in custom_events.txt or in dota's resource/*.res |
FireGameEventLocal | void FireGameEventLocal(string string_1, handle handle_2)
|
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. |
IncludeScript | bool IncludeScript(string scriptFileName, handle scope = nil)
|
Execute a script file. Included in the current scope by default. |
InitLogFile | void InitLogFile(string string_1, string string_2)
|
If the given file doesn't exist, creates it with the given contents; does nothing if it exists Warning:Deprecated
|
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. |
IsMarkedForDeletion | bool IsMarkedForDeletion(handle handle_1)
|
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. |
IsInToolsMode | bool IsInToolsMode()
|
Returns true if this is lua running from the dota2 workshop tools. |
ListenToGameEvent | int ListenToGameEvent(string eventname, function callback, table context)
|
Register as a listener for a game event from script. Note:eventname in local file '*\Half-Life Alyx\game\core\pak01_dir.vpk\resource\core.gameevents'
|
LoadKeyValues | table LoadKeyValues(string string_1)
|
Creates a table from the specified keyvalues text file |
LoadKeyValuesFromString | table LoadKeyValuesFromString(string string_1)
|
Creates a table from the specified keyvalues string |
LocalTime | table LocalTime()
|
Returns the local system time as a table with the format {Hours = int; Minutes = int; Seconds = int} |
MakeStringToken | int MakeStringToken(string string_1)
|
|
ManuallyTriggerSpawnGroupCompletion | void ManuallyTriggerSpawnGroupCompletion(int int_1)
|
Triggers the creation of entities in a manually-completed spawn group |
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 |
rr_AddDecisionRule | bool rr_AddDecisionRule(handle handle_1)
|
Add a rule to the decision database. |
rr_CommitAIResponse | bool rr_CommitAIResponse(handle handle_1, handle handle_2)
|
Commit the result of QueryBestResponse back to the given entity to play. Call with params (entity, airesponse) |
rr_GetResponseTargets | handle rr_GetResponseTargets()
|
Retrieve a table of all available expresser targets, in the form { name : handle, name: handle }. |
rr_QueryBestResponse | bool rr_QueryBestResponse(handle handle_1, handle handle_2, handle handle_3)
|
Params: ( hEnt, hQuery, hResult ) // Static : tests 'query' against entity's response system and returns the best response found (or nil if none found). |
ScreenShake | void ScreenShake(Vector Vector_1, float float_2, float float_3, float float_4, float float_5, int int_6, bool bool_7)
|
Start a screenshake with the following parameters. vecCenter, flAmplitude, flFrequency, flDuration, flRadius, eCommand( SHAKE_START = 0, SHAKE_STOP = 1 ), bAirShake |
ScriptAssert | void ScriptAssert(bool assertion, string message = "")
|
Asserts the passed in value. Prints out a message and brings up the assert dialog. |
SendToConsole | void SendToConsole(string string_1)
|
Send a string to the console as a client command |
SendToServerConsole | void SendToServerConsole(string string_1)
|
Send a string to the console as a server command |
SetQuestName | void SetQuestName(string string_1)
|
Set the current quest name. |
SetQuestPhase | void SetQuestPhase(int int_1)
|
Set the current quest phase. |
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 |
UniqueString | string UniqueString(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 table's when not sure what keys are already in use in that table. |
UnloadSpawnGroup | void UnloadSpawnGroup(string string_1)
|
Unload a spawn group by name |
UnloadSpawnGroupByHandle | void UnloadSpawnGroupByHandle(int int_1)
|
Unload a spawn group by handle |
UpdateEventPoints | void UpdateEventPoints(handle handle_1)
|
No Description Set |
VLua
Functions automatically included from the library.lua core library. Located in the vlua
table rather than directly in the global scope.
Library functions to support Lua code generated by Sq2Lua.exe
Function | Signature | Description |
---|---|---|
vlua.clear | table vlua.clear(table t)
|
Implements Squirrel clear table method. |
vlua.compare | int vlua.compare(float a, float b)
|
Implements Squirrel three way compare operator ( <=> ). |
vlua.contains | bool vlua.contains(table t, variable key)
|
Implements Squirrel in operator. |
vlua.delete | int vlua.delete(table t, variable key)
|
Implements Squirrel slot delete operator. |
vlua.clone | int vlua.clone(table t)
|
Implements Squirrel clone operator. |
vlua.rawdelete | int vlua.rawdelete(table t, variable key)
|
Implements Squirrel rawdelete library function. |
vlua.rawin | int vlua.rawin(table t, variable key)
|
Implements Squirrel rawin library function. |
vlua.find | variable vlua.find([table/string] o, variable value, [int startIndex])
|
Implements Squirrel find method for tables and strings. (o, substr, [startidx]) for strings, (o, value) for tables |
vlua.slice | variable vlua.slice([table/string] o, int startIndex, [int endIndex])
|
Implements Squirrel slice method for tables and strings. |
vlua.reverse | table vlua.reverse(table o)
|
Implements Squirrel reverse method for tables. |
vlua.resize | table vlua.resize(string o, int size, [variable fill])
|
Implements Squirrel resize method for tables. |
vlua.extend | table vlua.extend(table o, array array)
|
Implements Squirrel extend method for tables. |
vlua.map | table vlua.map(table o, function mapFunc)
|
Implements Squirrel map method for tables. |
vlua.reduce | table vlua.reduce(table o, function reduceFunc)
|
Implements Squirrel reduce method for tables. |
vlua.tableadd | table vlua.tableadd (table t1, table t2)
|
Implements tableadd function to support += paradigm used in Squirrel. |
vlua.split | table vlua.split(string input, string separator)
|
Implements Squirrel split function for strings. |
vlua.select | variable vlua.select(bool conditional, variable valueIfTrue, variable valueIfFalse)
|
Safe Ternary operator. The Lua version will return the wrong value if the value if true is nil. |
Classes
CBaseEntity
The base class for entities.
Methods
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 Angular Velocity Impulse. |
Attribute_GetFloatValue | float Attribute_GetFloatValue(string pName, float flDefault)
|
Get float value for an entity attribute. |
Attribute_GetIntValue | float 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)
|
|
EmitSoundParams | void EmitSoundParams(string soundName, int pitch, float volume, float soundTime)
|
Plays/modifies a sound from this entity. changes sound if Pitch and/or Volume or SoundTime 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 hEntity, bool bBoneMerge)
|
|
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.
Todo: How to access non-uniform 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. Only functional on prop_dynamic entities with the Scripted Movement property set. |
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 | table GetChildren()
|
Obtain sub entities of this entity |
GetContext | table GetContext(string name)
|
Looks up a context and returns it if available. May return string, float, or nil (if the context isn't found) |
GetForwardVector | Vector GetForwardVector()
|
Get the forward Vector of the entity |
GetHealth | int GetHealth()
|
No Description Set |
GetLocalAngularVelocity | QAngle GetLocalAngularVelocity()
|
Get entity relative angular velocity. Only functional on prop_dynamic entities with the Scripted Movement property set. |
GetLocalAngles | QAngle GetLocalAngles()
|
Get entity pitch, yaw, roll as a QAngle, in the space of the entity's parent or attachment point |
GetLocalOrigin | Vector GetLocalOrigin()
|
Get entity origin as a Vector, in the space of the entity's parent or attachment point. |
GetLocalScale | float GetLocalScale()
|
Get the entity scale relative to that of its parent. |
GetLocalVelocity | Vector GetLocalVelocity()
|
Get Entity relative velocity. Only functional on prop_dynamic entities with the Scripted Movement property set. |
GetMass | float GetMass()
|
Get the mass of an entity. (returns 0 if it doesn't have a physics object) |
GetMaxHealth | int GetMaxHealth()
|
No Description Set |
GetModelName | string GetModelName()
|
Returns the name of the model. |
GetMoveParent | handle GetMoveParent()
|
If in hierarchy, retrieves the entity's parent |
GetOrigin | Vector GetOrigin()
|
Returns the origin of the entity, either in world space ot in its parents space if parented. |
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 |
GetRootMoveParent | handle GetRootMoveParent()
|
If in hierarchy, walks up the hierarchy to find the root parent |
GetSoundDuration | float GetSoundDuration(string soundName, string actormodelname)
|
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()
|
No Description Set |
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. Only functional on prop_dynamic entities with the Scripted Movement property set. |
HasAttribute | bool HasAttribute(string pName)
|
See if an entity has a particular attribute. |
IsAlive | bool IsAlive()
|
Is the entity alive |
IsNPC | bool IsNPC()
|
Is this entity an CAI_BaseNPC? |
IsNull | bool IsNull()
|
Returns the invalidity of the entity. Opposite of IsValidEntity()
|
IsPlayer | bool IsPlayer()
|
Is the entity a player |
Kill | void Kill()
|
Deletes the entity (UTIL_Remove() )
|
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 world space pitch, yaw, roll by component. |
SetAbsOrigin | void SetAbsOrigin(Vector origin)
|
Sets the world space entity origin. |
SetAbsScale | void SetAbsScale(float scale)
|
Set the absolute scale of the entity. |
SetAngles | void SetAngles(float pitch, float yaw, float roll)
|
Set entity pitch, yaw, roll by component. If parented, this is set relative to the parents local space. |
SetAngularVelocity | void SetAngularVelocity(float pitch, float yaw, float roll)
|
Set the local angular velocity - takes float pitch, yaw, roll velocities. Only functional on prop_dynamic entities with the Scripted Movement property set. |
SetConstraint | void SetConstraint(Vector vPos)
|
Set the position of the constraint. |
SetContext | void SetContext(string pName, string pValue, float duration)
|
SetContext( name , value, 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)
|
SetContext( name , value, 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 name)
|
Set entity targetname |
SetForwardVector | void SetForwardVector(Vector forwardVec)
|
Set the orientation of the entity to have this forward forwardVec |
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 hp)
|
Set entity health |
SetLocalAngles | void SetLocalAngles(float pitch, float yaw, float roll)
|
Set the entity pitch, yaw, roll by component, relative to the local space of the entity's parent or attachment point. |
SetLocalOrigin | void SetLocalOrigin(Vector origin)
|
Set entity local origin. Relative to the local space of the entity's parent or attachment point. |
SetLocalScale | void SetLocalScale(float scale)
|
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 maxHP)
|
Set entity max health |
SetOrigin | void SetOrigin(Vector origin)
|
Set entity absolute origin |
SetOwner | void SetOwner(handle owningEntity)
|
Sets this entity's owner. |
SetParent | void SetParent(handle hParent, string pAttachmentname)
|
Set the parent for this entity. The attachment is optional, pass an empty string to not use it. |
SetTeam | void SetTeam(int team)
|
Set entity team |
SetThink | void SetThink(function thinkFunction, string thinkName, float initialDelay)
|
Sets a thinker function to be called periodically. |
SetVelocity | void SetVelocity(Vector vecVelocity)
|
Sets the world space velocity of the entity. Only functional on prop_dynamic entities with the Scripted Movement property set. |
StopSound | void StopSound(string soundName)
|
Stops the named sound playing from this entity. |
StopThink | void StopThink (string thinkName)
|
Stops the named thinker function. |
TakeDamage | int TakeDamage(damageinfo 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.
Todo: May not respect entity scale
|
TransformPointWorldToEntity | Vector TransformPointWorldToEntity(Vector vPoint)
|
Returns the input Vector transformed from world to entity space.
Todo: May not respect entity scale
|
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. |
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 as documented here.
|
OnBreak | void OnBreak(CBaseEntity inflictor)
|
Called when a breakable entity is broken. Todo: Find out what entity classes this works for?
|
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 | unknown 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} Todo: Check which entity classes can take damage. Prop_physics and prop_dynamic confirmed, but the function doesn't get called in every case.
|
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. |
CEntityInstance
- extends CBaseEntity
All entities inherit from this.
Methods
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.
Bug: This doesn't appear to work in Half-Life: Alyx scripts. Use RedirectOutput with thisEntity as the third parameter instead. [todo tested in?] |
Destroy | void Destroy()
|
Deletes the entity (UTIL_Remove() )
|
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, CBaseEntity entity)
|
Removes a connected script function from an I/O event on the passed entity. |
entindex | int entindex()
|
No Description Set |
FireOutput | void FireOutput(string outputName, handle activator, handle caller, table args, float delay)
|
Fire an entity output |
GetClassname | string GetClassname()
|
No Description Set |
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()
|
No Description Set |
GetIntAttr | int GetIntAttr(string key)
|
Get Integer Attribute |
GetName | string GetName()
|
No Description Set |
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, CBaseEntity entity)
|
Adds an I/O connection that will call the named function on the passed entity when the specified output fires. |
RemoveSelf | void RemoveSelf()
|
Deletes the entity (UTIL_Remove() )
|
SetIntAttr | void SetIntAttr(string key, int value)
|
Set Integer Attribute |
CBaseModelEntity
- extends CBaseEntity
Entities with models inherit from this.
Methods
Function | Signature | Description |
---|---|---|
GetMaterialGroupHash | unsigned GetMaterialGroupHash()
|
Get the material group hash of this entity. |
GetMaterialGroupMask | <unknown> GetMaterialGroupMask()
|
Get the mesh group mask of this entity. |
GetRenderAlpha | int GetRenderAlpha()
|
Get the alpha modulation of this entity. |
GetRenderColor | Vector GetRenderColor()
|
Get the render color of the entity. |
SetBodygroup | void SetBodygroup(int iGroup, int iValue)
|
Sets a bodygroup by index. |
SetBodygroupByName | void SetBodygroupByName(int iGroup, 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(uint32 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. |
SetRenderAlpha | void SetRenderAlpha(int nAlpha)
|
Set the alpha modulation of this entity. |
SetRenderColor | void SetRenderColor(int red, int green, int blue)
|
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 (int). |
CBasePlayer
Entity class for players.
Methods
Function | Signature | Description |
---|---|---|
AreChaperoneBoundsVisible | bool AreChaperoneBoundsVisible()
|
Returns whether this player's chaperone bounds are visible. |
GetAnalogActionPositionForHand | Vector GetAnalogActionPositionForHand(int nLiteralHandType, int nAnalogAction)
|
Returns the value of the analog action for the given hand. See Analog Input Actions for action index values and return types. Note: Only reports input when headset is awake. Will still transmit input when controllers lose tracking.
|
GetHMDAnchor | handle GetHMDAnchor()
|
Returns the HMD anchor entity for this player if it exists. |
GetHMDAvatar | CPropHMDAvatar GetHMDAvatar()
|
Returns the HMD Avatar entity for this player if it exists. |
GetPlayArea | Vector GetPlayArea(int nPoint)
|
Returns the Vector position of the point you ask for. Pass 0-3 to get the four points. |
GetUserID | int GetUserID()
|
Returns the player's user ID. |
GetVRControllerType | int GetVRControllerType()
|
Returns the type of controller being used while in VR. See list at the bottom of the page for controller types. |
IsDigitalActionOnForHand | bool IsDigitalActionOnForHand(int nLiteralHandType, int nDigitalAction)
|
Returns true if the digital action is on for the given hand. See Digital Input Actions for action index values. Note: Only reports input when headset is awake. Will still transmit input when controllers lose tracking.
|
IsNoclipping | bool IsNoclipping()
|
Returns true if the player is in noclip mode. |
IsUsePressed | bool IsUsePressed()
|
Returns true if the use key is pressed. |
IsVRControllerButtonPressed | bool IsVRControllerButtonPressed(int nButton)
|
Returns true if the controller button is pressed. Bug:Non-functional for motion controller buttons in Half-Life: Alyx. Works with key bindings when VR is turned off. [todo tested in?] |
IsVRDashboardShowing | bool IsVRDashboardShowing()
|
Returns true if the SteamVR dashboard is showing for this player. |
CHL2_Player
Half-life player subclass.
Methods
Function | Signature | Description |
---|---|---|
PlayerCounter_CanModifyValue | bool PlayerCounter_CanModifyValue(string name, int delta)
|
|
PlayerCounter_SetMax | int PlayerCounter_SetMax(string name, int max)
|
|
PlayerCounter_ModifyValue | int PlayerCounter_ModifyValue(string name, int delta)
|
|
PlayerCounter_SetMin | int PlayerCounter_SetMin(string name, int min)
|
|
PlayerCounter_SetMinMax | int PlayerCounter_SetMinMax(string name, int min, int max)
|
|
PlayerCounter_SetValue | int PlayerCounter_SetValue(string name, int value)
|
|
PlayerCounter_GetValue | int PlayerCounter_GetValue(string name)
|
CBaseAnimating
- extends CBaseEntity
A class containing methods involved in animations. Most model based entities inherit this.
Methods
Function | Signature | Description |
---|---|---|
ActiveSequenceDuration | float ActiveSequenceDuration()
|
Returns the duration in seconds of the active sequence. |
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 |
GetCycle | float GetCycle()
|
Get the cycle of the animation. |
GetGraphParameter | table GetGraphParameter(string pszParam)
|
Get the value of the given animGraph parameter. |
GetModelScale | float GetModelScale()
|
Get scale of entity's model. |
GetSequence | string GetSequence()
|
Returns the name of the active sequence. |
IsSequenceFinished | bool IsSequenceFinished()
|
Ask whether the main sequence is done playing |
RegisterAnimTagListener | void RegisterAnimTagListener(handle hAnimTagListenerFunc)
|
Registers a listener for string AnimTags, replaces existing script listener if any. |
ResetSequence | void ResetSequence(string pSequenceName)
|
Sets the active sequence by name, resetting the current cycle |
ScriptLookupAttachment | int ScriptLookupAttachment(string pAttachmentName)
|
Get the named attachment id |
SequenceDuration | float SequenceDuration(string pSequenceName)
|
Returns the duration in seconds of the given sequence name. |
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 boolean parameter 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 parameter. |
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. |
SetModelScale | void SetModelScale(float scale)
|
Sets the model's scale to scale, so if a unit had its model scale at 1, and you use SetModelScale(10.0), it would set the scale to 10.0. |
SetPoseParameter | float SetPoseParameter(string szName, float fValue)
|
Set the specified pose parameter to the specified value. |
SetSequence | void SetSequence(string pSequenceName)
|
Sets the active sequence by name, keeping the current cycle. |
StopAnimation | void StopAnimation()
|
Stop the current animation by setting playback rate to 0.0. |
UnregisterAnimTagListener | void UnregisterAnimTagListener(table hScript)
|
Unregisters the current string AnimTag listener, if any |
CBaseFlex
- extends CBaseAnimating
Animated entities that have vertex flex capability.
Methods
Function | Signature | Description |
---|---|---|
FindFlexController | int FindFlexController(string pszFlexControllerName)
|
Finds a flex controller by name, returns the index, -1 if not found |
GetCurrentScene | handle GetCurrentScene()
|
Returns the instance of the oldest active scene entity (if any). |
GetFlexWeight | float GetFlexWeight(int nFlexControllerIndex)
|
Gets the weight of a flex controller specified by index, use FindFlexController to get the index of a flex controller by name. |
GetSceneByIndex | handle GetSceneByIndex(int index)
|
Returns the instance of the scene entity at the specified index. |
ScriptPlayScene | float ScriptPlayScene(string pszSceneFile, float flDelay)
|
Play the specified .vcd file. |
SetFlexWeight | void SetFlexWeight(int nFlexControllerIndex, float flWeight)
|
Sets the weight of a flex controller specified by index, use FindFlexController to get the index of a flex controller by name. |
CBaseCombatCharacter
No Description Set
Methods
Function | Signature | Description |
---|---|---|
GetEquippedWeapons | table GetEquippedWeapons()
|
Returns an array of all the equipped weapons |
GetFaction | int GetFaction()
|
Get the combat character faction. |
GetWeaponCount | int GetWeaponCount()
|
Gets the number of weapons currently equipped |
ShootPosition | Vector ShootPosition(int nHand)
|
Returns the shoot position eyes (or hand in VR). |
CBodyComponent
No Description Set
Methods
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 Vector_1, Vector Vector_2)
|
Add linear and angular velocity to the physics object |
DetachFromParent | void DetachFromParent()
|
Detach from its parent |
GetSequence | <unknown> GetSequence()
|
Returns the active sequence |
IsAttachedToParent | bool IsAttachedToParent()
|
Is attached to parent |
LookupSequence | <unknown> LookupSequence(string string_1)
|
Returns a sequence id given a name |
SequenceDuration | float SequenceDuration(string string_1)
|
Returns the duration in seconds of the specified sequence |
SetAngularVelocity | void SetAngularVelocity(Vector Vector_1)
|
No Description Set |
SetAnimation | void SetAnimation(string string_1)
|
Pass string for the animation to play on this model |
SetBodyGroup | void SetBodyGroup(string string_1)
|
No Description Set |
SetMaterialGroup | void SetMaterialGroup(utlstringtoken utlstringtoken_1)
|
No Description Set |
SetVelocity | void SetVelocity(Vector velocity)
|
No Description Set |
CEntities
Provides methods to enumerate all server-side entities.
Global accessor variable: Entities
Methods
Function | Signature | Description |
---|---|---|
CreateByClassname | handle CreateByClassname(string className)
|
Creates an entity by class name. Warning:This does not initialize the created entity. Use the Spawn prefixed global functions instead.
|
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 maxRadius)
|
Find entities by class name within a radius. Returns an array containing all the found entities. |
FindAllByModel | table FindAllByModel(string modelName)
|
Find entities by model name. Returns an array containing all the found entities. |
FindAllByName | table FindAllByName(string name)
|
Find all entities by name. Returns an array containing all the found entities in it. |
FindAllByNameWithin | table FindAllByNameWithin(string name, Vector origin, float maxRadius)
|
Find all entities by name within a radius. Returns an array containing all the found entities. |
FindAllByTarget | table FindAllByTarget(string targetName)
|
Find all entities with this target set. Returns an array containing all the found entities. |
FindAllInSphere | table FindAllInSphere(Vector origin, float maxRadius)
|
Find all entities within a radius. Returns an array containing all the found entities. |
FindByClassname | handle FindByClassname(handle startFrom, string className)
|
Find entities by class name. Pass nil 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 maxRadius)
|
Find entities by class name within a radius. Pass nil 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 nil 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 maxRadius)
|
Find entities by model name within a radius. Pass nil to start an iteration, or reference to a previously found entity to continue a search |
FindByName | handle FindByName(handle lastEnt, string searchString)
|
Find entities by name. Pass nil to start an iteration, or reference to a previously found entity to continue a search |
FindByNameNearest | handle FindByNameNearest(string name, Vector origin, float maxRadius)
|
Find entities by name nearest to a point. |
FindByNameWithin | handle FindByNameWithin(handle startFrom, string name, Vector origin, float maxRadius)
|
Find entities by name within a radius. Pass nil 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 nil to start an iteration, or reference to a previously found entity to continue a search |
FindInSphere | handle FindInSphere(handle startFrom, Vector origin, float maxRadius)
|
Find entities within a radius. Pass nil 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 |
GetLocalPlayer | handle GetLocalPlayer()
|
Get the local player. |
Next | handle Next(handle startFrom)
|
Continue an iteration over the list of entities, providing reference to a previously found entity |
CAI_BaseNPC
No Description Set
Methods
Function | Signature | Description |
---|---|---|
GetSquad | handle GetSquad()
|
Get the squad to which this NPC belongs. |
NpcForceGoPosition | void NpcForceGoPosition(Vector vPos, bool bRun, float flSuccessTolerance)
|
Set a position goal and start moving. |
NpcNavClearGoal | void NpcNavClearGoal()
|
Removes the NPC's current goal. |
NpcNavGetGoalPosition | Vector NpcNavGetGoalPosition()
|
Get the position of the current goal. |
NpcNavGoalActive | bool NpcNavGoalActive()
|
Returns true if NPC has a goal and path |
CBaseTrigger
- extends CBaseEntity
Entity class for triggers.
Methods
Function | Signature | Description |
---|---|---|
Disable | void Disable()
|
Disable the trigger |
Enable | void Enable()
|
Enable the trigger |
IsTouching | bool IsTouching(handle hEnt)
|
Checks whether the passed entity is touching the trigger. |
CEnvTimeOfDay2
No Description Set
Methods
Function | Signature | Description |
---|---|---|
GetFloat | float GetFloat(utilstringtoken unknown, float unknown)
|
Lookup dynamic time-of-day float value. |
GetVector | Vector GetVector(utilstringtoken unknown, Vector unknown)
|
Lookup dynamic time-of-day vector value. |
CEnvEntityMaker
- extends CBaseEntity
Entity class for env_entity_maker.
Methods
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 |
CEntityScriptFramework
Interface to the C++-side of entity framework
Global accessor variable: EntityFramework
Methods
No methods available.
Hooks
Called on the entity framework script.
Function | Signature | Description |
---|---|---|
CreateEntity | void CreateEntity(string className, handle instance)
|
|
DispatchActivate | bool DispatchActivate(handle entity)
|
|
DispatchInput | bool DispatchInput(string inputName, table target,unknown args)
|
|
DispatchPrecache | void DispatchPrecache(handle entity, CScriptPrecacheContext context)
|
|
DispatchSpawn | void DispatchSpawn(handle entity, CScriptKeyValuesspawnkeys)
|
|
DispatchUpdateOnRemove | bool DispatchUpdateOnRemove(handle entity)
|
|
GetClassNameOverride | string GetClassNameOverride(string className)
|
|
GetDesignerNameForScriptClass | string GetDesignerNameForScriptClass(string className,handle instance)
|
|
GetInputsForScriptClass | table GetInputsForScriptClass(string scriptClassName)
|
|
GetNativeClassForScriptClass | string GetNativeClassForScriptClass(string scriptClassName)
|
|
GetNativeOutputsForClass | CNativeOutputs GetNativeOutputsForClass(string scriptClassName)
|
|
GetScriptClassForDesignerName | string GetScriptClassForDesignerName(string designerName)
|
|
InstallClasses | void InstallClasses()
|
CInfoWorldLayer
Entity class for info_world_layer.
Methods
Function | Signature | Description |
---|---|---|
HideWorldLayer | void HideWorldLayer()
|
Hides this layer. |
ShowWorldLayer | void ShowWorldLayer()
|
Shows this layer. |
CLogicRelay
Entity class for logic_relay.
Methods
Function | Signature | Description |
---|---|---|
Trigger | void Trigger(handle hActivator, handle hCaller)
|
Trigger(hActivator, hCaller) : Triggers the logic_relay |
CMarkupVolumeTagged
No Description Set
Methods
Function | Signature | Description |
---|---|---|
HasTag | bool HasTag(string pszTagName)
|
Does this volume have the given tag. |
CScriptPrecacheContext
Container to hold context published to precache functions in script
Methods
Function | Signature | Description |
---|---|---|
AddResource | void AddResource(string string_1)
|
Precaches a specific resource |
GetValue | variable GetValue(string key)
|
Reads a spawn key. |
CScriptKeyValues
Container holding keyvalues published to the Spawn() hook function.
Methods
Function | Signature | Description |
---|---|---|
GetValue | variable GetValue(string key)
|
Reads a spawn key. |
CNativeOutputs
Container for holding outputs published by scripted entity classes to the game code.
Methods
Function | Signature | Description |
---|---|---|
constructor | void CNativeOutputs()
|
Creates a new CNativeOutputs object. |
AddOutput | void AddOutput(string outputName, string description)
|
Add an output. |
Init | void Init(int numOutputs)
|
Initialize with specified number of outputs. |
CEnvProjectedTexture
- extends CBaseEntity
Entity class for env_projected_texture.
Methods
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 |
CInfoData
No Description Set
Methods
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 |
CPhysicsProp
Entity class for prop_physics and related classes.
Methods
Function | Signature | Description |
---|---|---|
SetDynamicVsDynamicContinuous | void SetDynamicVsDynamicContinuous(bool bIsDynamicVsDynamicContinuousEnabled)
|
Enable/disable dynamic vs dynamic continuous collision traces. |
DisableMotion | void DisableMotion()
|
Enable motion for the prop. |
EnableMotion | void EnableMotion()
|
Enable motion for the prop. |
CDebugOverlayScriptHelper
No Description Set
Methods
Global accessor variable: debugoverlay
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 endpoint's 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 endpoint's 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 point's |
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 point's 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 endpoint's 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 point1, Vector point2, Vector point3, int red, int green, int blue, int alpha, bool disableDepthCheck, float seconds)
|
Draws a filled triangle in world space for the specific amount of seconds (-1 means forever). |
UnitTestCycleOverlayRenderType | void UnitTestCycleOverlayRenderType()
|
Toggles the overlay render type, for unit tests |
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 endpoint's 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 endpoint's in world space. |
CSceneEntity
- extends CBaseEntity
Choreographed scene which controls animation and/or dialog on one or more actors.
Methods
Function | Signature | Description |
---|---|---|
AddBroadcastTeamTarget | void AddBroadcastTeamTarget(int int_1)
|
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 string_1)
|
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 string_1, string string_2)
|
given a dummy scene name and a vcd string, load the scene |
RemoveBroadcastTeamTarget | void RemoveBroadcastTeamTarget(int int_1)
|
Removes a team (by index) from the broadcast list |
Start | void Start(handle handle_1)
|
Start scene playback, takes activatorEntity as param |
CCustomGameEventManager
No Description Set
Methods
Global accessor variable: CustomGameEventManager
Function | Signature | Description |
---|---|---|
RegisterListener | int RegisterListener(string string_1, handle handle_2)
|
( string EventName, func 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 string_1, handle handle_2)
|
( string EventName, table EventData ) |
Send_ServerToPlayer | void Send_ServerToPlayer(handle handle_1, string string_2, handle handle_3)
|
( Entity Player, string EventName, table EventData ) |
Send_ServerToTeam | void Send_ServerToTeam(int int_1, string string_2, handle handle_3)
|
( int TeamNumber, string EventName, table EventData ) |
UnregisterListener | void UnregisterListener(int int_1)
|
( int ListnerID ) - Unregister a specific listener |
CParticleSystem
CPointClientUIWorldPanel
Entity class for point_clientui_world_panel
A 2D Panorama panel projected at a set position in the world.
Methods
Function | Signature | Description |
---|---|---|
AcceptUserInput | void AcceptUserInput()
|
Tells the panel to accept user input. |
AddCSSClasses | void AddCSSClasses(string classes)
|
Adds CSS class(es) to the panel. |
IgnoreUserInput | void IgnoreUserInput()
|
Tells the panel to ignore user input. |
IsGrabbable | void IsGrabbable()
|
Returns whether this entity is grabbable. |
RemoveCSSClasses | void RemoveCSSClasses(string classes)
|
Remove CSS class(es) from the panel. |
CPointTemplate
Entity class for point_template
Methods
Function | Signature | Description |
---|---|---|
DeleteCreatedSpawnGroups | void DeleteCreatedSpawnGroups()
|
DeleteCreatedSpawnGroups() : Deletes any spawn groups that this point_template has spawned. Note: The point_template will not be deleted by this. |
ForceSpawn | void ForceSpawn()
|
ForceSpawn() : Spawns all of the entities the point_template is pointing at. |
GetSpawnedEntities | handle GetSpawnedEntities()
|
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
Entity class for point_worldtext.
Methods
Function | Signature | Description |
---|---|---|
SetMessage | void SetMessage(string pMessage)
|
Set the message on this entity. |
CPropHMDAvatar
Entity class for prop_hmd_avatar.
Methods
Function | Signature | Description |
---|---|---|
GetVRHand | CPropVRHand GetVRHand(int nHandID)
|
Get VR hand by ID (0 and 1). |
CPropVRHand
Entity class for prop_vr_hand. Represents a VR motion controller. The controllers can be enumerated for each player using the CPropHMDAvatar::GetVRHand() method.
Methods
Function | Signature | Description |
---|---|---|
AddHandAttachment | void AddHandAttachment(handle attachment)
|
Add the attachment to this hand. |
AddHandModelOverride | void AddHandModelOverride(string modelName)
|
Add a model override for this hand. |
FindHandModelOverride | handle FindHandModelOverride(string pModelName)
|
Find a specific model override for this hand. |
FireHapticPulse | void FireHapticPulse(int strength)
|
Fire a haptic pulse on this hand. Integer range [0, 1, 2] for strength. |
FireHapticPulsePrecise | void FireHapticPulsePrecise(int nPulseDuration)
|
Fire a haptic pulse on this hand. Specify the duration in micro seconds. |
GetHandAttachment | handle GetHandAttachment()
|
Get the attachment on this hand. |
GetHandID | int GetHandID()
|
Get the players hand ID for this hand. |
GetLiteralHandType | int GetLiteralHandType()
|
Get literal type for this hand. |
GetPlayer | CBasePlayer GetPlayer()
|
Get the player for this hand. |
GetVelocity | Vector GetVelocity()
|
Get the filtered controller velocity. |
RemoveAllHandModelOverrides | void RemoveAllHandModelOverrides()
|
Remove all model overrides for this hand. |
RemoveHandAttachmentByHandle | void RemoveHandAttachmentByHandle(handle hAttachment)
|
Remove hand attachment by handle. |
RemoveHandModelOverride | void RemoveHandModelOverride(string pModelName)
|
Remove a model override for this hand. |
SetHandAttachment | void SetHandAttachment(handle hAttachment)
|
Set the attachment for this hand. |
CScriptParticleManager
Allows the creation and manipulation of particle systems.
Global accessor variable: ParticleManager
Function | Signature | Description |
---|---|---|
CreateParticle | int CreateParticle(string particleName, int particleAttach, handle owningEntity)
|
Creates a new particle effect. Returns the index of the created effect. |
CreateParticleForPlayer | int CreateParticleForPlayer(string particleName, int particleAttach, handle owningEntity, handle owningPlayer)
|
Creates a new particle effect that only plays for the specified player. Returns the index of the created effect. |
DestroyParticle | void DestroyParticle(int particleID, bool immediately)
|
Destroys particle. |
GetParticleReplacement | string GetParticleReplacement(string string_1, handle handle_2)
|
No Description Set |
ReleaseParticleIndex | void ReleaseParticleIndex(int particleId)
|
Frees the specified particle index |
SetParticleAlwaysSimulate | void SetParticleAlwaysSimulate(int int_1)
|
No Description Set |
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 unknown)
|
Attaches the control point to an entity. |
SetParticleControlForward | void SetParticleControlForward(int FXIndex, int controlIndex, Vector forward)
|
Set the forward direction for a control point on a particle effect. |
SetParticleControlOffset | void SetParticleControlOffset(int iIndex, int iPoint, Vector vecOffset)
|
Set the linear offset for a control on a particle effect. |
SetParticleControlOrientation | void SetParticleControlOrientation(int FXIndex, int controlIndex, Vector forward, Vector right, Vector up)
|
Set the orientation for a control point on a particle effect. Note:This is left handed -- bad!!
|
SetParticleControlOrientationFLU | void SetParticleControlOrientationFLU(int FXIndex, int controlIndex, Vector forward, Vector left, Vector up)
|
Set the orientation for a control point on a particle effect. |
SteamInfo
Methods
Function | Signature | Description |
---|---|---|
IsPublicUniverse | bool IsPublicUniverse()
|
Is the script connected to the public Steam universe. |
CTakeDamageInfo
DamageInfo handle returned by CreateDamageInfo()
Methods
Function | Signature | Description |
---|---|---|
AddDamage | void AddDamage(float addAmount)
|
Adds to the damage value. |
AddDamageType | void AddDamageType(int bitsDamageType)
|
Adds damage type bit flags. |
AllowFriendlyFire | bool AllowFriendlyFire()
|
|
BaseDamageIsValid | bool BaseDamageIsValid()
|
|
CanBeBlocked | bool CanBeBlocked()
|
|
GetAmmoType | int GetAmmoType()
|
|
GetAttacker | CBaseEntity GetAttacker()
|
Returns the attacker entity. |
GetBaseDamage | float GetBaseDamage()
|
|
GetDamage | float GetDamage()
|
Returns the damage value. |
GetDamageCustom | int GetDamageCustom()
|
|
GetDamageForce | Vector GetDamageForce()
|
Returns the damage force. |
GetDamagePosition | int GetDamagePosition()
|
Returns the damage position. |
GetDamageTaken | float GetDamageTaken()
|
|
GetDamageType | int GetDamageType()
|
Returns the damage type bitfield. |
GetInflictor | CBaseEntity GetInflictor()
|
Returns the inflictor entity (usually the weapon). |
GetMaxDamage | float GetMaxDamage()
|
|
GetOriginalDamage | float GetOriginalDamage()
|
|
GetRadius | float GetRadius()
|
|
GetReportedPosition | Vector GetReportedPosition()
|
|
GetStabilityDamage | float GetStabilityDamage()
|
|
HasDamageType | bool HasDamageType(int bitsToTest)
|
|
ScaleDamage | void ScaleDamage(float scaleAmount)
|
|
SetAllowFriendlyFire | void SetAllowFriendlyFire(bool allow)
|
|
SetAmmoType | void SetAmmoType(intammoType)
|
|
SetAttacker | void SetAttacker(CBaseEntity attacker)
|
|
SetCanBeBlocked | void SetCanBeBlocked(bool block)
|
|
SetDamage | void SetDamage(float damage)
|
Set new damage value. |
SetDamageCustom | void SetDamageCustom(int damageCustom)
|
|
SetDamageForce | void SetDamageForce(Vector damageForce)
|
Sets the damage force vector. |
SetDamagePosition | void SetDamagePosition(Vector damagePosition)
|
Sets the global space damage position. |
SetDamageTaken | void SetDamageTaken(int damageTaken)
|
|
SetDamageType | void SetDamageType(int bitsDamageType)
|
Set the damage type bitfield. |
SetMaxDamage | void SetMaxDamage(float maxDamage)
|
|
SetOriginalDamage | void SetOriginalDamage(float originalDamage)
|
|
SetRadius | void SetRadius(float radius)
|
|
SetReportedPosition | void SetReportedPosition(Vector reportedPosition)
|
|
SetStabilityDamage | void SetStabilityDamage(float stabilityDamage)
|
Convars
Allows access to read and modify console variables.
Global accessor variable: Convars
Methods
Function | Signature | Description |
---|---|---|
GetBool | table GetBool(string variableName)
|
GetBool(name) : returns the convar as a boolean flag. |
GetCommandClient | handle GetCommandClient()
|
GetCommandClient() : returns the player who issued this console command. |
GetFloat | table GetFloat(string name)
|
GetFloat(name) : returns the convar as a float. May return nil if no such convar. |
GetInt | table GetInt(string string_1)
|
GetInt(name) : returns the convar as an int. May return nil if no such convar. |
GetStr | table GetStr(string variableName)
|
GetStr(name) : returns the convar as a string. May return nil if no such convar. |
RegisterCommand | void RegisterCommand(string variableName, handle function, string helpText, int flags)
|
RegisterCommand(name, fn, helpString, flags) : register a console command. |
RegisterConvar | void RegisterConvar(string name, string defaultValue, string helpText, int flags)
|
RegisterConvar(name, defaultValue, helpString, flags): register a new console variable. |
SetBool | void SetBool(string variableName, bool value)
|
SetBool(name, val) : sets the value of the convar to the bool. |
SetFloat | void SetFloat(string variableName, float value)
|
SetFloat(name, val) : sets the value of the convar to the float. |
SetInt | void SetInt(string string_1, int int_2)
|
SetInt(name, val) : sets the value of the convar to the int. |
SetStr | void SetStr(string string_1, string string_2)
|
SetStr(name, val) : sets the value of the convar to the string. |
Decider
No Description Set
Methods
Function | Signature | Description |
---|---|---|
AddRule | bool AddRule(CRule rule)
|
Add a CRule object (defined in rulescript_base.nut) |
FindAllMatches | handle FindAllMatches(handle query, float leeway)
|
Returns an array of all matching responses. If leeway is nonzero, all results scoring within 'leeway' of the best score return. |
FindBestMatch | handle FindBestMatch(handle query)
|
Query the database and return the best result found. If multiple of equal score found, an arbitrary one returns. |
GlobalSys
Used to read the command line parameters the game was started with.
Global accessor variable: GlobalSys
Methods
Function | Signature | Description |
---|---|---|
CommandLineCheck | bool CommandLineCheck(string name)
|
Returns true if the command line param was used, otherwise false. |
CommandLineFloat | float CommandLineFloat(string name)
|
Returns the command line param as a float. |
CommandLineInt | int CommandLineInt(string name)
|
Returns the command line param as an int. |
CommandLineStr | string CommandLineStr(string name)
|
Returns the command line param as a string. |
Uint64
Integer with binary operations. Used for motion controller button masks.
Methods
Function | Signature | Description |
---|---|---|
BitwiseAnd | int BitwiseAnd(Uint64 operand)
|
Performs bitwise AND between two integers. |
BitwiseOr | int BitwiseOr(Uint64 operand)
|
Performs bitwise OR between two integers. |
BitwiseXor | int BitwiseXor(Uint64 operand)
|
Performs bitwise XOR between two integers. |
BitwiseNot | int BitwiseNot(Uint64 operand)
|
Performs bitwise NOT between two integers. |
ClearBit | int ClearBit(int bitvalue)
|
Clears the specified bit. |
IsBitSet | bool IsBitSet(int bitvalue)
|
Checks if a bit is set. |
SetBit | int SetBit(int bitvalue)
|
Sets the specified bit. |
ToggleBit | int ToggleBit(int bitvalue)
|
Toggles the specified bit. |
ToHexString | string ToHexString()
|
Returns a hexadecimal string representation of the integer. |
QAngle
Class for angles.
Methods
Function | Signature | Description |
---|---|---|
constructor | QAngle(float pitch, float yaw, float roll)
|
Creates a new QAngle. |
__add | QAngle __add(QAngle a, QAngle b)
|
Overloaded +. Adds angles together. Note:Use RotateOrientation() instead to properly rotate angles.
|
__eq | bool __eq(QAngle a, QAngle b)
|
Overloaded ==. Tests for Equality |
__tostring | string __tostring()
|
Overloaded .. Converts the QAngle to a human readable string. |
Forward | Vector Forward()
|
Returns the forward vector. |
Left | Vector Left()
|
Returns the left vector. |
Up | Vector Up()
|
Returns the up vector. |
Members
Variable | Description |
---|---|
x
|
Pitch angle |
y
|
Yaw angle |
z
|
Roll angle |
Quarternion
Class for quaterinions.
Global accessor variable: None available
Vector
3D vector class.
Methods
Function | Signature | Description |
---|---|---|
constructor | Vector(float x, float y, float z)
|
Creates a new vector with the specified Cartesian coordinates. |
__add | Vector __add(Vector a, Vector b)
|
Overloaded +. Adds vectors together. |
__div | Vector __div(Vector a, Vector b)
|
Overloaded /. Divides vectors. |
__eq | bool __eq(Vector a, Vector b)
|
Overloaded ==. Tests for Equality. |
__len | float __len()
|
Overloaded # returns the length of the vector. |
__mul | Vector __mul(Vector a, Vector b)
|
Overloaded * returns the vectors multiplied together. can also be used to multiply with scalars. |
__sub | Vector __sub(Vector a, Vector b)
|
Overloaded -. Subtracts vectors |
__tostring | string __tostring()
|
Overloaded .. Converts vectors to strings |
__unm | Vector __unm()
|
Overloaded unary - operator. Reverses the vector. |
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 t)
|
Linear interpolation between the vector and the passed in target over t = [0,1]. |
Normalized | Vector Normalized()
|
Returns the vector normalized. |
Members
Variable | Description |
---|---|
x
|
X-axis |
y
|
Y-axis |
z
|
Z-axis |
Enumerations
Analog Input Actions
Actions for CBasePlayer:GetAnalogActionPositionForHand
. These map to the actions in the SteamVR binding menu.
Name | Value | Category | Action | Description |
---|---|---|---|---|
0 | Hand | Hand Curl | X Axis | |
1 | Hand | Trigger Pull | X Axis | |
2 | Interact | Squeeze Xen Grenade | X Axis | |
3 | Move | Teleport Turn | Required
X, Y Axis Todo: Do these always give both thumbstick axes?
| |
4 | Move | Continuous Turn | X, Y Axis
Todo: Do these always give both thumbstick axes?
|
Controller types
Player VR controller types returned by CBasePlayer::GetVRControllerType()
Name | Value | Description |
---|---|---|
(VR_CONTROLLER_TYPE_UNKNOWN) | 0 | |
(VR_CONTROLLER_TYPE_X360) | 1 | |
(VR_CONTROLLER_TYPE_VIVE) | 2 | |
(VR_CONTROLLER_TYPE_TOUCH) | 3 | |
(VR_CONTROLLER_TYPE_RIFT_S) | 4 | |
5 | Todo: Unknown, no enum available.
| |
(VR_CONTROLLER_TYPE_KNUCKLES) | 6 | |
(VR_CONTROLLER_TYPE_WINDOWSMR) | 7 | |
(VR_CONTROLLER_TYPE_WINDOWSMR_SAMSUNG) | 8 | |
(VR_CONTROLLER_TYPE_GENERIC_TRACKED) | 9 | |
(VR_CONTROLLER_TYPE_COSMOS) | 10 |
Digital Input Actions
Actions for CBasePlayer:IsDigitalActionOnForHand
. These map to the actions in the SteamVR binding menu.
Name | Value | Category | Action | Description |
---|---|---|---|---|
0 | Menu | Toggle Menu | Required | |
1 | Menu | Menu Interact | Required | |
2 | Menu | Menu Dismiss | Required | |
3 | Interact | Use | Required | |
4 | Interact | Use Grip | ||
5 | Weapon | Show inventory | Required | |
6 | Interact | Grav Glove Lock | Required | |
7 | Weapon | Fire | Required | |
8 | Weapon | Alt Fire | ||
9 | Weapon | Reload | Required | |
10 | Weapon | Eject Magazine | Required | |
11 | Weapon | Slide Release | Required | |
12 | Weapon | Open Chamber | Required | |
13 | Weapon | Toggle Laser Sight | ||
14 | Weapon | Toggle Burst Fire | Required | |
15 | Interact | Toggle Health Pen | Required | |
16 | Interact | Arm Grenade | Required | |
17 | Interact | Arm Xen Grenade | Required | |
18 | Move | Teleport | Required | |
19 | Move | Turn Left | ||
20 | Move | Turn Right | ||
21 | Move | Move Back | ||
22 | Move | Walk | ||
23 | Move | Jump | ||
24 | Move | Mantle | ||
25 | Move | Crouch Toggle | ||
26 | Move | Stand toggle | ||
27 | Move | Adjust Height |
Activation types
Passed to the Activate()
hook function.
Name | Value | Description |
---|---|---|
ACTIVATE_TYPE_INITIAL_CREATION | 0 | When the function is called after entity creation. |
ACTIVATE_TYPE_DATAUPDATE_CREATION | 1 | [Todo] |
ACTIVATE_TYPE_ONRESTORE | 2 | When the function is called after the entity has been restored from a saved game. |
Damage types
Name | Value | Description |
---|---|---|
DMG_GENERIC | 0 | |
DMG_CRUSH | 1 | |
DMG_BULLET | 2 | |
DMG_SLASH | 4 | |
DMG_BURN | 8 | |
DMG_VEHICLE | 16 | |
DMG_FALL | 32 | |
DMG_BLAST | 64 | |
DMG_CLUB | 128 | |
DMG_SHOCK | 256 | |
DMG_SONIC | 512 | |
DMG_ENERGYBEAM | 1024 | |
DMG_PREVENT_PHYSICS_FORCE | 2048 | |
DMG_NEVERGIB | 4096 | |
DMG_ALWAYSGIB | 8192 | |
DMG_DROWN | 16384 | |
DMG_PARALYZE | 32768 | |
DMG_NERVEGAS | 65536 | |
DMG_POISON | 131072 | |
DMG_RADIATION | 262144 | |
DMG_DROWNRECOVER | 524288 | |
DMG_ACID | 1048576 | |
DMG_SLOWBURN | 2097152 | |
DMG_REMOVENORAGDOLL | 4194304 | |
DMG_PHYSGUN | 8388608 | |
DMG_PLASMA | 16777216 | |
DMG_AIRBOAT | 33554432 | |
DMG_DISSOLVE | 67108864 | |
DMG_BLAST_SURFACE | 134217728 | |
DMG_DIRECT | 268435456 | |
DMG_BUCKSHOT | 536870912 | Shotgun damage. Gibs headcrabs. |
ParticleAttachment_t
Name | Value | Description |
---|---|---|
PATTACH_INVALID | -1 | |
PATTACH_ABSORIGIN | 0 | Spawn on entity origin. |
PATTACH_ABSORIGIN_FOLLOW | 1 | Follow the entity origin. |
PATTACH_CUSTOMORIGIN | 2 | |
PATTACH_CUSTOMORIGIN_FOLLOW | 3 | |
PATTACH_POINT | 4 | Spawn on entity attachment point. |
PATTACH_POINT_FOLLOW | 5 | Follow entity attachment point. |
PATTACH_EYES_FOLLOW | 6 | |
PATTACH_OVERHEAD_FOLLOW | 7 | |
PATTACH_WORLDORIGIN | 8 | Spawn on map origin. |
PATTACH_ROOTBONE_FOLLOW | 9 | |
PATTACH_RENDERORIGIN_FOLLOW | 10 | |
(PATTACH_MAIN_VIEW) | 11 | Enumeration missing from environment. |
(PATTACH_WATERWAKE) | 12 | Enumeration missing from environment. |
(PATTACH_CENTER_FOLLOW) | 13 | Enumeration missing from environment. |
(PATTACH_CUSTOM_GAME_STATE_1) | 14 | Enumeration missing from environment. |
MAX_PATTACH_TYPES | 15 |
See also
External links