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.  错误: The Quaternion class is non-functional | 
| 计算实体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.  错误: The Quaternion class is non-functional | 
| 旋转增量 | 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].  错误: The Quaternion class is non-functional | 
| 曲线向量 | 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 触发器 | 
| 创建触发器近似半径 | 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)  | 从脚本注册为游戏事件的侦听器。  注意:eventname 存储在本地文件'*\Half-Life Alyx\game\core\pak01_dir.vpk\resource\core.gameevents'中 | 
| 加载键值 | 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()  | 验证私人脚本域,如果不存在,则创建它。 | 
挂接
如果脚本中含有下面指定原型的函数,则在特定的程序运行时机会自动调用。
| 函数 | 原型 | 介绍 | 
|---|---|---|
| 激活 | void Activate(int activateType)  | 实体生成后在Activate()中调用。如果实体是在地图加载时生成的,则在所有实体生成后调用本函数。activateType 参数包含此处所述的枚举。 | 
| 休息 | void OnBreak(CBaseEntity inflictor)  | 在可破坏实体损坏时调用。 待完善: 不知道适用于哪些实体类? | 
| 实体文本 | string OnEntText()  | 在实体上启用ent_text时调用每个帧。返回要添加到ent_text输出的文本。 | 
| 受到伤害 | unknown OnTakeDamage(table damageTable)  | 当实体受到伤害时调用。 提供的表需要以下成员:{屠刀(inflictor) = handle, 伤害方向(damage_direction )= Vector, 伤害位置(damage_position) = Vector, 伤害力度(damage_force) = Vector, 伤害值(damage) = int, 屠夫(attacker) = handle} 待完善: 检查哪些实体类可能会受到损害。Prop_physics和prop_dynamic会,但不完全会。 | 
| 预缓存 | void Precache(CScriptPrecacheContext context)  | 在预缓存实体时调用。用于使用全局预缓存系列脚本函数 预缓存脚本所需的任何其他资源。 | 
| 生成 | void Spawn(CScriptKeyValues spawnkeys)  | 在Spawn()中调用,在创建实体之后,但在初始化之前。传递可用于查询实体生成键值的脚本键值(CScriptKeyValues)句柄。 | 
| 更新自删除 | void UpdateOnRemove()  | 在实体被杀死之前调用。 | 
实体实例
- 继承自 基本实体
 
 
 
 
所有实体都继承自此类。
| 函数 | 原型 | 介绍 | 
|---|---|---|
| 连接输出 | void ConnectOutput(string output, string functionName)  | 添加一个输入输出连接,该连接将在指定的输出触发时调用此实体上的命名函数。  错误: 在Half-Life: Alyx中不起作用。改用将 thisEntity作为第三个参数的重定向输出。  [todo tested in ?] | 
| 摧毁 | void Destroy()  | 删除本实体 ( UTIL_Remove()) | 
| 断开输出 | void DisconnectOutput(string output, string functionName)  | 从本实体上的输入输出事件中删除连接的脚本函数。 | 
| 断开重定向输出 | void DisconnectRedirectedOutput(string output, string functionName, CBaseEntity entity)  | 从输入的实体上的输入输出事件中删除连接的脚本函数。 | 
| 实体索引 | int entindex()  | 未设置描述。 | 
| 触发输出 | void FireOutput(string outputName, handle activator, handle caller, table args, float delay)  | 触发实体输出。 | 
| 取类名 | string GetClassname()  | 未设置描述。 | 
| 取调试名 | string GetDebugName()  | 如果未定义,则获取带帮助的实体名称(即类名/etc) | 
| 取实体句柄 | ehandle GetEntityHandle()  | 获取EHANDLE类型的实体句柄。 | 
| 取实体索引 | int GetEntityIndex()  | 未设置描述。 | 
| 取整性 | int GetIntAttr(string key)  | 获取整数属性。 | 
| 取名 | string GetName()  | 未设置描述。 | 
| 取建私有脚本域 | handle GetOrCreatePrivateScriptScope()  | 检索并在必要时创建每个与实体关联的实例的私有脚本端数据。 | 
| 取建公有脚本域 | handle GetOrCreatePublicScriptScope()  | 检索并在必要时创建与实体关联的公有脚本端数据。 | 
| 取私有脚本域 | handle GetPrivateScriptScope()  | 检索与实体关联的每个私有实例脚本端数据。 | 
| 取公有脚本域 | handle GetPublicScriptScope()  | 检索与实体关联的公有脚本端数据。 | 
| 重定向输出 | void RedirectOutput(string output, string functionName, CBaseEntity entity)  | 添加一个输入输出连接,该连接将在指定的输出触发时调用输入的实体上的指定函数。 | 
| 删除自身 | void RemoveSelf()  | 删除实体。 ( UTIL_Remove()) | 
| 设整性 | void SetIntAttr(string key, int value)  | 设置整数属性。 | 
模型实体
- 继承自 基本实体
 
 
 
 
具有模型的实体均继承自此。
| 函数 | 原型 | 介绍 | 
|---|---|---|
| 取材质组散列 | unsigned GetMaterialGroupHash()  | 获取此实体的材质组散列值。 | 
| 取材质组掩码 | <unknown> GetMaterialGroupMask()  | 获取此实体的网格组掩码。 | 
| 取渲染特 | int GetRenderAlpha()  | 获取此实体的特殊调和值。 | 
| 取渲染色 | Vector GetRenderColor()  | 获取实体的渲染颜色。 | 
| 设身体组 | void SetBodygroup(int iGroup, int iValue)  | 按索引设置身体组。 | 
| 设身体组自名 | void SetBodygroupByName(int iGroup, int iValue)  | 按名称设置身体组。(这里的原型应该错了,既然是按名应该用文本参数吧。) | 
| 设灯光组 | void SetLightGroup(string pLightGroup)  | 设置实体的灯光组 | 
| 设材质组 | void SetMaterialGroup(string pMaterialGroup)  | 设置实体的材质组 | 
| 设材质组散列 | void SetMaterialGroupHash(uint32 nHash)  | 设置此实体的材质组散列值。 | 
| 设材质组掩码 | void SetMaterialGroupMask(uint64 nMeshGroupMask)  | 设置此实体的材质组掩码。 | 
| 设置模型 | void SetModel(string pModelName)  | 改变此实体的模型。新的模型记得在 预缓存里缓存。 | 
| 设渲染特 | void SetRenderAlpha(int nAlpha)  | 设置此实体的特殊调和值。 | 
| 设渲染色 | void SetRenderColor(int red, int green, int blue)  | 设置此实体的渲染颜色。 | 
| 设渲染模式 | void SetRenderMode(int nMode)  | 设置本实体的渲染颜色。 | 
| 设单网组 | void SetSingleMeshGroup(string pMeshGroupName)  | 为此实体设置单个网格组。 | 
| 设尺寸 | void SetSize(Vector mins, Vector maxs)  | |
| 设皮肤 | void SetSkin(int iSkin) | 有些材质有多个皮肤。 | 
玩家实体
玩家的实体类。
| 函数 | 原型 | 介绍 | 
|---|---|---|
| 监控边界可见 | bool AreChaperoneBoundsVisible()  | 返回玩家监控边界是否可见。 | 
| 取手模拟动作位置 | Vector GetAnalogActionPositionForHand(int nLiteralHandType, int nAnalogAction) | 返回指定手(0左1右,记不清了反正这俩)的模拟信号值。关于信号值和返回类型,可以参阅 模拟输入信号 。  注意: 仅当头戴显示器使用时可用。手柄丢失定位后依然会返回。 | 
| 取头显锚点 | handle GetHMDAnchor()  | 返回此玩家的头戴显示器定位点实体(如果存在) | 
| 取头显化身 | CPropHMDAvatar GetHMDAvatar()  | 返回此玩家的头戴显示器实体(如果存在) | 
| 取游戏区域 | Vector GetPlayArea(int nPoint)  | 通过0-3索引游玩区域的四角,返回指定点的向量坐标。 | 
| 取用户证 | int GetUserID()  | 返回玩家的用户证件。 | 
| 取控制类型 | int GetVRControllerType()  | 返回在 VR 中使用的控制器的类型。有关控制器类型,请参阅 控制器类型。 | 
| 手是否作了行为 | bool IsDigitalActionOnForHand(int nLiteralHandType, int nDigitalAction) | 如果控制器进行了指定的数字操作,则返回true。关于信号值和返回类型,可以参阅 数字输入信号 。  注意: 仅当头戴显示器使用时可用。手柄丢失定位后依然会返回。 | 
| 为穿模 | bool IsNoclipping()  | 如果玩家穿模,返回true。 | 
| 使用被按下 | bool IsUsePressed()  | 如果按下使用键,返回true。 | 
| 为控制器键按下 | bool IsVRControllerButtonPressed(int nButton)  | 如果控制器的按钮按下,返回true。  错误:Half-Life: Alyx中控制器按钮无效。在vr关闭时使用键绑定。 | 
| 面板为显示 | bool IsVRDashboardShowing()  | 如果显示此玩家的 SteamVR 面板,则返回 true。 | 
半2_玩家
半条命的玩家子类。
| 函数 | 原型 | 介绍 | 
|---|---|---|
| 玩家计次_可修改值 | bool PlayerCounter_CanModifyValue(string name, int delta)  | |
| 玩家计次_设最大值 | int PlayerCounter_SetMax(string name, int max)  | |
| 玩家计次_修改值 | int PlayerCounter_ModifyValue(string name, int delta)  | |
| 玩家计次_设最小值 | int PlayerCounter_SetMin(string name, int min)  | |
| 玩家计次_设极值 | int PlayerCounter_SetMinMax(string name, int min, int max)  | |
| 玩家计次_设值 | int PlayerCounter_SetValue(string name, int value)  | |
| 玩家计次_取值 | int PlayerCounter_GetValue(string name)  | 
动画实体
- 继承自 基本实体
 
 
 
 
包含动画中涉及的方法的类。大多数基于模型的实体都继承了本类。
| 函数 | 原型 | 介绍 | 
|---|---|---|
| 取活动序列时效 | float ActiveSequenceDuration()  | 返回活动序列的持续时间(以秒为单位)。 | 
| 取附件角度 | Vector GetAttachmentAngles(int iAttachment)  | 获取指定附件的角度作为向量的成员的值。 | 
| 取附件正向 | Vector GetAttachmentForward(int iAttachment)  | 获取指定附件的正向向量。 | 
| 取附件原点 | Vector GetAttachmentOrigin(int iAttachment)  | 获取指定附件的原点。 | 
| 取周期 | float GetCycle()  | 获取动画的周期。 | 
| 取图形参数 | table GetGraphParameter(string pszParam)  | 获取给定的动画图形(animGraph)参数的值。 | 
| 取模型比例 | float GetModelScale()  | 取实体模型的比例。 | 
| 取序列 | string GetSequence()  | 返回活动序列的名称。 | 
| 序列已完成 | bool IsSequenceFinished()  | 询问主序列是否播放完毕。 | 
| 注册动画标签监听 | void RegisterAnimTagListener(handle hAnimTagListenerFunc)  | 为文本 AnimTags 注册侦听器,替换现有的脚本侦听器(如果有)。 | 
| 重置序列 | void ResetSequence(string pSequenceName)  | 按名称设置活动序列,重置当前周期。 | 
| 脚本查找附件 | int ScriptLookupAttachment(string pAttachmentName)  | 取指定名称的附件号。 | 
| 序列时效 | float SequenceDuration(string pSequenceName)  | 返回指定序列的持续时间(以秒为单位)。 | 
| 设图形皮标记 | void SetGraphLookTarget(Vector vValue)  | 将世界空间中所需的皮标记传递给图形。 | 
| 设图形参数 | void SetGraphParameter(string pszParam, table svArg)  | 设置具体的参数值,类型是从脚本中的类型推断出来的。 | 
| 设图形参数逻辑 | void SetGraphParameterBool(string szName, bool bValue)  | 将逻辑值传递给指定的参数。 | 
| 设图形参数枚举 | void SetGraphParameterEnum(string szName, int nValue)  | 将枚举(整数)值传递给指定的参数。 | 
| 设图形参数小数 | void SetGraphParameterFloat(string szName, float flValue)  | 将小数值传递给指定的参数。 | 
| 设图形参数整数 | void SetGraphParameterInt(string szName, int nValue)  | 将整数值传递给指定的参数。 | 
| 设图形参数向量 | void SetGraphParameterVector(string szName, Vector vValue)  | 将向量值传递给图形中的指定参数。 | 
| 设模型比例 | void SetModelScale(float scale)  | 将模型的比例设置为scale, 因此,如果一个单位的模型比例为 1,并且使用过 设模型比例(10.0),它会将比例设置为 10.0。 | 
| 设姿势参数 | float SetPoseParameter(string szName, float fValue)  | 将指定的姿势参数设置为指定的值。 | 
| 设序列 | void SetSequence(string pSequenceName)  | 按名称设置活动序列,保持当前周期。 | 
| 停止动画 | void StopAnimation()  | 通过将播放速率设置为 0.0 来停止当前动画。 | 
| 注销动画标签监听 | void UnregisterAnimTagListener(table hScript)  | 注销当前文本 AnimTag 侦听器(如果有)。 | 
弹性实体
- 继承自 动画实体
 
 
 
 
具有顶点弯曲功能的动画实体。
| 函数 | 原型 | 介绍 | 
|---|---|---|
| 查找弹性控制 | int FindFlexController(string pszFlexControllerName)  | 按名称查找弹性控制器,返回索引,如果未找到,则返回 -1 | 
| 取当前场景 | handle GetCurrentScene()  | 返回最早的活动场景实体(如果有)的实例。 | 
| 取弹性权重 | float GetFlexWeight(int nFlexControllerIndex)  | 按索引获取指定的弹性控制器的权重,使用 查找弹性控制按名称获取弹性控制器的索引。 | 
| 取索引场景 | handle GetSceneByIndex(int index)  | 返回指定索引处场景实体的实例。 | 
| 脚本运行场景 | float ScriptPlayScene(string pszSceneFile, float flDelay)  | 播放指定的.vcd文件。 | 
| 设弹性权重 | void SetFlexWeight(int nFlexControllerIndex, float flWeight)  | 设置由索引指定的弹性控制器的权重,使用 查找弹性控制按名称获取弹性控制器的索引。 | 
战斗角色
未设置描述
| 函数 | 原型 | 介绍 | 
|---|---|---|
| 取装备武器 | table GetEquippedWeapons()  | 返回所有装备武器的数组。 | 
| 取派系 | int GetFaction()  | 获取战斗角色派系。 | 
| 取武器计数 | int GetWeaponCount()  | 获取当前装备的武器数量。 | 
| 射击位置 | Vector ShootPosition(int nHand)  | 返回射击位置眼睛(在灵境中是的手)。 | 
身体组件
未设置描述
| 函数 | 原型 | 介绍 | 
|---|---|---|
| 添加脉冲位置 | void AddImpulseAtPosition(Vector Vector_1, Vector Vector_2)  | 将绝对位置的脉冲应用于物理。 | 
| 加速度 | void AddVelocity(Vector Vector_1, Vector Vector_2)  | 向物理对象添加线性、角速度 | 
| 父级分离 | void DetachFromParent()  | 与其父级分离。 | 
| 取序列 | <unknown> GetSequence()  | 返回活动序列。 | 
| 父级附加 | bool IsAttachedToParent()  | 附加到父级。 | 
| 查找序列 | <unknown> LookupSequence(string string_1)  | 返回给定名称的序列证 | 
| 序列时效 | float SequenceDuration(string string_1)  | 返回指定序列的持续时间(以秒为单位)。 | 
| 设角速度 | void SetAngularVelocity(Vector Vector_1)  | 未设置描述 | 
| 设动画 | void SetAnimation(string string_1)  | 输入要在此模型上播放的动画的文本 | 
| 设身体组 | void SetBodyGroup(string string_1)  | 未设置描述 | 
| 设材质组 | void SetMaterialGroup(utlstringtoken utlstringtoken_1)  | 未设置描述 | 
| 设速度 | void SetVelocity(Vector velocity)  | 未设置描述 | 
实体类
提供枚举所有服务器端实体的方法。
全局访问变量: Entities
| 函数 | 原型 | 介绍 | 
|---|---|---|
| 创建自类名 | handle CreateByClassname(string className)  | 按类名创建实体。  警告:这不会初始化创建的实体。请改用以生成为前缀的全局函数。 | 
| 寻全实按类名 | table FindAllByClassname(string className)  | 按类名查找所有实体。返回一个包含所有找到的实体的数组。 | 
| 寻范围全实按类名 | table FindAllByClassnameWithin(string className, Vector origin, float maxRadius)  | 在半径内按类名查找实体。返回一个包含所有找到的实体的数组。 | 
| 寻全实按模型 | table FindAllByModel(string modelName)  | 按模型名称查找所有实体。返回一个包含所有找到的实体的数组。 | 
| 寻全实按名 | table FindAllByName(string name)  | 按名称查找所有实体。返回一个数组,其中包含所有找到的实体。 | 
| 寻范围全实按名 | table FindAllByNameWithin(string name, Vector origin, float maxRadius)  | 按名称查找半径内的所有实体。返回一个包含所有找到的实体的数组。 | 
| 寻全实按标 | table FindAllByTarget(string targetName)  | 查找具有此目标集的所有实体。返回一个包含所有找到的实体的数组。 | 
| 寻全实球范围 | table FindAllInSphere(Vector origin, float maxRadius)  | 查找半径内的所有实体。返回一个包含所有找到的实体的数组。 | 
| 寻实按类名 | handle FindByClassname(handle startFrom, string className)  | 按类名查找实体。传递 nil 以开始迭代,或引用以前找到的实体以继续搜索。 | 
| 寻近实按类名 | handle FindByClassnameNearest(string className, Vector origin, float maxRadius)  | 查找离点最近的指定类名实体。 | 
| 寻范围实按类名 | handle FindByClassnameWithin(handle startFrom, string className, Vector origin, float maxRadius)  | 在半径内按类名查找实体。传递 nil 以开始迭代,或引用以前找到的实体以继续搜索。 | 
| 寻实按模 | handle FindByModel(handle startFrom, string modelName)  | 按模型名称查找实体。传递 nil 以开始迭代,或引用以前找到的实体以继续搜索。 | 
| 寻范围实按模 | handle FindByModelWithin(handle startFrom, string modelName, Vector origin, float maxRadius)  | 在半径内的按模型名称查找实体。传递 nil 以开始迭代,或引用以前找到的实体以继续搜索。 | 
| 寻实按名 | handle FindByName(handle lastEnt, string searchString)  | 按名称查找实体。传递 nil 以开始迭代,或引用以前找到的实体以继续搜索。 | 
| 寻近实按名 | handle FindByNameNearest(string name, Vector origin, float maxRadius)  | 查找离点最近的指定名实体。 | 
| 寻范围实按名 | handle FindByNameWithin(handle startFrom, string name, Vector origin, float maxRadius)  | 在半径内按名称查找实体。传递 nil 以开始迭代,或引用以前找到的实体以继续搜索。 | 
| 寻实按标 | handle FindByTarget(handle startFrom, string targetName)  | 按目标名称查找实体。传递 nil 以开始迭代,或引用以前找到的实体以继续搜索。 | 
| 寻实球范围 | handle FindInSphere(handle startFrom, Vector origin, float maxRadius)  | 查找半径内的实体。传递 nil 以开始迭代,或引用以前找到的实体以继续搜索。 | 
| 一 | handle First()  | 开始对实体列表进行迭代。 | 
| 取本地玩家 | handle GetLocalPlayer()  | 获取本地玩家实体。 | 
| 次 | handle Next(handle startFrom)  | 继续迭代实体列表,提供对以前找到的实体的引用。 | 
配角儿
未设置描述
| 函数 | 原型 | 介绍 | 
|---|---|---|
| 取小队 | handle GetSquad()  | 获取此角儿所属的小队。 | 
| 行至 | void NpcForceGoPosition(Vector vPos, bool bRun, float flSuccessTolerance) | 设定一个位置目标并开始移动。 | 
| 删除目标 | void NpcNavClearGoal() | 删除角儿的当前目标。 | 
| 取目标位置 | Vector NpcNavGetGoalPosition() | 获取当前目标的位置。 | 
| 为有目的 | bool NpcNavGoalActive() | 如果角儿有目标和路径,则返回 true。 | 
基本触发
- 继承自 基本实体
 
 
 
 
触发器的实体类。
| 函数 | 原型 | 介绍 | 
|---|---|---|
| 禁用 | void Disable()  | 禁用触发器。 | 
| 启用 | void Enable()  | 启用触发器。 | 
| 被触发 | bool IsTouching(handle hEnt)  | 检查输入的实体是否触发触发器。 | 
环境时间
未设置描述
| 函数 | 原型 | 介绍 | 
|---|---|---|
| 取小数 | float GetFloat(utilstringtoken unknown, float unknown)  | 查找动态时间小数值。 | 
| 取向量 | Vector GetVector(utilstringtoken unknown, Vector unknown)  | 查找动态时间向量值。 | 
造环境实体者
- 继承自 基本实体
 
 
 
 
env_entity_maker的实体类。
| 函数 | 原型 | 介绍 | 
|---|---|---|
| 生成实体 | void SpawnEntity()  | 在造者的位置创建实体。 | 
| 生成实体自实体原点 | void SpawnEntityAtEntityOrigin(handle hEntity)  | 在指定实例实体的位置创建实体。 | 
| 生成实体自位置 | void SpawnEntityAtLocation(Vector vecAlternateOrigin, Vector vecAlternateAngles)  | vecAlternateOrigin:指定生成实体的三轴坐标;vecAlternateAngles:指定生成实体的三轴角度。 | 
| 生成实体自名实体原点 | void SpawnEntityAtNamedEntityOrigin(string pszName)  | 在指定实体原点生成实体。 | 
实体脚本框架
与实体框架C++端的接口
全局访问器变量: EntityFramework
在实体脚本框架上调用。
| 函数 | 原型 | 介绍 | 
|---|---|---|
| 创建实体 | void CreateEntity(string className, handle instance)  | |
| 发令激活 | bool DispatchActivate(handle entity)  | |
| 发令输入 | bool DispatchInput(string inputName, table target,unknown args)  | |
| 发令预缓存 | void DispatchPrecache(handle entity, CScriptPrecacheContext context)  | |
| 发令生成 | void DispatchSpawn(handle entity, CScriptKeyValuesspawnkeys)  | |
| 发令更新自删除 | bool DispatchUpdateOnRemove(handle entity)  | |
| 取类名重写 | string GetClassNameOverride(string className)  | |
| 取脚本类设计器名 | string GetDesignerNameForScriptClass(string className,handle instance)  | |
| 取脚本类输入 | table GetInputsForScriptClass(string scriptClassName)  | |
| 取脚本类本地名 | string GetNativeClassForScriptClass(string scriptClassName)  | |
| 取本地类输出 | CNativeOutputs GetNativeOutputsForClass(string scriptClassName)  | |
| 取设计器名脚本类 | string GetScriptClassForDesignerName(string designerName)  | |
| 安装类 | void InstallClasses()  | 
世界层信息
info_world_layer的实体类。
| 函数 | 原型 | 介绍 | 
|---|---|---|
| 隐藏世界层 | void HideWorldLayer()  | 隐藏此图层。 | 
| 显示世界层 | void ShowWorldLayer()  | 显示此图层。 | 
逻辑中继
logic_relay的实体类。
| 函数 | 原型 | 介绍 | 
|---|---|---|
| 触发 | void Trigger(handle hActivator, handle hCaller) | 应该是让hActivator触发hCaller。 | 
标记卷
未设置描述
| 函数 | 原型 | 介绍 | 
|---|---|---|
| 有标 | bool HasTag(string pszTagName)  | 此卷是否具有给定的标记。 | 
脚本预缓存上下文
用于保存写在脚本中预缓存函数的上下文的容器。
| 函数 | 原型 | 介绍 | 
|---|---|---|
| 加资源 | void AddResource(string string_1)  | 预缓存特定资源 | 
| 取值 | variable GetValue(string key)  | 读取生成密钥。 | 
脚本键值
Container holding keyvalues published to the Spawn() hook function.
保存写到生成()挂接函数的键值的容器。
| 函数 | 原型 | 介绍 | 
|---|---|---|
| 取值 | variable GetValue(string key)  | 读取生成密钥。 | 
输出本地
用于将脚本化实体类发布的输出保存到游戏代码的容器。
| 函数 | 原型 | 介绍 | 
|---|---|---|
| 构造 | void CNativeOutputs()  | 创建新的 输出本地 对象。 | 
| 加输出 | void AddOutput(string outputName, string description)  | 添加一个输出。 | 
| 初始化 | void Init(int numOutputs)  | 使用指定数量的输出进行初始化。 | 
环境投影纹理
- 继承自 基本实体
 
 
 
 
| 函数 | 原型 | 介绍 | 
|---|---|---|
| 设远距 | void SetFarRange(float flRange)  | 设置灯光最大范围。 | 
| 设线性衰减 | void SetLinearAttenuation(float flAtten)  | 设置灯光线性衰减值。 | 
| 设近距 | void SetNearRange(float flRange)  | 设置灯光最小范围。 | 
| 设二次衰减 | void SetQuadraticAttenuation(float flAtten)  | 设置灯光二次衰减值。 | 
| 设体积光效果 | void SetVolumetrics(bool bOn, float flIntensity, float flNoise, int nPlanes, float flPlaneOffset)  | 打开或关闭体积光: bool 开启, float 强度, float 噪声, int 平面, float 平面偏移。 | 
信息数据
未设置描述
| 函数 | 原型 | 介绍 | 
|---|---|---|
| 查询颜色 | Vector QueryColor(utlstringtoken tok, Vector vDefault)  | 查询此键的颜色数据。 | 
| 查询小数 | float QueryFloat(utlstringtoken tok, float flDefault)  | 查询此键的小数数据。 | 
| 查询整数 | int QueryInt(utlstringtoken tok, int nDefault)  | 查询此键的整数数据。 | 
| 查询枚举 | float QueryNumber(utlstringtoken tok, float flDefault)  | 查询此键的枚举数据。 | 
| 查询文本 | string QueryString(utlstringtoken tok, string pDefault)  | 查询此键的文本数据。 | 
| 查询向量 | Vector QueryVector(utlstringtoken tok, Vector vDefault)  | 查询此键的向量数据。 | 
物理项
prop_physics和相关类的实体类。
| 函数 | 原型 | 介绍 | 
|---|---|---|
| 设动态与动态连续 | void SetDynamicVsDynamicContinuous(bool bIsDynamicVsDynamicContinuousEnabled) | 启用/禁用动态与动态连续冲突跟踪。 | 
| 禁用运动 | void DisableMotion()  | 为本项禁用运动。 | 
| 启用运动 | void EnableMotion()  | 为本项启用运动。 | 
辅助调试覆盖脚本
未设置描述
全局访问变量: debugoverlay
| 函数 | 原型 | 介绍 | 
|---|---|---|
| 轴 | void Axis(Vector Vector_1, Quaternion Quaternion_2, float float_3, bool bool_4, float float_5)  | 绘制一个轴。在世界空间中指定原点 + 方向。 | 
| 体 | 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)  | 绘制一个世界空间轴对齐的立方体。指定世界空间中的边界。 (我猜参数12一个是最小点的坐标、一个是最大的;3456分别是红色、绿色、蓝色、特殊值(一般用作透明度);7固定为false;8表示持续时间。) | 
| 体角度 | 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)  | 在原点绘制定向立方体。指定局部空间中的边界。(比上新增了34,一个应该是用Vector表示角度,一个使用四元数(Quaternion )表示角度) | 
| 胶囊 | 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)  | 绘制胶囊。(1是中心坐标;2是角度;34不知道(或许是弧度);后续同上) | 
| 圆 | 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)  | 画一个圆。(3也许表示半径;其余同上) | 
| 定向屏幕圆 | 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)  | 绘制一个面向屏幕的圆。 | 
| 圆锥 | 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)  | 绘制线框圆锥。(12位置角度;34圆半径圆锥高度;其余同上) | 
| 十 | 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)  | 绘制与屏幕相对的十字。(准星啊) | 
| 十3D | 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)  | 绘制与世界相对的十字。 | 
| 十3D方向 | 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)  | 绘制带有方向的十字。 | 
| 绘制刻度线 | 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)  | 绘制一条虚线。 | 
| 实体附件 | void EntityAttachments(ehandle ehandle_1, float float_2, float float_3)  | 绘制实体的附件。 | 
| 实体轴 | void EntityAxis(ehandle ehandle_1, float float_2, bool bool_3, float float_4)  | 绘制实体原点的轴。 | 
| 实体边界 | void EntityBounds(ehandle ehandle_1, int int_2, int int_3, int int_4, int int_5, bool bool_6, float float_7)  | 绘制实体的边界。 | 
| 实体骨骼 | void EntitySkeleton(ehandle ehandle_1, float float_2)  | 绘制实体的骨骼。 | 
| 实体文本 | 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)  | 在实体上绘制文本。 | 
| 填充2D矩形 | void FilledRect2D(Vector2D Vector2D_1, Vector2D Vector2D_2, int int_3, int int_4, int int_5, int int_6, float float_7)  | 在屏幕空间上直接绘制一个实心的矩形。坐标以像素为单位。 | 
| 水平箭头 | 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)  | 绘制水平箭头。 | 
| 线 | 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)  | 在两点间绘制一条线段。 | 
| 线2D | void Line2D(Vector2D Vector2D_1, Vector2D Vector2D_2, int int_3, int int_4, int int_5, int int_6, float float_7)  | 在屏幕空间中的两点间绘制一条线段。 | 
| 弹出调试覆盖域 | void PopDebugOverlayScope()  | 弹出用于对覆盖进行分组的标识符。用该标识符标记的套印格式可以大批量删除。 | 
| 推送并清除调试覆盖域 | void PushAndClearDebugOverlayScope(utlstringtoken utlstringtoken_1)  | 推送用于对覆盖进行分组的标识符。删除使用此覆盖证的所有现有覆盖。 | 
| 推送调试覆盖域 | void PushDebugOverlayScope(utlstringtoken utlstringtoken_1)  | 推送用于对覆盖进行分组的标识符。用该标识符标记的套印格式可以大批量删除。 | 
| 删除所有作用域 | void RemoveAllInScope(utlstringtoken utlstringtoken_1)  | 删除所有使用特定标识符标记的覆盖,而不管其使用寿命如何。 | 
| 实心圆锥 | 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)  | 绘制一个实心的圆锥。在世界空间中指定端点和方向。 | 
| 球 | 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)  | 绘制一个线框球。 | 
| 扫描框 | 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)  | 绘制扫掠框。指定世界空间中的端点和局部空间中的边界。 | 
| 文本 | 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)  | 绘制2d文本。 | 
| 纹理 | 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)  | 绘制一个屏幕空间纹理。以像素为单位。 | 
| 三角 | void Triangle(Vector point1, Vector point2, Vector point3, int red, int green, int blue, int alpha, bool disableDepthCheck, float seconds)  | 在世界空间中绘制一个填充的三角形,持续特定的秒数(-1表示永远存在)。 | 
| 单元测试周期叠加渲染类型 | void UnitTestCycleOverlayRenderType()  | 切换叠加渲染类型,用于单元测试。 | 
| 向量文本3D | 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)  | 绘制三维文本。指定世界空间中的原点+方向。 | 
| 垂直箭头 | 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)  | 绘制垂直箭头。指定世界空间中的端点。 | 
| 偏航箭头 | 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)  | 绘制与特定偏航相关联的箭头。指定世界空间中的端点。 | 
场景实体
- 继承自 基本实体
 
 
 
 
精心编排的场景,用于控制一个或多个演员的动画和/或对话。
| 函数 | 原型 | 介绍 | 
|---|---|---|
| 加广播组目标 | void AddBroadcastTeamTarget(int int_1)  | 将团队(按索引)添加到广播列表。 | 
| 取消 | void Cancel()  | 取消场景回放。 | 
| 估算长度 | float EstimateLength()  | 返回此场景的长度(以秒为单位)。 | 
| 寻找相机 | handle FindCamera()  | 取得相机对象。 | 
| 查找指定实体 | handle FindNamedEntity(string string_1)  | 给定实体引用(如 !target),从场景对象获取实际实体。 | 
| 为暂停 | bool IsPaused()  | 此场景当前是否已暂停。 | 
| 为播放 | bool IsPlayingBack()  | 此场景当前是否正在播放。 | 
| 从文本加载场景 | bool LoadSceneFromString(string string_1, string string_2)  | 根据给定虚拟场景名称和 VCD 文本,加载场景。 | 
| 移除广播组目标 | void RemoveBroadcastTeamTarget(int int_1)  | 从广播列表中移除团队(按索引)。 | 
| 开始 | void Start(handle handle_1)  | 开始场景播放,以激活器实体(activatorEntity )作为参数。 | 
自订游戏事件管理
未设置描述
全局访问变量: CustomGameEventManager
| 函数 | 原型 | 介绍 | 
|---|---|---|
| 注册监听 | int RegisterListener(string string_1, handle handle_2)  | (string 事件名, func 用于回调的函数) - 注册在特定自定义事件到达时要调用的回调。返回值为可用于稍后注销的监听证。 | 
| 发送_服务器到所有客户 | void Send_ServerToAllClients(string string_1, handle handle_2)  | ( string 事件名, table 事件数据) | 
| 发送_服务器到玩家 | void Send_ServerToPlayer(handle handle_1, string string_2, handle handle_3)  | ( Entity 玩家, string 事件名, table 事件数据) | 
| 发送_服务器到组 | void Send_ServerToTeam(int int_1, string string_2, handle handle_3)  | ( int 组号, string 事件名, table 事件数据) | 
| 注销监听 | void UnregisterListener(int int_1)  | ( int 监听证) - 注销特定监听。 | 
粒子系统
世界全景面板
point_clientui_world_panel的实体类。
投影在世界中设定位置的 2D 全景面板。
| 函数 | 原型 | 介绍 | 
|---|---|---|
| 接受用户输入 | void AcceptUserInput()  | 告知面板接受用户输入。 | 
| 加入css类 | void AddCSSClasses(string classes)  | 将 CSS 类添加到面板。 | 
| 忽略用户输入 | void IgnoreUserInput()  | 告知面板忽略用户输入。 | 
| 为可抓取 | void IsGrabbable()  | 返回此实体是否可抓取。 | 
| 删除css类 | void RemoveCSSClasses(string classes)  | 从面板中删除 CSS 类。 | 
点模板
point_template的实体类
| 函数 | 原型 | 介绍 | 
|---|---|---|
| 删除已创建生成组 | void DeleteCreatedSpawnGroups()  | 删除此point_template生成的任何生成组。注:point_template不会因此而被删除。 | 
| 强制生成 | void ForceSpawn()  | 生成point_template指向的所有实体。 | 
| 取生成实体 | handle GetSpawnedEntities()  | 获取最近生成的实体的列表。 | 
| 设生成回调 | void SetSpawnCallback(handle hCallbackFunc, handle hCallbackScope)  | 设置模板生成实体时的回调。生成的实体将作为数组传入。 | 
点世界文本
point_worldtext的实体类。
| 函数 | 原型 | 介绍 | 
|---|---|---|
| 设置消息 | void SetMessage(string pMessage) | 在此实体上设置消息。 | 
头显化身
prop_hmd_avatar的实体类。
| 函数 | 原型 | 介绍 | 
|---|---|---|
| 取手 | CPropVRHand GetVRHand(int nHandID)  | 根据索引(0或1)获取指定的手。 | 
灵境手部
prop_vr_hand的实体类。 表示灵境运动控制器(vr手柄)。可以使用头显化身::取手()方法为每个玩家枚举控制器。
| 函数 | 原型 | 介绍 | 
|---|---|---|
| 加手附件 | void AddHandAttachment(handle attachment)  | 将附件添加到此手上。 | 
| 加手模型覆盖 | void AddHandModelOverride(string modelName)  | 为此手添加模型覆盖。 | 
| 寻手模型覆盖 | handle FindHandModelOverride(string pModelName)  | 查找此手的特定模型覆盖。 | 
| 触发触觉脉冲 | void FireHapticPulse(int strength)  | 在这只手上发射触觉脉冲。整数强度的范围 [0, 1, 2]。 | 
| 触发触觉脉冲精确 | void FireHapticPulsePrecise(int nPulseDuration)  | 在这只手上发射触觉脉冲。以微秒为单位指定持续时间。 | 
| 取手附件 | handle GetHandAttachment()  | 得到这只手上的附件。 | 
| 取手证 | int GetHandID()  | 获取此手牌的玩家手证。 | 
| 取手字类型 | int GetLiteralHandType()  | 获取此手的文字类型。 | 
| 取玩家 | CBasePlayer GetPlayer()  | 获取此手的玩家。 | 
| 取速度 | Vector GetVelocity()  | 获取过滤后的控制器速度。 | 
| 删全手模型覆盖 | void RemoveAllHandModelOverrides()  | 删除此手的所有模型覆盖。 | 
| 删手模型覆盖按句柄 | void RemoveHandAttachmentByHandle(handle hAttachment)  | 通过句柄卸下手部附件。 | 
| 删手模型覆盖 | void RemoveHandModelOverride(string pModelName)  | 删除此手的模型覆盖。 | 
| 设手附件 | void SetHandAttachment(handle hAttachment)  | 设置这只手的附件。 | 
脚本粒子管理
允许创建和操作粒子系统。
全局访问变量: ParticleManager
| 函数 | 原型 | 介绍 | 
|---|---|---|
| 创建粒子 | int CreateParticle(string particleName, int particleAttach, handle owningEntity)  | 创建新的粒子效果。返回所创建效果的索引。 | 
| 创建玩家粒子 | int CreateParticleForPlayer(string particleName, int particleAttach, handle owningEntity, handle owningPlayer)  | 创建仅对指定玩家播放的新粒子效果。返回所创建效果的索引。 | 
| 破坏粒子 | void DestroyParticle(int particleID, bool immediately)  | 破坏粒子。 | 
| 取粒子替换 | string GetParticleReplacement(string string_1, handle handle_2)  | 未设置描述。 | 
| 释放粒子索引 | void ReleaseParticleIndex(int particleId)  | 释放指定的粒子索引。 | 
| 设粒子永模拟 | void SetParticleAlwaysSimulate(int int_1)  | 未设置描述。 | 
| 设粒子控件 | void SetParticleControl(int particleId, int controlIndex, Vector controlData)  | 为粒子效果上的控件设置控制点数据 | 
| 设粒子控件实体 | void SetParticleControlEnt(int particleId, int controlIndex, handle entity, ParticleAttachment_t attachType, string attachment, Vector origin, bool unknown)  | Attaches the control point to an entity. | 
| 设粒子控件向前 | void SetParticleControlForward(int FXIndex, int controlIndex, Vector forward)  | 在粒子效果上设置控制点的前进方向。 | 
| 设粒子控件偏移 | void SetParticleControlOffset(int iIndex, int iPoint, Vector vecOffset)  | 设置粒子效果上控件的线性偏移。 | 
| 设粒子控件方向 | void SetParticleControlOrientation(int FXIndex, int controlIndex, Vector forward, Vector right, Vector up)  | 在粒子效果上设置控制点的方向。  注意:这是左撇子!!不!! | 
| 设粒子控件方向FLU | void SetParticleControlOrientationFLU(int FXIndex, int controlIndex, Vector forward, Vector left, Vector up)  | 在粒子效果上设置控制点的方向。 | 
Steam信息
| 函数 | 原型 | 介绍 | 
|---|---|---|
| 为公共宇宙 | bool IsPublicUniverse()  | 脚本是否连接到公共 Steam 宇宙。 | 
承受伤害信息
创建承受伤害信息()返回的伤害信息句柄
| 函数 | 原型 | 介绍 | 
|---|---|---|
| 加伤害 | void AddDamage(float addAmount)  | 增加伤害值。 | 
| 加伤害类型 | void  AddDamageType(int bitsDamageType)  | 添加损坏类型位标志。 | 
| 允许友军伤害 | bool AllowFriendlyFire()  | |
| 基本伤害有效 | bool BaseDamageIsValid()  | |
| 可被阻止 | bool CanBeBlocked()  | |
| 取弹药类型 | int GetAmmoType()  | |
| 取攻击者 | CBaseEntity GetAttacker()  | Returns the attacker entity. | 
| 取基本伤害 | float GetBaseDamage()  | |
| 取伤害 | float GetDamage()  | Returns the damage value. | 
| 取自订伤害 | int GetDamageCustom()  | |
| 取伤害力度 | Vector GetDamageForce()  | Returns the damage force. | 
| 取伤害位置 | int GetDamagePosition()  | Returns the damage position. | 
| 取受到损伤 | float GetDamageTaken()  | |
| 取伤害类型 | int GetDamageType()  | Returns the damage type bitfield. | 
| 取罪犯 | CBaseEntity GetInflictor()  | Returns the inflictor entity (usually the weapon). | 
| 取最大伤害 | float GetMaxDamage()  | |
| 取原始伤害 | float GetOriginalDamage()  | |
| 取半径 | float GetRadius()  | |
| 取公布位置 | Vector GetReportedPosition()  | |
| 取伤害稳定性 | float GetStabilityDamage()  | |
| 具有伤害类型 | bool HasDamageType(int bitsToTest)  | |
| 伤害规模 | void ScaleDamage(float scaleAmount)  | |
| 设允许友军伤害 | void SetAllowFriendlyFire(bool allow)  | |
| 设弹药类型 | void SetAmmoType(intammoType)  | |
| 设攻击者 | void SetAttacker(CBaseEntity attacker)  | |
| 设可被阻止 | void SetCanBeBlocked(bool block)  | |
| 设伤害 | void SetDamage(float damage)  | Set new damage value. | 
| 设当前伤害 | void SetDamageCustom(int damageCustom)  | |
| 设伤害力度 | void SetDamageForce(Vector damageForce)  | Sets the damage force vector. | 
| 设伤害位置 | void SetDamagePosition(Vector damagePosition)  | Sets the global space damage position. | 
| 设所受伤害 | void SetDamageTaken(int damageTaken)  | |
| 设伤害类型 | void SetDamageType(int bitsDamageType)  | Set the damage type bitfield. | 
| 设最大伤害 | void SetMaxDamage(float maxDamage)  | |
| 设原始伤害 | void SetOriginalDamage(float originalDamage)  | |
| 设半径 | void SetRadius(float radius)  | |
| 设公布位置 | void SetReportedPosition(Vector reportedPosition)  | |
| 设伤害稳定性 | void SetStabilityDamage(float stabilityDamage)  | 
控制台变量
允许访问读取和修改控制台变量。
全局访问变量: Convars
| 函数 | 原型 | 介绍 | 
|---|---|---|
| 取逻辑 | table GetBool(string variableName)  | 将控制台变量转为逻辑类型返回。 | 
| 取客户 | handle GetCommandClient()  | 返回发出此控制台命令的玩家。 | 
| 取小数 | table GetFloat(string name)  | 将控制台变量转为小数类型返回。如果没有这样的变量,可能会返回 nil。 | 
| 取整数 | table GetInt(string string_1)  | 将控制台变量转为整数类型返回。如果没有这样的变量,可能会返回 nil。 | 
| 取文本 | table GetStr(string variableName)  | 将控制台变量转为文本类型返回。如果没有这样的变量,可能会返回 nil。 | 
| 注册命令 | void RegisterCommand(string variableName, handle function, string helpText, int flags)  | 在控制台注册一个命令。 | 
| 注册变量 | void RegisterConvar(string name, string defaultValue, string helpText, int flags)  | 在控制台注册一个变量。 | 
| 设逻辑 | void SetBool(string variableName, bool value)  | 将控制台变量设为逻辑值。 | 
| 取小数 | void SetFloat(string variableName, float value)  | 将控制台变量设为小数值。 | 
| 取整数 | void SetInt(string string_1, int int_2)  | 将控制台变量设为整数值。 | 
| 取文本 | void SetStr(string string_1, string string_2)  | 将控制台变量设为文本值。 | 
决策
未设置描述
| 函数 | 原型 | 介绍 | 
|---|---|---|
| 加入规则 | bool AddRule(CRule rule)  | 添加 CRule 对象(在 rulescript_base.nut 中定义) | 
| 寻找所有匹配 | 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. 返回所有匹配响应的数组。如果leeway不为零,则所有结果最接近“leeway”的都会返回。 | 
| 寻找最佳匹配 | handle FindBestMatch(handle query)  | 查询数据库并返回找到的最佳结果。如果找到相同结果的query,则返回任意一个。 | 
全局系统
用于读取启动游戏时使用的命令行参数。
全局访问变量: GlobalSys
| 函数 | 原型 | 介绍 | 
|---|---|---|
| 检查 | bool CommandLineCheck(string name)  | 如果使用命令行参数,则返回 true,否则返回 false。 | 
| 小数 | float CommandLineFloat(string name)  | 将命令行参数作为小数返回。 | 
| 整数 | int CommandLineInt(string name)  | 将命令行参数作为整数返回。 | 
| 文本 | string CommandLineStr(string name)  | 将命令行参数作为文本返回。 | 
64位无符号整数
具有二进制运算的整数。用于运动控制器按钮掩码。
| 函数 | 原型 | 介绍 | 
|---|---|---|
| 与 | int BitwiseAnd(Uint64 operand)  | 在整数间执行与。00=0;01=0;10=0;11=1 | 
| 或 | int BitwiseOr(Uint64 operand)  | 在整数间执行或。00=0;01=1;10=1;11=1 | 
| 异或 | int BitwiseXor(Uint64 operand)  | 在整数间执行异或。00=0;01=1;10=1;11=0; | 
| 取反 | int BitwiseNot(Uint64 operand)  | 不懂v社要怎么在两个整数间取反。可能是我理解错了。 | 
| 位归零 | int ClearBit(int bitvalue)  | 把指定位变为零。 | 
| 位为设 | bool IsBitSet(int bitvalue)  | 检查是否设置了位。 | 
| 位设 | int SetBit(int bitvalue)  | 设置指定的位。 | 
| 位取反 | int ToggleBit(int bitvalue)  | 0=1;1=0 | 
| 取十六 | string ToHexString()  | 返回整数的十六进制文本。 | 
角度类
关于角度的类。
函数
| 函数 | 原型 | 介绍 | 
|---|---|---|
| 构造 | QAngle(float pitch, float yaw, float roll)  | 创建一个新的角度类 | 
| + | QAngle __add(QAngle a, QAngle b)  | 就是‘+’号。将两个角度类相加。  注意:使用旋转方向()来正确旋转角度。 | 
| SteamVR/Environments/Scripting/API/QAngle.__eq | bool __eq(QAngle a, QAngle b)  | ‘==’号,判断两个角度类是否相等。 | 
| .. | string __tostring()  | ‘..’号,将角度类的数据转换为可读文本。 | 
| 正 | Vector Forward()  | 返回正向量。 | 
| 左 | Vector Left()  | 返回左向量。 | 
| 上 | Vector Up()  | 返回上向量。 | 
成员
| 变量 | 介绍 | 
|---|---|
| x  | 俯仰度。 | 
| y  | 偏航度。 | 
| z  | 翻滚度。 | 
四元数类
关于四元数的类。
全局访问变量: 没有
 错误: 此类已损坏,无法实例化。
