Scripting API
以下是Half-Life: Alyx的VScriptAPI接口。
全局
全局函数。可以在没有任何类时使用。
算数
函数 | 原型 | 介绍 |
---|---|---|
角度差 | float AngleDiff(float ang1, float ang2)
|
返回两个角之间的度数差 |
角度到向量 | Vector AnglesToVector(QAngle angle)
|
将指定的 QAngles 转换为 Vector 返回 |
AxisAngleToQuaternion | Quaternion AxisAngleToQuaternion(Vector axis, float angle)
|
(vector,float) constructs a quaternion representing a rotation by angle around the specified vector axis. ![]() |
计算实体OBB上的最近点 | Vector CalcClosestPointOnEntityOBB(handle entity, Vector position)
|
计算实体OBB上相对于向量的最近点。 |
计算实体OBB距离 | float CalcDistanceBetweenEntityOBB(handle entity1, handle entity2)
|
计算两个实体 OBB 之间的距离.返回 负值 表示输入错误。返回 零 表示OBB重叠。 |
取向量叉积 | Vector CrossVectors(Vector v1, Vector v2)
|
计算两个向量之间的叉积(也可用作向量类方法)。 |
计算到2D线段的距离 | float CalcDistanceToLineSegment2D(Vector P, Vector vLineA, Vector vLineB)
|
获取P在vLineA和vLineB直线上的最近点,同时计算P到直线的最短距离。 |
指数衰减 | float ExponentialDecay(float decayTo, float decayTime, float dt)
|
一条越靠近零下降越缓慢的平滑曲线。 |
向量插值 | Vector LerpVectors(Vector v1, Vector v2, float t)
|
[0,1]上向量值的线性插值。 |
随机小数 | float RandomFloat(float min, float max)
|
随机返回一个在指定范围内的小数 |
随机整数 | int RandomInt(int min, int max)
|
随机返回一个在指定范围内的整数 |
旋转方向 | QAngle RotateOrientation(QAngle angle1, QAngle angle2)
|
应该就是 angle1+angle2。 |
旋转位置 | Vector RotatePosition(Vector rotationOrigin, QAngle rotationAngle, Vector vectorToRotate)
|
将一个指定的向量vTR围绕指定的原点rO旋转指定的rA。 |
RotateQuaternionByAxisAngle | Quaternion RotateQuaternionByAxisAngle(Quaternion quat, Vector axis, float angle)
|
Rotates a quaternion by the specified angle around the specified vector axis. ![]() |
旋转增量 | QAngle RotationDelta(Qangle src, Qangle dest,)
|
返回两Qangle之间的增量。 |
旋转增量到角速度 | Vector RotationDeltaAsAngularVelocity(Qangle angle1, Qangle angle2,)
|
返回两Qangle之间的角速度。(应该就是把QAngle换成Vector返回吧) |
SplineQuaternions | Quaternion SplineQuaternions(Quaternion q0, Quaternion q1, float 't')
|
Very basic interpolation of quaternions q0 to q1 over time 't' on [0,1]. ![]() |
曲线向量 | Vector SplineVectors(Vector v0, Vector v1, float t)
|
返回v0到v1随时间t在[0,1]上非常基本的插值。 |
向量到角度 | QAngle VectorToAngles(Vector input)
|
把一个Vector转换为QAngle。 |
工具
函数自动包含在utilsinit.lua核心库中。
函数 | 原型 | 介绍 |
---|---|---|
绝对值 | float abs(float val)
|
返回的数值绝对不为负。 |
限制 | float Clamp(float val, float min, float max)
|
如果val小于min,返回min;如果val大于max,返回max;否则返回val。 |
度数到弧度 | float Deg2Rad(float deg)
|
将度数转化为弧度。 |
弧度到度数 | float Rad2Deg(float rad)
|
将弧度转化为度数。 |
插值 | float Lerp(float t, float a, float b)
|
小数在[0,1]上的线性插值 |
取大 | float max(float x, float y)
|
返回较大的值。 |
取小 | float min(float x, float y)
|
返回较小的值。 |
合并 | table Merge(table t1, table t2)
|
将两个表合并为第三个表,覆盖任何匹配的键。 |
重映射值 | float RemapVal(float input, float a, float b, float c, float d)
|
将范围 [a,b] 中的值重新映射到 [c,d]。 |
限制重映射值 | float RemapValClamped(float input, float a, float b, float c, float d)
|
将范围 [a,b] 中的值重新映射到 [c,d],并限制在[c,d]中。 |
向量距离平方 | float VectorDistanceSq(Vector v1, Vector v2)
|
两个向量之间的距离平方(比计算普通距离更快)。 |
向量距离 | float VectorDistance(Vector v1, Vector v2)
|
两个向量之间的距离。 |
向量插值 | Vector VectorLerp(float t, Vector v1, Vector v2)
|
向量在 [0,1] 上的线性插值。与本机函数 LerpVectors 相同。 |
向量为空 | bool VectorIsZero(Vector vec)
|
检查向量是否是空值。 |
输出与绘制
函数 | 原型 | 介绍 |
---|---|---|
添加到日志文件 | void AppendToLogFile(string string_1, string string_2)
|
将字符串追加到服务器上的日志文件![]() |
绘制调试体 | void DebugDrawBox(Vector origin, Vector mins, Vector maxs, int r, int g, int b, int a, float duration)
|
绘制一个用于调试的立方体 |
绘制调试方向体 | void DebugDrawBoxDirection(Vector origin, Vector mins, Vector maxs, Vector orientation, Vector rgb, float a, float duration)
|
绘制一个面向指定方向的立方体 |
绘制调试圈 | void DebugDrawCircle(Vector origin, Vector rgb, float a, float radius, bool noDepthTest, float duration)
|
绘制一个用于调试的圈 |
绘制调试清除 | void DebugDrawClear()
|
试着清除所有的调试信息 |
绘制调试线 | void DebugDrawLine(Vector origin, Vector target, int r, int g, int b, bool noDepthTest, float duration)
|
绘制一个用于调试的线段 |
绘制调试量色线 | void DebugDrawLine_vCol(Vector Vector_1, Vector Vector_2, Vector Vector_3, bool bool_4, float float_5)
|
绘制一个用于调试的线段,参数由向量变量提供。
依次是:起始位置、结束位置、红绿蓝颜色值、透明度、false、持续时间。 |
绘制调试屏幕文本行 | 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)
|
在屏幕上绘制具有线段偏移量的文本。
参数依次是:x坐标、y坐标、线段偏移量、文本、红色值、绿色值、蓝色值、透明度、持续时间。 |
绘制调试球 | void DebugDrawSphere(Vector Vector_1, Vector Vector_2, float float_3, float float_4, bool bool_5, float float_6)
|
绘制一个调试用的球。
参数依次是:原点、红绿蓝颜色值、透明度、rad、false、持续时间。 |
绘制调试文本 | void DebugDrawText(Vector Vector_1, string string_2, bool bool_3, float float_4)
|
在三维空间中绘制文本。
参数依次是:原点、文本、bViewCheck、持续时间。 |
绘制调试妩媚屏幕文本 | 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)
|
在屏幕上绘制一个漂亮的调试用文本。
参数依次是:横坐标、纵坐标、线段偏移量、文本、红、绿、蓝、透明度、持续时间、字体、尺寸、为粗体。 |
消息 | void Msg(string message)
|
向控制台输出消息。 |
输出链接控制台消息 | void PrintLinkedConsoleMessage(string string_1, string string_2)
|
向链接控制台输出控制台消息。 |
曰 | void Say(handle entity, string message, bool teamOnly)
|
让实体输出message。teamOnly决定输出是否仅限于团队。 |
显示消息 | void ShowMessage(string string_1)
|
向所有客户端输出hud消息。 |
UTIL_消息文本 | void UTIL_MessageText(int playerId, string message, int r, int g, int b, int a)
|
显示特定玩家消息。 |
UTIL_消息文本_以上下文 | void UTIL_MessageText_WithContext(int playerId, string message, int r, int g, int b, int a, table context)
|
使用上下文表向消息框中的特定玩家发送消息。 |
UTIL_消息文本全 | void UTIL_MessageTextAll(string message, int r, int g, int b, int a)
|
向消息框中的每个玩家发送消息。 |
UTIL_消息文本全_以上下文 | void UTIL_MessageTextAll_WithContext(string message, int r, int g, int b, int a, table context)
|
使用上下文表向消息框中的每个玩家发送消息。 |
UTIL_重置消息文本 | void UTIL_ResetMessageText(int playerId)
|
重置该玩家的消息文本。 |
UTIL_重置消息文本全 | void UTIL_ResetMessageTextAll()
|
重置所有玩家的消息文本。 |
警告 | void Warning(string "msg")
|
输出一个警告。 |
操纵实体
函数 | 原型 | 介绍 |
---|---|---|
取消实体输事件 | void CancelEntityIOEvents(EHANDLE entityEhandle)
|
取消特定实体的所有输入、输出事件。 |
连接输出 | void ConnectOutputs(table scope)
|
将传递的实体脚本作用域的所有输出脚本函数连接到实体输出。 待完善: 文档函数名称格式: "^On.*Output$"
|
创建伤害信息 | CTakeDamageInfo CreateDamageInfo (handle, hInflictor, handlehAttacker,Vector force, Vector hitPos, float flDamage, int damageTypes)
|
分配一个 承受伤害信息 对象,用作 基本实体::承受伤害() 的参数。调用 销毁伤害信息() 来释放对象。 |
创建特效 | bool CreateEffect(table keys)
|
传递表 - 输入:实体、效果。 |
创建情景实体 | handle CreateSceneEntity(string sceneName)
|
创建情景实体以播放指定的情景。 |
创建触发器 | handle CreateTrigger(Vector origin, Vector mins, Vector maxs)
|
创建并返回已启用的 AABB 触发器 |
CreateTriggerRadiusApproximate创建触发器近似半径 | handle CreateTriggerRadiusApproximate(Vector origin, float radius)
|
创建并返回一个大于所提供半径的AABB触发器。 |
销毁伤害信息 | void DestroyDamageInfo(CTakeDamageInfo info)
|
释放使用 创建伤害信息() 创建的 承受伤害信息 对象。 |
运行实体触发 | void DoEntFire(string target, string action, string value, float delay, handle activator, handle caller)
|
内部的本机函数 实体触发() .
|
运行实体触发实例 | void DoEntFireByInstanceHandle(handle target, string action, string value, float delay, handle activator, handle caller)
|
内部的本机函数 实体触发句柄() .
|
实体触发 | void EntFire(table scope, string target, string action, string value = "", float delay = 0.0, handle activator = scope.thisEntity)
|
在所有与指定目标名称匹配的实体上生成实体输入输出事件。调用实体的脚本作用域应传递给第一个参数。 |
实体触发句柄 | void EntFireByHandle(handle self, handle target, string action, string value = "", float delay = 0.0, handle activator = self)
|
在指定实体上生成实体输入输出事件。调用实体应传递给第一个参数。 |
实体索引到脚本句柄 | handle EntIndexToHScript(int entindex)
|
根据实体索引值,获得实体的脚本实例句柄。 |
触发实体输仅名 | void FireEntityIOInputNameOnly(EHANDLE entityEhandle, string inputName)
|
触发实体的动作输入,无数据。 |
触发实体输文本 | void FireEntityIOInputString(EHANDLE entityEhandle, string inputName, string value)
|
触发实体传递字符串的动作输入-你拥有内存。 |
触发实体输文本量 | void FireEntityIOInputVec(EHANDLE entityEhandle, string inputName, Vector value)
|
触发实体传递向量的动作输入。 |
取最大输出延时 | float GetMaxOutputDelay(EHANDLE entityEhandle, string inputName)
|
为附加到输出的所有事件获取最长延迟。 |
取物理角速度 | Vector GetPhysAngularVelocity(CBaseEntity entity)
|
获取物理物体或法线物体的角速度。返回旋转轴的向量乘以以弧度/秒为单位的旋转。 |
取物理速度 | Vector GetPhysVelocity(CBaseEntity entity)
|
获取物理物体或法线物体的速度。 |
为有效实体 | bool IsValidEntity(CBaseEntity entity)
|
返回实体是否有效。 反面 为无效()
|
取玩家实例 | handle PlayerInstanceFromIndex(int index)
|
根据索引获取玩家脚本实例。 |
预缓存实体自表 | void PrecacheEntityFromTable(string classname, table spawnKeys, handle context)
|
从表中的键值预缓存实体。 |
预缓存实体列自表 | void PrecacheEntityListFromTable(table groupSpawnTables, handle context)
|
预缓存实体键值表列表。 |
预缓存模型 | void PrecacheModel(string modelName, handle context)
|
手动预缓存单个模型。 |
预缓存资源 | void PrecacheResource(string resourceType, string resourcePath, handle context)
|
model_folder|sound|soundfile|particle|particle_folder” |
设物理角速度 | void SetPhysAngularVelocity(CBaseEntity entity, Vector angVel)
|
根据旋转轴的向量设置物理对象或法线对象的角速度乘以以弧度/秒为单位的旋转。 |
设渲染启用 | void SetRenderingEnabled(EHANDLE entityEhandle, bool enabled)
|
设置 EHANDLE 的渲染打开/关闭。 Template:错 |
异步创建实体自表 | void SpawnEntityFromTableAsynchronous(string classname, table spawnKeys, function callback, handle unknown)
|
异步生成表中的单个实体。生成完成后将触发回调,将实体的句柄作为参数传递。 |
同步创建实体自表 | handle SpawnEntityFromTableSynchronous(string classname, table spawnKeys)
|
从表中同步生成单个实体。 |
创建实体自表 | bool SpawnEntityGroupFromTable(table groupSpawnTables, bool bAsync, handle callback)
|
从一组派生表中按层次结构派生实体组。 |
异步创建实体列自表 | int SpawnEntityListFromTableAsynchronous(table groupSpawnTables, handle callback)
|
从生成表列表中异步生成实体组。生成完成后将触发回调,传递生成的实体列表。 |
同步创建实体列自表 | handle SpawnEntityListFromTableSynchronous((table groupSpawnTables)
|
从生成表列表中同步生成实体组。 |
停止特效 | void StopEffect(handle entity, string effectName)
|
|
UTIL_移除 | void UTIL_Remove(handle entity)
|
删除实体 |
UTIL_移除即刻 | void UTIL_RemoveImmediate(handle entity)
|
无延迟地删除实体。![]() |
追踪
(相应的页面已进行翻译。)
函数 | 原型 | 介绍 |
---|---|---|
追踪碰撞 | bool TraceCollideable(table parameters)
|
对单个实体执行追踪。输入和输出参数存储在指定的表中。 |
追踪体 | bool TraceHull(table parameters)
|
沿直线追踪轴对齐的边界体。输入和输出参数存储在指定的表中。 |
追踪线 | bool TraceLine(table parameters)
|
沿线进行追踪。输入和输出参数存储在指定的表中。 |
声音
函数 | 原型 | 介绍 |
---|---|---|
播放全局声音 | void EmitGlobalSound(string soundName)
|
向所有玩家播放指定的声音。 |
播放声音 | void EmitSoundOn(string string_1, handle handle_2)
|
在实体上播放指定的声音。 |
播放声音客 | void EmitSoundOnClient(string string_1, handle handle_2)
|
仅为客户端上的玩家播放指定的声音。 |
设全体Opvar小数 | void SetOpvarFloatAll(string string_1, string string_2, string string_3, float float_4)
|
为所有玩家设置opvar值 |
设玩家Opvar小数 | void SetOpvarFloatPlayer(string string_1, string string_2, string string_3, float float_4, handle handle_5)
|
设置单个玩家的opvar值。
参数依次是:堆栈名称、重载名称、opvar名称、opvar值、玩家实体 |
开始声音事件 | void StartSoundEvent(string string_1, handle handle_2)
|
开始声音事件。 |
开始声音事件自位置 | void StartSoundEventFromPosition(string string_1, Vector Vector_2)
|
从指定位置开始声音事件。 |
开始声音事件自位置可靠 | void StartSoundEventFromPositionReliable(string string_1, Vector Vector_2)
|
可靠的从指定位置开始声音事件。(没看懂,建议去看原文理解) |
开始声音事件自位置不可靠 | void StartSoundEventFromPositionUnreliable(string string_1, Vector Vector_2)
|
可选的从指定位置开始声音事件。(没看懂,建议去看原文理解) |
开始声音事件可靠 | void StartSoundEventReliable(string string_1, handle handle_2)
|
通过可靠的交付开始声音事件。(带可靠我都没搞懂什么意思) |
开始声音事件不可靠 | void StartSoundEventUnreliable(string string_1, handle handle_2)
|
通过可选交付开始声音事件。 |
停止声音事件 | void StopSoundEvent(string string_1, handle handle_2)
|
停止声音事件。 |
关闭声音 | void StopSoundOn(string soundName, handle playingEntity)
|
关闭实体上指定的声音。 |
杂项
函数 | 原型 | 介绍 |
---|---|---|
取文本值 | float cvar_getf(string string_1)
|
将文本转换为小数返回。 |
写文本值 | bool cvar_setf(string string_1, float float_2)
|
将文本的值设置为指定小数。 |
调试中断 | void DebugBreak()
|
中断调试。 |
运行脚本文件 | bool DoIncludeScript(string scriptFileName, handle scope)
|
脚本文件() 的本机内部函数。
|
运行脚本断言 | void DoScriptAssert(bool assertion, string message)
|
脚本断言() 的本机内部函数。
|
运行唯一文本 | string DoUniqueString(string root)
|
唯一文本() 的本机内部函数。
|
触发游戏事件 | void FireGameEvent(string eventName, handle parameterTable)
|
触发预定义事件,可以在custom_events.txt或dota的资源/*.res中找到 |
触发游戏事件本地 | void FireGameEventLocal(string string_1, handle handle_2)
|
在不广播到客户端的情况下触发游戏事件。 |
帧时间 | float FrameTime()
|
获取服务器计算最后一帧花费的时间。 |
取活动生成组句柄 | int GetActiveSpawnGroupHandle()
|
返回当前活动的生成组句柄 |
取帧计数 | int GetFrameCount()
|
返回引擎当前帧计数。 |
取监听服务器 | handle GetListenServerHost()
|
在侦听服务器上获取本地玩家。 |
取地图名 | string GetMapName()
|
获取地图的名称。 |
脚本文件 | bool IncludeScript(string scriptFileName, handle scope = nil)
|
执行脚本文件。默认情况下包含在当前范围内。 |
初始化日志 | 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 ![]() |
为客户端 | bool IsClient()
|
如果这是从客户端(client.dll)运行的 lua,则返回 true。 |
为专用服务器 | bool IsDedicatedServer()
|
如果此服务器是专用服务器,则返回 true。 |
已标记删除 | bool IsMarkedForDeletion(handle handle_1)
|
如果实体有效并标记为删除,则返回 true。 |
为服务器 | bool IsServer()
|
如果这是从服务器(server.dll)运行的 lua,则返回 true。 |
为工具模式 | bool IsInToolsMode()
|
如果这是从dota2创意工坊工具运行的lua,则返回true。 |
监听游戏事件 | int ListenToGameEvent(string eventname, function callback, table context)
|
从脚本注册为游戏事件的侦听器。![]() |
加载键值 | table LoadKeyValues(string string_1)
|
从指定记录键值的文本文件创建表。 |
加载键值自文本 | table LoadKeyValuesFromString(string string_1)
|
从指定记录键值的文本中创建表。 |
本地时间 | table LocalTime()
|
以表的形式返回本地系统时间,格式为 {时 = int; 分 = int; 秒 = int} |
生成文本相 | int MakeStringToken(string string_1)
|
(可能是类似散列值那样的,每个文本生成一个对应的数字) |
手动触发器生成组完成 | void ManuallyTriggerSpawnGroupCompletion(int int_1)
|
触发在手动完成的生成组中创建实体。 |
注册生成组过滤器代理 | void RegisterSpawnGroupFilterProxy(string string_1)
|
为基于脚本的生成组过滤器创建 C 代理。 |
新载MOTD | void ReloadMOTD()
|
重新加载MotD文件 |
删除生成组过滤器代理 | void RemoveSpawnGroupFilterProxy(string string_1)
|
删除基于脚本的生成组过滤器的 C 代理。+ |
rr_加断规 | bool rr_AddDecisionRule(handle handle_1)
|
将规则添加到决策数据库。 |
rr_提交AI响应 | bool rr_CommitAIResponse(handle handle_1, handle handle_2)
|
将 QueryBestResponse 的结果提交回给定实体进行播放。使用参数 实体、AI响应 调用。 |
rr_取响应目标 | handle rr_GetResponseTargets()
|
检索所有可用表达式器目标的表, 格式为 {名称:句柄, 名称:句柄}. |
rr_查询最佳响应 | bool rr_QueryBestResponse(handle 实体, handle 查询, handle 结果)
|
静态:针对实体的响应系统测试“查询”,并返回找到的最佳响应(如果未找到,则返回 nil)。 |
屏幕抖动 | void ScreenShake(Vector vecCenter, float flAmplitude, float flFrequency, float flDuration, float flRadius, int eCommand, bool bAirShake)
|
参数依次是:中心、振幅、频率、持续时间、半径、命令(抖动开始=0,抖动结束=1)、空气抖动。 |
脚本断言 | void ScriptAssert(bool 断言, string 消息 = "")
|
断言传入的值。输出一条消息并显示断言对话框。 |
发送到控制台 | void SendToConsole(string string_1)
|
将文本作为客户端命令发送到控制台 |
发送到服务器控制台 | void SendToServerConsole(string string_1)
|
将文本作为客户端命令发送到服务器控制台 |
设任务名 | void SetQuestName(string string_1)
|
设置当前任务名称。 |
设任务阶段 | void SetQuestPhase(int int_1)
|
设置当前任务阶段。 |
停止所有监听游戏事件 | void StopListeningToAllGameEvents(table context)
|
停止收听特定上下文中的所有游戏事件。 |
停止监听游戏事件 | bool StopListeningToGameEvent(int eventlistener)
|
停止收听特定游戏事件。 |
时间 | float Time()
|
返回当前服务器时间。 |
唯一文本 | string UniqueString(string root = "")
|
使用可选的根文本生成一个新文本,该文本保证在当前脚本的整个生命周期中是唯一的。
当不确定表中已经使用了哪些键时,将数据添加到表中非常有用。 |
卸载生成组 | void UnloadSpawnGroup(string string_1)
|
按名称卸载生成组。 |
卸载生成组自句柄 | void UnloadSpawnGroupByHandle(int int_1)
|
按句柄卸载生成组。 |
更新事件指针 | void UpdateEventPoints(handle handle_1)
|
未设置描述。 |
核心
lua核心库自带的函数。位于vlua表中,而非全局作用域。
支持Sq2Lua.exe生成的Lua代码的库函数
函数 | 原型 | 介绍 |
---|---|---|
清除 | table vlua.clear(table t)
|
实现 Squirrel 清除表。 |
比较 | int vlua.compare(float a, float b)
|
实现 Squirrel 三向比较运算符 ( <=> )。 |
包含 | bool vlua.contains(table t, variable key)
|
实现 Squirrel in 运算符。 |
删除 | int vlua.delete(table t, variable key)
|
实现 Squirrel delete 运算符。 |
复制 | int vlua.clone(table t)
|
实现 Squirrel clone 运算符。 |
原删除 | int vlua.rawdelete(table t, variable key)
|
实现 Squirrel rawdelete 运算符。 |
根 | int vlua.rawin(table t, variable key)
|
实现 Squirrel rawin 运算符。 |
寻找 | variable vlua.find([table/string] o, variable value, [int startIndex])
|
实现表和文本的Squirrel find 方法。(o,子文本,[起始索引])表示文本,(o,值)表示表。 |
分割 | variable vlua.slice([table/string] o, int startIndex, [int endIndex])
|
实现表和字符串的Squirrel slice 方法。 |
反转 | table vlua.reverse(table o)
|
实现表的Squirrel reverse 方法。 |
调整 | table vlua.resize(string o, int size, [variable fill])
|
实现表的Squirrel resize 方法。 |
扩展 | table vlua.extend(table o, array array)
|
实现表的Squirrel extend 方法。 |
映射 | table vlua.map(table o, function mapFunc)
|
实现表的Squirrel map 方法。 |
化简 | table vlua.reduce(table o, function reduceFunc)
|
实现表的Squirrel reduce 方法。 |
表加 | table vlua.tableadd (table t1, table t2)
|
以支持Squirrel 中的 += 。 |
拆分 | table vlua.split(string input, string separator)
|
实现文本的Squirrel split 方法。 |
选择 | variable vlua.select(bool conditional, variable valueIfTrue, variable valueIfFalse)
|
安全三元运算符。如果valueIfTrue为零,Lua版本将返回错误的值。 |
类
基本实体
最基本的实体类。
函数
函数 | 原型 | 介绍 |
---|---|---|
加特效 | void AddEffects(int nFlags)
|
添加呈现特效标志。 |
应用绝对速度脉冲 | void ApplyAbsVelocityImpulse(Vector vecImpulse)
|
应用速度脉冲。 |
应用相对角速度脉冲 | void ApplyLocalAngularVelocityImpulse(Vector angImpulse)
|
应用角速度脉冲。 |
属性取小数 | float Attribute_GetFloatValue(string pName, float flDefault)
|
获取实体属性的小数值。 |
属性取整数 | float Attribute_GetIntValue(string pName, int nDefault)
|
获取实体属性的整数值。 |
属性设小数 | void Attribute_SetFloatValue(string pName, float flValue)
|
设置实体属性的小数值。 |
属性设整数 | void Attribute_SetIntValue(string pName, int nValue)
|
设置实体属性的整数值。 |
属性删除 | void DeleteAttribute(string pName)
|
删除实体属性。 |
发出声音 | void EmitSound(string soundName)
|
|
发出声音附参 | void EmitSoundParams(string soundName, int pitch, float volume, float soundTime)
|
播放/修改来自此实体的声音。如果音高(pitch)和/或音量(volume)或声音时间(soundTime)> 0,则更改声音。 |
眼角度 | QAngle EyeAngles()
|
头戴显示器偏移角度。 |
眼位置 | Vector EyePosition()
|
头戴摄像头绝对位置。 |
首移动子项 | handle FirstMoveChild()
|
如果在层次结构中,则获取第一个移动的子项。 |
关注实体 | void FollowEntity(handle hEntity, bool bBoneMerge)
|
|
收集标准 | void GatherCriteria(handle hResult)
|
返回一个表,其中包含将用于对此实体的响应查询的条件。这与传递给响应规则脚本函数回调的表相同。 |
取绝对原点 | Vector GetAbsOrigin()
|
返回实体的世界空间原点。 |
取绝对比例 | float GetAbsScale()
|
获取实体绝对比例。
待完善: 如何访问非均匀比例?
|
取角度 | QAngle GetAngles()
|
将实体俯仰、偏航、滚动值作为 QAngle 的成员返回。 |
取角度向量 | Vector GetAnglesAsVector()
|
将实体俯仰、偏航、滚动值作为 Vector 的成员返回。 |
取角速度 | Vector GetAngularVelocity()
|
获取局部角速度 - 返回俯仰、偏航、滚动的向量。 |
取基本速度 | Vector GetBaseVelocity()
|
获取基本速度。仅在设置了“脚本化移动”(Scripted Movement)属性prop_dynamic实体上起作用。 |
取边界最大值 | Vector GetBoundingMaxs()
|
获取包含最大边界的向量,以对象为中心。 |
取边界最小值 | Vector GetBoundingMins()
|
获取包含最小边界的向量,以对象为中心。 |
取边界 | table GetBounds()
|
获取一个包含“Mins”和“Maxs”向量变量边界的表,以对象为中心 |
获取中心 | Vector GetCenter()
|
以向量类型返回对象中心的绝对坐标。 |
取子成员 | table GetChildren()
|
获取此实体的子实体 |
取上下文 | table GetContext(string name)
|
查找上下文并返回它(如果可用)。可能返回文本、小数或空值(如果未找到上下文) |
取正向量 | Vector GetForwardVector()
|
获取实体的前向向量。 |
取健康度 | int GetHealth()
|
未设置描述 |
取相对角速度 | QAngle GetLocalAngularVelocity()
|
获取实体相对角速度。仅在设置了“脚本化移动”(Scripted Movement )属性prop_dynamic实体上起作用。 |
取相对角度 | QAngle GetLocalAngles()
|
获取实体相对于其父级或连接点的俯仰、偏航、滚动值,以QAngle类型返回。 |
取相对原点 | Vector GetLocalOrigin()
|
获取实体相对于其父级或连接点的原点,以Vector类型返回。 |
取相对比例 | float GetLocalScale()
|
获取实体相对于其父级的比例。 |
取相对速度 | Vector GetLocalVelocity()
|
获取实体相对速度。仅在设置了“脚本化移动”(Scripted Movement)属性prop_dynamic实体上起作用。 |
取质量 | float GetMass()
|
获取实体的质量。(如果没有物理对象,则返回 0) |
取健康上限 | int GetMaxHealth()
|
未设置描述 |
取模型名 | string GetModelName()
|
返回模型的名称。 |
取移动上级 | handle GetMoveParent()
|
如果在层次结构中,则检索实体的父级。 |
取原点 | Vector GetOrigin()
|
返回实体的原点,如果实体存在父级,则是相对于父空间的坐标(相对坐标);反之为相对于世界空间(绝对坐标)。 |
取主 | handle GetOwner()
|
获取此实体的所有者。 |
取主实体 | handle GetOwnerEntity()
|
获取所有者实体(如果有)。 |
取右向量 | Vector GetRightVector()
|
获取相对于实体向右的向量。 |
取根移动上级 | handle GetRootMoveParent()
|
如果在层次结构中,则向上浏览层次结构以查找根父级。 |
取声音时效 | float GetSoundDuration(string soundName, string actormodelname)
|
返回声音的持续时间。必须指定声音名称,可选是否指定表演模型名称。 |
取生成组句柄 | int GetSpawnGroupHandle()
|
返回此实体的生成组句柄。 |
取组 | int GetTeam()
|
未设置描述 |
取组号 | int GetTeamNumber()
|
获取此实体所在组的编号。 |
取上向量 | Vector GetUpVector()
|
获取相对于实体向上的向量。 |
取速度 | Vector GetVelocity()
|
实体的绝对速度。仅在设置了脚本化移动(Scripted Movement)属性prop_dynamic实体上起作用。 |
散列属性 | bool HasAttribute(string pName)
|
查看实体是否具有特定属性。 |
为存活 | bool IsAlive()
|
实体是否还活着。 |
为角色 | bool IsNPC()
|
这个实体是名角儿(CAI_BaseNPC)吗? |
为无效 | bool IsNull()
|
返回实体是否无效。与为有效实体() 相反。
|
为玩家 | bool IsPlayer()
|
是玩家实体。 |
斩 | void Kill()
|
删除实体 (UTIL_Remove() )
|
次移动同级 | handle NextMovePeer()
|
返回同一移动层次结构中的下一个实体。 |
覆盖分歧 | void OverrideFriction(float duration, float friction)
|
获取临时覆盖的持续时间值 |
预缓存脚本声音 | void PrecacheScriptSound(string soundname)
|
预缓存声音以供以后播放。 |
删除特效 | void RemoveEffects(int nFlags)
|
删除渲染效果标志。 |
设绝对角度 | void SetAbsAngles(float fPitch, float fYaw, float fRoll)
|
设置实体在世界空间的俯仰、偏航、滚动值。 |
设绝对原点 | void SetAbsOrigin(Vector origin)
|
设置实体在世界空间的原点。 |
设绝对比例 | void SetAbsScale(float scale)
|
设置实体的绝对比例。 |
设角度 | void SetAngles(float pitch, float yaw, float roll)
|
存在父级,设置相对父级的角度;反之,设置绝对角度。 |
设角速度 | void SetAngularVelocity(float pitch, float yaw, float roll)
|
设置局部角速度 - 采用小数俯仰、偏航、横滚速度。仅在设置了“脚本化移动”(Scripted Movement)属性prop_dynamic实体上起作用。 |
设约束 | void SetConstraint(Vector vPos)
|
设置约束的位置。 |
设上下文 | void SetContext(string pName, string pValue, float duration)
|
在此实体的对话上下文中存储任何键/值对。值必须是文本。将持续一段时间(duration 设置为 0 表示“永远”)。 |
设上下文数 | void SetContextNum(string pName, float fValue, float duration)
|
在此实体的对话上下文中存储任何键/值对。值必须是数字。将持续一段时间(duration 设置为 0 表示“永远”)。 |
设上下文思想 | void SetContextThink(string pszContextName, handle hThinkFunc, float flInterval)
|
在此实体上设置思想函数。 |
设实体名 | void SetEntityName(string name)
|
设置实体的targetname。 |
设正向量 | void SetForwardVector(Vector forwardVec)
|
设置实体的正方向。 |
设摩擦值 | void SetFriction(float flFriction)
|
设置玩家摩擦,忽略对象。 |
设重力值 | void SetGravity(float flGravity)
|
设置玩家重力,忽略对象。 |
设健康值 | void SetHealth(int hp)
|
设置实体血量。 |
设相对角度 | void SetLocalAngles(float pitch, float yaw, float roll)
|
相对于实体的父点或附着点的局部空间,设置实体俯仰、偏航、滚动。 |
设相对原点 | void SetLocalOrigin(Vector origin)
|
设置实体本地原点。相对于实体的父点或附着点的局部空间。 |
设相对比例 | void SetLocalScale(float scale)
|
设置实体相对于父级的比例。 |
设质量 | void SetMass(float flMass)
|
设置实体的质量。(如果没有物理对象,则不执行任何操作) |
设置健康上限 | void SetMaxHealth(int maxHP)
|
设置实体血上限。 |
设原点 | void SetOrigin(Vector origin)
|
设置实体绝对原点。 |
设主 | void SetOwner(handle owningEntity)
|
设置此实体的所有者。 |
设父 | void SetParent(handle hParent, string pAttachmentname)
|
设置此实体的父级。附件是可选的,传递空文本则不使用它。 |
设组 | void SetTeam(int team)
|
设置实体组 |
设思想 | void SetThink(function thinkFunction, string thinkName, float initialDelay)
|
设置要定期调用的思想函数。 |
设速度 | void SetVelocity(Vector vecVelocity)
|
设置实体的世界空间速度。仅在设置了脚本化移动(Scripted Movement)属性prop_dynamic实体上起作用。 |
停止声音 | void StopSound(string soundName)
|
停止从此实体播放指定声音。 |
停止思想 | void StopThink (string thinkName)
|
停止指定思想函数。 |
承受伤害 | int TakeDamage(damageinfo hInfo)
|
对此实体施加伤害。使用 创建伤害信息() 创建一个伤害信息对象。 |
相对到绝对 | Vector TransformPointEntityToWorld(Vector vPoint)
|
将输入向量从相对于实体,转换为绝对于世界。
待完善: May not respect entity scale
|
绝对到相对 | Vector TransformPointWorldToEntity(Vector vPoint)
|
将输入向量从绝对于世界,转换为相对于实体。
待完善: May not respect entity scale
|
触发 | void Trigger()
|
触发此实体的 OnTrigger 响应。 |
验证私人脚本域 | void ValidatePrivateScriptScope()
|
验证私人脚本域,如果不存在,则创建它。 |
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. 待完善: 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} 待完善: 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.
![]() 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. ![]() |
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. ![]() |
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. ![]() |
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. ![]() |
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. ![]() |
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. ![]() |
__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 待完善: Do these always give both thumbstick axes?
| |
4 | Move | Continuous Turn | X, Y Axis
待完善: 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 | 待完善: 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 | [待完善] |
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 |