错误: 此类已损坏,无法实例化。向量
关于三维向量的类
函数
| 函数 | 原型 | 介绍 | 
|---|---|---|
| 构造 | Vector(float x, float y, float z)  | 使用指定的直角系坐标创建新向量。 | 
| + | Vector __add(Vector a, Vector b)  | ‘+’号,将两个向量相加。 | 
| / | Vector __div(Vector a, Vector b)  | ‘/’号,将两个向量相除。 | 
| Dota 2 Workshop Tools/Scripting/API/Vector.__eq | bool __eq(Vector a, Vector b)  | ‘==’号,判断两个向量是否相等。 | 
| # | float __len()  | ‘#’号,返回向量的长度。 | 
| * | Vector __mul(Vector a, Vector b)  | ‘*’号,将两个向量相乘,也可与标量相乘。 | 
| - | Vector __sub(Vector a, Vector b)  | ‘-’号,将两个变量相减。 | 
| .. | string __tostring()  | ‘..’号,将向量转为文本。 | 
| - | Vector __unm()  | ‘-’号,进行向量取反。 | 
| 叉积 | Vector Cross(Vector a, Vector b)  | 返回两向量的叉积。 | 
| 点积 | float Dot(Vector a, Vector b)  | 返回两向量的点积。 | 
| 长度 | float Length()  | 返回向量的长度。 | 
| 长度2D | float Length2D()  | 返回向量在2Dxy平面中的长度。 | 
| 线插 | Vector Lerp(Vector target, float t)  | 向量和target 之间的线性插值在 t = [0,1] 上。 | 
| 归一化 | Vector Normalized()  | 返回规范化的向量。 | 
成员
| 变量 | 介绍 | 
|---|---|
| x  | X轴 | 
| y  | Y轴 | 
| z  | Z轴 | 
枚举
模拟输入信号
用于 玩家实体:取手模拟动作位置()。这些映射到SteamVR绑定菜单中的操作。
 注意:游戏中尚不存在这些枚举。
注意:游戏中尚不存在这些枚举。| 名字 | 值 | 类型 | 行为 | 介绍 | 
|---|---|---|---|---|
| 0 | 手 | 手弯曲 | X轴 | |
| 1 | 手 | 扳机扣动 | X轴 | |
| 2 | 互动 | 挤压Xen手榴弹 | X轴 | |
| 3 | 移动 | 瞬间转动 | 需要 X, Y轴 待完善: 这些总是同时提供拇指摇杆轴吗? | |
| 4 | 移动 | 持续转动 | X, Y轴 待完善: 这些总是同时提供拇指摇杆轴吗? | 
控制器类型
玩家实体:取控制类型()返回的玩家控制器类型。
 警告:脚本环境中缺少枚举。
警告:脚本环境中缺少枚举。| 名称 | 值 | 介绍 | 
|---|---|---|
| (VR_CONTROLLER_TYPE_UNKNOWN) | 0 | 未知 | 
| (VR_CONTROLLER_TYPE_X360) | 1 | x360 | 
| (VR_CONTROLLER_TYPE_VIVE) | 2 | vive | 
| (VR_CONTROLLER_TYPE_TOUCH) | 3 | Oculus Touch | 
| (VR_CONTROLLER_TYPE_RIFT_S) | 4 | oculus rifts | 
| 5 | 待完善:  未知,没有可用的枚举。 | |
| (VR_CONTROLLER_TYPE_KNUCKLES) | 6 | v社的指虎手柄 | 
| (VR_CONTROLLER_TYPE_WINDOWSMR) | 7 | Windows MR | 
| (VR_CONTROLLER_TYPE_WINDOWSMR_SAMSUNG) | 8 | Windows MR | 
| (VR_CONTROLLER_TYPE_GENERIC_TRACKED) | 9 | 通用 | 
| (VR_CONTROLLER_TYPE_COSMOS) | 10 | Vive Cosmos | 
数字输入信号
玩家实体:手是否作了行为需要的参数。这些映射到 SteamVR 绑定菜单中的操作。
 注意:游戏中尚不存在这些枚举。
注意:游戏中尚不存在这些枚举。| 值 | 类型 | 行为 | 介绍 | |
|---|---|---|---|---|
| 0 | 菜单 | 切换菜单 | 必填 | |
| 1 | 菜单 | 交互菜单 | 必填 | |
| 2 | 菜单 | 关闭菜单 | 必填 | |
| 3 | 互动 | 使用 | 必填 | |
| 4 | 互动 | 使用握把 | ||
| 5 | 武器 | 显示背包 | 必填 | |
| 6 | 互动 | 重力手套锁 | 必填 | |
| 7 | 武器 | 开火 | 必填 | |
| 8 | 武器 | 爆炸开火 | ||
| 9 | 武器 | 装弹 | 必填 | |
| 10 | 武器 | 弹出弹匣 | 必填 | |
| 11 | 武器 | 套筒释放 | 必填 | |
| 12 | 武器 | 开膛 | 必填 | |
| 13 | 武器 | 切换激光瞄准器 | ||
| 14 | 武器 | 切换开火模式 | 必填 | |
| 15 | 互动 | 切换回血针 | 必填 | |
| 16 | 互动 | 装备手雷 | 必填 | |
| 17 | 互动 | 装备xen手雷 | 必填 | |
| 18 | 移动 | 传送 | 必填 | |
| 19 | 移动 | 左转 | ||
| 20 | 移动 | 右转 | ||
| 21 | 移动 | 后退 | ||
| 22 | 移动 | 走 | ||
| 23 | 移动 | 跳 | ||
| 24 | 移动 | Mantle | ||
| 25 | 移动 | 切换下蹲 | ||
| 26 | 移动 | 切换站立 | ||
| 27 | 移动 | 调整高度 | 
激活类型
Passed to the Activate() hook function.
激活()挂接函数所需的参数。
| 名称 | 值 | 介绍 | 
|---|---|---|
| ACTIVATE_TYPE_INITIAL_CREATION | 0 | 在创建实体后调用函数。 | 
| ACTIVATE_TYPE_DATAUPDATE_CREATION | 1 | [待完善] | 
| ACTIVATE_TYPE_ONRESTORE | 2 | 从保存的游戏还原实体后调用函数。 | 
伤害类型
| 名称 | 值 | 介绍 | 
|---|---|---|
| DMG_GENERIC | 0 0b00 | 通用 | 
| DMG_CRUSH | 1 0b01 | 碾压 | 
| DMG_BULLET | 2 0b010 | 子弹 | 
| DMG_SLASH | 4 0b0100 | 挥砍 | 
| DMG_BURN | 8 0b0100 0 | 燃烧 | 
| DMG_VEHICLE | 16 0b0100 00 | 载具 | 
| DMG_FALL | 32 0b0100 000 | 跌落 | 
| DMG_BLAST | 64 0b0100 0000 | 爆炸 | 
| DMG_CLUB | 128 0b0100 0000 0 | 棍击 | 
| DMG_SHOCK | 256 0b0100 0000 00 | 冲击 | 
| DMG_SONIC | 512 0b0100 0000 000 | 声波 | 
| DMG_ENERGYBEAM | 1024 0b0100 0000 0000 | 能源 | 
| DMG_PREVENT_PHYSICS_FORCE | 2048 0b0100 0000 0000 0 | 防止物理力 | 
| DMG_NEVERGIB | 4096 0b0100 0000 0000 00 | |
| DMG_ALWAYSGIB | 8192 0b0100 0000 0000 000 | |
| DMG_DROWN | 16384 0b0100 0000 0000 0000 | 淹没 | 
| DMG_PARALYZE | 32768 0b0100 0000 0000 0000 0 | 麻痹 | 
| DMG_NERVEGAS | 65536 0b0100 0000 0000 0000 00 | 神经性 | 
| DMG_POISON | 131072 0b0100 0000 0000 0000 000 | 毒药 | 
| DMG_RADIATION | 262144 0b0100 0000 0000 0000 0000 | 辐射 | 
| DMG_DROWNRECOVER | 524288 0b0100 0000 0000 0000 0000 0 | 溺水 | 
| DMG_ACID | 1048576 0b0100 0000 0000 0000 0000 00 | 酸 | 
| DMG_SLOWBURN | 2097152 0b0100 0000 0000 0000 0000 000 | 缓慢燃烧 | 
| DMG_REMOVENORAGDOLL | 4194304 0b0100 0000 0000 0000 0000 0000 | 不移除布娃娃 | 
| DMG_PHYSGUN | 8388608 0b0100 0000 0000 0000 0000 0000 0 | 物理枪 | 
| DMG_PLASMA | 16777216 0b0100 0000 0000 0000 0000 0000 00 | 等离子体 | 
| DMG_AIRBOAT | 33554432 0b0100 0000 0000 0000 0000 0000 000 | 汽船 | 
| DMG_DISSOLVE | 67108864 0b0100 0000 0000 0000 0000 0000 0000 | 溶解 | 
| DMG_BLAST_SURFACE | 134217728 0b0100 0000 0000 0000 0000 0000 0000 0 | 爆破面 | 
| DMG_DIRECT | 268435456 0b0100 0000 0000 0000 0000 0000 0000 00 | 直接 | 
| DMG_BUCKSHOT | 536870912 0b0100 0000 0000 0000 0000 0000 0000 000 | 霰弹枪、长臂猎头蟹伤害。 | 
粒子附着
| 名称 | 值 | 介绍 | 
|---|---|---|
| PATTACH_INVALID | -1 | 无效 | 
| PATTACH_ABSORIGIN | 0 | 在实体原点生成。 | 
| PATTACH_ABSORIGIN_FOLLOW | 1 | 跟随实体原点。 | 
| PATTACH_CUSTOMORIGIN | 2 | 自定义原点 | 
| PATTACH_CUSTOMORIGIN_FOLLOW | 3 | 跟随自定义原点 | 
| PATTACH_POINT | 4 | 在实体附着点生成。 | 
| PATTACH_POINT_FOLLOW | 5 | 跟随实体附着点。 | 
| PATTACH_EYES_FOLLOW | 6 | 跟随眼 | 
| PATTACH_OVERHEAD_FOLLOW | 7 | 跟随头部 | 
| PATTACH_WORLDORIGIN | 8 | 在地图中心生成。 | 
| PATTACH_ROOTBONE_FOLLOW | 9 | 跟随骨骼根。 | 
| PATTACH_RENDERORIGIN_FOLLOW | 10 | 跟随渲染原点。 | 
| (PATTACH_MAIN_VIEW) | 11 | 主视图。环境中缺少枚举。 | 
| (PATTACH_WATERWAKE) | 12 | 水流尾。环境中缺少枚举。 | 
| (PATTACH_CENTER_FOLLOW) | 13 | 跟随中心。环境中缺少枚举。 | 
| (PATTACH_CUSTOM_GAME_STATE_1) | 14 | 自订游戏状态1。环境中缺少枚举。 | 
| MAX_PATTACH_TYPES | 15 | 最大粒子类型 | 
参见
外部链接




























