Zh/List of CS:GO Script Functions
这份清单包含了
Counter-Strike: Global Offensive 中的与引擎相关的可用于VScript的Squirrel类、函数以及 可用的变量。加载一个地图然后执行
script_help
,并且将developer
的值设置为至少1, 可以把这份清单中的部分内容显示于控制台中。 值得一提的是,developer
只要不为0,且加载了任意的地图, 就可以把script_help
指令所显示的内容转存到文件中。步骤如下(请一步一步地在控制台中键入每一行指令):
developer 3
map de_nuke
developer 0
con_logfile dump.txt
script_help
con_logfile ""
变量
实例 | 类型 | 描述 |
---|---|---|
Entities
|
CEntities
|
提供一个对当前已生成的实体的访问方式. |
常量
实例 | 类型 | 描述 |
---|---|---|
_charsize_
|
integer | |
_floatsize_
|
integer | |
_intsize_
|
integer | |
_version_
|
string | Squirrel的版本号. |
_versionnumber_
|
integer | Squirrel的版本号的整数形式. |
RAND_MAX
|
integer |
类
CBaseEntity
CBaseEntity是实体的脚本句柄类. 所有已生成的实体都有一个使用CBaseEntity或者其子类的的脚本句柄.
所有游戏中的脚本句柄都可以从Entities中访问. 实体脚本可以通过 self
来访问它们自身的脚本句柄.
Methods
函数 | 签名 | 描述 |
---|---|---|
__KeyValueFromInt
|
void __KeyValueFromInt(string key, int value)
|
以整数设置实体的键值(KeyValue). 这个函数只修改数值而不执行实体处理KeyValue所需要的任何代码, 所以可能会有令人意想不到的副作用. |
__KeyValueFromFloat
|
void __KeyValueFromFloat(string key, float value)
|
以浮点数设置实体的KeyValue. 这个函数只修改数值而不执行实体处理KeyValue所需要的任何代码, 所以可能会有令人意想不到的副作用. |
__KeyValueFromString
|
void __KeyValueFromString(string key, string value)
|
以字符串设置实体的KeyValue. 这个函数只修改数值而不执行实体处理KeyValue所需要的任何代码, 所以可能会有令人意想不到的副作用. |
__KeyValueFromVector
|
void __KeyValueFromVector(string key, Vector value)
|
以向量(Vector)设置实体的KeyValue. 这个函数只修改数值而不执行实体处理KeyValue所需要的任何代码, 所以可能会有令人意想不到的副作用. |
ConnectOutput
|
void ConnectOutput(string output, string function)
|
添加一个I/O关联, 当指定的输出触发时将调用指定的函数. |
DisconnectOutput
|
void DisconnectOutput(string output, string function)
|
从I/O事件中删除一个已关联的脚本函数. |
Destroy
|
void Destroy()
|
删除实体. |
EmitSound
|
void EmitSound(string soundScript)
|
在这个实体上播放声音. |
entindex
|
int entindex()
|
返回实体的索引. |
EyePosition
|
Vector EyePosition()
|
获取眼睛位置的向量(备注:绝对坐标). |
FirstMoveChild
|
handle FirstMoveChild()
|
无 |
GetAngles
|
Vector GetAngles()
|
以向量形式获取实体的章动角(pitch)、进动角(yaw)和自转角(roll). |
GetAngularVelocity
|
Vector GetAngularVelocity()
|
获取实体的角速度(备注:返回pitch、yaw、roll的向量). |
GetBoundingMaxs
|
Vector GetBoundingMaxs()
|
将实体边界框的最大范围以向量返回。 |
GetBoundingMins
|
Vector GetBoundingMins()
|
将实体边界框的最小范围以向量返回. |
GetCenter
|
Vector GetCenter()
|
返回边界框中心位置的向量. |
GetClassname
|
string GetClassname()
|
返回实体的种类名. (备注:包含player ).
|
GetForwardVector
|
Vector GetForwardVector()
|
返回实体的前向量. |
GetHealth
|
int GetHealth()
|
返回实体当前的生命值. |
GetLeftVector
|
Vector GetLeftVector()
|
返回实体的左向量. |
GetMaxHealth
|
int GetMaxHealth()
|
返回实体的最大生命值. |
GetModelKeyValues
|
Keyvalues GetModelKeyValues()
|
返回实体模型的[$keyvalues]块作为一个#Keyvalues对象. 请注意, 这并非实体自身的keyvalues. |
GetModelName
|
string GetModelName()
|
返回实体模型的文件名. |
GetMoveParent
|
CBaseEntity GetMoveParent()
|
如果实体位于层次结构(hierarchy)中, 检索实体的父级(parent). |
GetName
|
string GetName()
|
返回实体的targetname. |
GetOrigin
|
Vector GetOrigin()
|
返回实体的位置. |
GetOwner
|
handle GetOwner()
|
获取实体的所有者(owner). (备注:似乎只有当需要在这个实体上使用SetOwner()时这个函数才有用, 可能也不尽然) |
GetPreTemplateName
|
string GetPreTemplateName()
|
获取去除独特模版装饰的实体名. |
GetRootMoveParent
|
handle GetRootMoveParent()
|
如果实体位于层次结构中,顺着层次结构检索实体的根父级. |
GetScriptId
|
string GetScriptId()
|
检索用于引用脚本系统中的实体的唯一标识符. |
GetScriptScope
|
handle GetScriptScope()
|
检索存储与此实体关联的实体脚本数据的表. |
GetSoundDuration
|
float GetSoundDuration(string soundName, string actorModelName = "")
|
以浮点数返回声音的持续时间. (备注:采用"soundName"和可选的"actorModelName"作为搜索参数) |
GetTeam
|
int GetTeam()
|
返回玩家的队伍. (备注:观察者 = 1, 恐怖分子 = 2, 反恐精英 = 3). |
GetUpVector
|
Vector GetUpVector()
|
获取实体的顶向量. |
GetVelocity
|
Vector GetVelocity()
|
返回实体的速度向量. |
IsValid
|
bool IsValid()
|
句柄是否属于有效的实体. |
NextMovePeer
|
handle NextMovePeer()
|
无 |
PrecacheModel
|
void PrecacheModel(string modelPath)
|
在地图加载完成后预缓存一个模型. |
PrecacheScriptSound
|
void PrecacheScriptSound(string soundName)
|
无 |
PrecacheSoundScript
|
void PrecacheSoundScript(string soundScript)
|
预缓存一个将会被播放的声音. |
SetAbsOrigin
|
void SetAbsOrigin(Vector position)
|
与SetOrigin()功能相同. |
SetAngles
|
void SetAngles(float pitch, float yaw, float roll)
|
设置实体的pitch, yaw, roll. 请注意, 这里并不使用向量. |
SetAngularVelocity
|
void SetAngularVelocity(float pitch, float yaw, float roll)
|
设置实体的角速度.(备注:采用pitch, yaw和roll的浮点数形式的角速度). |
SetForwardVector
|
void SetForwardVector(Vector forwardVector)
|
设置实体的前向量. |
SetHealth
|
void SetHealth(int newHealth)
|
设置实体的生命值. |
SetMaxHealth
|
void SetMaxHealth(int maxHealth)
|
设置实体的最大生命值. |
SetModel
|
void SetModel(string modelName)
|
改变实体的模型, 这个函数并不预缓存模型! 待完善: 检查副作用
|
SetOrigin
|
void SetOrigin(Vector position)
|
将实体移动到指定位置. |
SetOwner
|
void SetOwner(handle owner)
|
设置实体的所有者. |
SetSize
|
void SetSize(Vector, Vector)
|
无 |
SetTeam
|
void SetTeam(int teamNumber)
|
立即转换玩家的团队. (备注:观察者 = 1, 恐怖分子 = 2, 反恐精英 = 3) |
SetVelocity
|
void SetVelocity(Vector velocity)
|
设置实体的速度向量. |
ValidateScriptScope
|
bool ValidateScriptScope()
|
实体的脚本数据是否已被创建. |
Hooks
如果其中一个函数在实体脚本中被声明, 实体将在适当的情况下自动运行此函数.
函数 | 签名 | 描述 |
---|---|---|
InputInputName
|
bool InputInputName()
|
当实体从I/O系统中接收到输入时调用. 此函数的名称必须是实体input列表中的Input , 例如表示FireUser1的InputFireUser1 . 当这个函数被调用时, 激活和调用的实体的脚本句柄会被写入接收输入的实体的脚本数据的activator 和caller 变量中. 这个函数必须返回一个布尔值. 将布尔值设定为true 允许实体来处理输入, 否则用false 阻止之.
|
OnPostSpawn
|
void OnPostSpawn()
|
在实体生成时立即被调用. 这个函数可以用于让实体向主脚本注册自身,或以编程方式调整实体参数. |
Precache
|
void Precache()
|
在脚本执行后调用. 可用于在地图加载时调用模型和声音的预缓存函数. |
CBaseAnimating
Extends CBaseEntity
动画实体(如props)的脚本句柄类.
Methods
函数 | 签名 | 描述 |
---|---|---|
GetAttachmentAngles
|
Vector GetAttachmentAngles(int id)
|
以pitch, yaw, roll向量的形式获取附件ID的角度. |
GetAttachmentOrigin
|
Vector GetAttachmentOrigin(int 'id')
|
获取附件ID的位置向量. |
IsSequenceFinished
|
bool IsSequenceFinished()
|
主序列是否已经播放完成. |
LookupAttachment
|
int LookupAttachment(string attachmentName)
|
获取指定名字的附件ID. |
SetBodygroup
|
void SetBodygroup(int groupIndex, int value)
|
通过索引设置模型的bodygroup的值. 待完善: 要如何找到索引?
|
CBaseFlex
Extends CBaseAnimating
Methods
函数 | 签名 | 描述 |
---|---|---|
GetCurrentScene
|
handle GetCurrentScene()
|
返回最早的活动场景实体的实例 (备注:如果有的话). |
GetSceneByIndex
|
handle GetSceneByIndex(int index)
|
返回制定索引的场景实体的实例. |
CBasePlayer
Extends CBaseAnimating
Methods
函数 | 签名 | 描述 |
---|---|---|
IsNoclipping
|
bool IsNoclipping()
|
玩家是否处于noclip状态. |
CBaseMultiplayerPlayer
Extends CBasePlayer
CSGO玩家的脚本句柄类,无附带方法。
CEnvEntityMaker
Extends CBaseEntity
env_entity_maker的脚本句柄类.
Methods
函数 | 签名 | 描述 |
---|---|---|
SpawnEntity
|
void SpawnEntity()
|
在制造器的位置上创建一个实体 |
SpawnEntityAtEntityOrigin
|
void SpawnEntityAtEntityOrigin(CBaseEntity entity)
|
在指定实体实例的位置上创建一个实体. |
SpawnEntityAtLocation
|
void SpawnEntityAtLocation(Vector origin, Vector orientation)
|
在指定的位置和方向上创建一个实体,方向为以度为单位的欧拉角(pitch, yaw, roll). |
SpawnEntityAtNamedEntityOrigin
|
void SpawnEntityAtNamedEntityOrigin(string targetName)
|
在一个指定名字的实体的位置上创建一个实体。 |
CPointTemplate
Extends CBaseEntity
point_template的脚本句柄类.
Hooks
table PreSpawnInstance(string entityClass, string entityName)
- 如果定义了此Hook,它将在实体创建之前被调用,并且返回的任何KeyValues都将被分配给该实体。
function PreSpawnInstance( entityClass, entityName )
{
local keyvalues =
{
rendercolor = "0 255 0"
targetname = "mySpawnedEntity"
}
return keyvalues
}
void PostSpawn(table entities)
- 在实体生成后调用. 具有按名称索引的已生成的实体句柄的表被传递给该函数. 可以使用它来关联输出或在创建实体后做任何你想做的事情.
function PostSpawn( entities )
{
foreach( name, handle in entities )
{
printl( name + ": " + handle )
}
}
CSceneEntity
Extends CBaseEntity
Methods
函数 | 签名 | 描述 |
---|---|---|
AddBroadcastTeamTarget
|
void AddBroadcastTeamTarget(int index)
|
添加一个队伍(通过索引)到广播列表中. |
EstimateLength
|
float EstimateLength()
|
以秒为单位返回此场景的长度. |
FindNamedEntity
|
handle FindNamedEntity(string reference)
|
给定一个实体参照, 比如 !target, 以从场景对象中获取真正的实体. |
IsPaused
|
bool IsPaused()
|
这个场景是否暂停. |
IsPlayingBack
|
bool IsPlayingBack()
|
这个场景是否正在播放. |
LoadSceneFromString
|
bool LoadSceneFromString(string sceneName, string scene)
|
给定一个虚拟的场景名和vcd的字符串, 以加载场景. |
RemoveBroadcastTeamTarget
|
void RemoveBroadcastTeamTarget(int index)
|
从广播列表中删除一个队伍(通过索引). |
CTriggerCamera
Extends CBaseEntity
Methods
函数 | 签名 | 描述 |
---|---|---|
GetFov
|
int GetFov()
|
以整数获取当前相机的FOV设置. |
SetFov
|
void SetFov(int fov, float rate)
|
用整数的度数设置相机的FOV, 用浮点数设置FOV的变化率. |
Hooks
void ScriptStartCameraShot(string shotType, handle sceneEntity, handle actor1, handle actor2, float duration)
- 由SceneEntity调用以响应由一个VCD发送来的CChoreoEvent::CAMERA. [待完善]
CCallChainer
[待完善]
Methods
函数 | 签名 | 描述 |
---|---|---|
constructor
|
[待完善] constructor()
|
|
PostScriptExecute
|
[待完善] PostScriptExecute()
|
|
Call
|
[待完善] Call()
|
成员
Instance | Type | Description |
---|---|---|
chains
|
null
|
|
prefix
|
null
|
|
scope
|
null
|
CEntities
Game Instance: Entities
An interface to find and iterate over the script handles for the entities in play.
To iterate over a set of entities, pass null
to the previous argument in the appropriate method to start an iteration, or reference to a previously found entity to continue a search.
Methods
Function | Signature | Description |
---|---|---|
CreateByClassname
|
handle CreateByClassname(string class)
|
Creates an entity by class name. |
FindByClassname
|
handle FindByClassname(handle previous, string class)
|
Find entities by class name. |
FindByClassnameNearest
|
handle FindByClassnameNearest(string class, Vector origin, float radius)
|
Find the entity with the given class name nearest to the specified point. |
FindByClassnameWithin
|
handle FindByClassnameWithin(handle previous, string class, Vector origin, float radius)
|
Find entities by class name within a radius. |
FindByModel
|
handle FindByModel(handle previous, string filename)
|
Find entities by model name. |
FindByName
|
handle FindByName(handle previous, string name)
|
Find entities by name. |
FindByNameNearest
|
handle FindByNameNearest(string name, Vector origin, float radius)
|
Find entities by name nearest to a point. |
FindByNameWithin
|
handle FindByNameWithin(handle previous, string name, Vector origin, float radius)
|
Find entities by name within a radius. |
FindByTarget
|
handle FindByTarget(handle previous, string targetname)
|
Find entities by its target. |
FindInSphere
|
handle FindInSphere(handle previous, Vector origin, float radius)
|
Find entities within a radius. |
First
|
handle First()
|
Begin an iteration over the list of entities. |
Next
|
handle Next(handle previous)
|
Continue an iteration over the list of entities, providing reference to a previously found entity. |
IsValid
|
bool IsValid()
|
Whether the handle belongs to a valid entity. |
CPlayerVoiceListener
Methods
Function | Signature | Description |
---|---|---|
GetPlayerSpeechDuration
|
float GetPlayerSpeechDuration(int)
|
Returns the number of seconds the player has been continuously speaking. |
IsPlayerSpeaking
|
bool IsPlayerSpeaking(int)
|
Returns whether the player specified is speaking. |
IsValid
|
bool IsValid()
|
Whether the handle belongs to a valid entity. |
CScriptKeyValues
Script handle representation of a models $keyvalues block. Sub keys are instances of the same class.
Methods
Function | Signature | Description |
---|---|---|
constructor
| ||
FindKey
|
CScriptKeyValues FindKey(string keyName)
|
Find a sub key by the key name. |
GetFirstSubKey
|
CScriptKeyValues GetFirstSubKey()
|
Return the first sub key object. |
GetKeyBool
|
bool GetKeyBool(string keyName)
|
Return the key value as a bool. |
GetKeyFloat
|
float GetKeyFloat(string keyName)
|
Return the key value as a float. |
GetKeyInt
|
int GetKeyInt(string keyName)
|
Return the key value as an integer. |
GetKeyString
|
string GetKeyString(string keyName)
|
Return the key value as a string. |
GetNextKey
|
handle GetNextKey()
|
Return the next neighbor key object to the one the method is called on. |
IsKeyEmpty
|
bool IsKeyEmpty(string keyName)
|
Returns true if the named key has no value. |
IsValid
|
bool IsValid()
|
Whether the handle belongs to a valid entity. |
ReleaseKeyValues
|
void ReleaseKeyValues()
|
Releases the contents of the instance. |
CSimpleCallChainer
Seems to have the same members as CCallChainer. [待完善]
LateBinder
Late binding: allows a table to refer to parts of itself, it's children, it's owner, and then have the references fixed up after it's fully parsed.
// Usage:
lateBinder <- LateBinder();
lateBinder.Begin( this );
Test1 <-
{
Foo=1
}
Test2 <-
{
FooFoo = "I'm foo foo"
BarBar="@Test1.Foo"
SubTable = { boo=[bah, "@Test2.FooFoo", "@Test1.Foo"], booboo2={one=bah, two="@Test2.FooFoo", three="@Test1.Foo"} }
booboo=[bah, "@Test2.FooFoo", "@Test1.Foo"]
booboo2={one=bah, two="@Test2.FooFoo", three="@Test1.Foo"}
bah=wha
}
lateBinder.End();
delete lateBinder;
When End() is called, all of the unresolved symbols in the tables and arrays will be resolved, any left unresolved will become a string prepended with '~', which later code can deal with.
Methods
Function | Signature | Description |
---|---|---|
Begin
| ||
End
| ||
EstablishDelegation
| ||
HookRootMetamethod
| ||
Log
| ||
m_bindNamesStack
| ||
m_fixupSet
| ||
m_log
| ||
m_logIndent
| ||
m_targetTable
| ||
RemoveDelegation
| ||
Resolve
| ||
UnhookRootMetamethod
|
regexp
The built-in Squirrel class for regular expressions.
Methods
Function | Signature | Description |
---|---|---|
constructor
|
regexp()
|
|
capture
|
[table] capture(str, [start])
|
Returns an array of tables containing two indexes("begin" and "end")of the first match of the regular expression in the string str. An array entry is created for each captured sub expressions. If no match occurs returns null. The search starts from the index start of the string, if start is omitted the search starts from the beginning of the string. |
match
|
bool match(str)
|
Returns a true if the regular expression matches the string str, otherwise returns false. |
search
|
table search(str, [start])
|
Returns a table containing two indexes("begin" and "end") of the first match of the regular expression in the string str, otherwise if no match occurs returns null. The search starts from the index start of the string, if start is omitted the search starts from the beginning of the string. |
subexpcount
|
Vector
Squirrel equivalent of the C++ Vector class.
Three-dimensional vector.
Has overloaded arithmetic operations with both Vectors and scalar values.

Methods
Function | Signature | Description |
---|---|---|
constructor
|
Vector(float x, float y, float z)
|
Creates a new vector with the specified Cartesian coordiantes. |
Cross
|
float Cross(Vector factor)
|
The vector product of two vectors. Returns a vector orthogonal to the input vectors. |
Dot
|
float Dot(Vector factor)
|
The scalar product of two vectors. |
Length
|
float Length()
|
Magnitude of the vector. |
LengthSqr
|
float LengthSqr()
|
The magnitude of the vector squared. Faster than the above method. |
Length2D
|
float Length2D()
|
Returns the magnitude of the vector on the x-y plane. |
Length2DSqr
|
float Length2DSqr()
|
Returns the square of the magnitude of the vector on the x-y plane. Faster than the above method. |
Norm
|
float Norm()
|
Will return the vector length as a float. This function will also NORMALIZE the vector, the X, Y, and Z values will each be set to a number between -1 and 1. You can then multiply these values by, for example, 3000 to use the vector to set the velocity of something in game. |
ToKVString
|
string ToKVString()
|
Returns a string without separations commas. |
Members
Instance | Type | Description |
---|---|---|
x
|
float
|
Cartesian X axis. |
y
|
float
|
Cartesian Y axis. |
z
|
float
|
Cartesian Z axis. |
Global functions
Printing and Drawing
Function | Signature | Description |
---|---|---|
DebugDrawBox
|
void DebugDrawBox(vector origin, vector min, vector max, int r, int g, int b, int alpha, float duration)
|
Draw a debug overlay box. |
DebugDrawLine
|
void DebugDrawLine(Vector start, Vector end, int red, int green, int blue', bool zTest, float time)
|
Draw a debug line between two points. |
Msg
|
void Msg(string message)
|
Equivalent to print
|
print
|
void print(string message)
|
Prints the given message to the developer console. |
printl
|
void printl(string message)
|
Prints the given message to the developer console just like print but also appends a newline. |
ScriptPrintMessageCenterAll
|
void ScriptPrintMessageCenterAll(string message)
|
Prints an alert message in the center of the screen to all players. |
ScriptPrintMessageCenterTeam
|
void ScriptPrintMessageCenterTeam(int, string)
|
Prints an alert message in the center of the screen to the specified team. |
ScriptPrintMessageChatAll
|
void ScriptPrintMessageChatAll(string message)
|
Prints a message in chat to all players. |
ScriptPrintMessageChatTeam
|
void ScriptPrintMessageChatTeam(int teamNumber, string message)
|
Prints a message in chat to the specified team. |
ShowMessage
|
void ShowMessage(string)
|
Print a hud message on all clients. ![]() |
__DumpScope
|
void __DumpScope(int indentation, handle scope)
|
Dumps contents of everything in the scope. |
Function | Signature | Description |
---|---|---|
ScriptGetBestTrainingCourseTime
|
int ScriptGetBestTrainingCourseTime()
|
Gets the player's best time for completing the timed course. |
ScriptGetPlayerCompletedTraining
|
bool ScriptGetPlayerCompletedTraining()
|
Returns true if the player has completed the initial portion of the training map. |
ScriptGetValveTrainingCourseTime
|
int ScriptGetValveTrainingCourseTime()
|
Gets Valve's best time for completing the timed course. |
ScriptHighlightAmmoCounter
|
void ScriptHighlightAmmoCounter()
|
Sends an event that is just used by the instructor system to show a hint highlighting the ammo counter. |
ScriptSetBestTrainingCourseTime
|
void ScriptSetBestTrainingCourseTime(int bestTime)
|
Sets the player's best time for completing the timed course. |
ScriptSetMiniScoreHidden
|
void ScriptSetMiniScoreHidden(bool scoreHidden)
|
Toggles the visibility of the miniscoreboard hud element. |
ScriptSetPlayerCompletedTraining
|
void ScriptSetPlayerCompletedTraining(bool trainingCompleted)
|
Sets whether the player has completed the initial portion of the training map. |
ScriptShowExitDoorMsg
|
void ScriptShowExitDoorMsg()
|
Shows a message box in trainign when the player exits through the exit door |
ScriptShowFinishMsgBox
|
void ScriptShowFinishMsgBox()
|
Shows a message box to let players know what to do next after finishing the training course. |
ScriptTrainingGivePlayerAmmo
|
void ScriptTrainingGivePlayerAmmo()
|
Refills ammo to max for all weapons the player has (only works in training). |
Function | Signature | Description |
---|---|---|
ScriptCoopCollectBonusCoin
|
void ScriptCoopCollectBonusCoin()
|
Marks one of the bonus coins as collected. |
ScriptCoopGiveC4sToCTs
|
void ScriptCoopGiveC4sToCTs(int)
|
Will give the number of specified C4s to all alive CT players. |
ScriptCoopMissionGetMissionNumber
|
int ScriptCoopMissionGetMissionNumber()
|
Gets the mission number for the current map - maps can have multiple missions on them. |
ScriptCoopMissionRespawnDeadPlayers
|
void ScriptCoopMissionRespawnDeadPlayers()
|
Respawns players only. |
ScriptCoopMissionSetNextRespawnIn
|
void ScriptCoopMissionSetNextRespawnIn(float, bool)
|
Set the next respawn wave to happen in this many seconds. |
ScriptCoopMissionSpawnFirstEnemies
|
void ScriptCoopMissionSpawnFirstEnemies(int)
|
Spawns the first wave of enemies in coop. |
ScriptCoopMissionSpawnNextWave
|
void ScriptCoopMissionSpawnNextWave(int)
|
Tells the next wave of enemies to spawn in coop. Also respawns player. |
ScriptCoopResetRoundStartTime
|
void ScriptCoopResetRoundStartTime()
|
Resets the round time and starts the mission. |
ScriptCoopSetBotQuotaAndRefreshSpawns
|
void ScriptCoopSetBotQuotaAndRefreshSpawns(int)
|
Sets the bot quota considering the # of players connected and refreshes the spawns. |
Other
Function | Signature | Description |
---|---|---|
Assert
|
void Assert(bool value, string optional message)
|
Test value and if not true, throws exception, optionally with message. |
CreateProp
|
handle CreateProp(string class, Vector origin, string model, int animation)
|
Create a prop with the specified class and model. Both prop_physics, prop_dynamic as well as some other entity classes with models work. Does not precache the model. ![]() |
CreateSceneEntity
|
CSceneEntity CreateSceneEntity(string scene)
|
Create a scene entity to play the specified scene .vcd file. |
DispatchParticleEffect
|
void DispatchParticleEffect(string particleName, Vector, Vector)
|
Dispatches a one-off particle system. |
DoIncludeScript
|
bool DoIncludeScript(string filename, table scope)
|
Execute a script with the script scope set to the specified table. |
DoEntFire
|
void DoEntFire(string target, string action, string value, float delay, handle activator, handle caller)
|
Generate an entity I/O event. The caller argument takes a script handle, so it can be used with target set to !self to fire inputs to entities without usable targetnames. |
EntFire
|
function EntFire(string target, string action, string value, float delay = 0.0, handle activator = null)
|
Generate an entity I/O event. |
EntFireByHandle
|
void EntFireByHandle(handle target, string action, string 'value, float delay, handle activator, handle caller)
|
Generate an entity I/O event. The first parameter is an entity instance, so the handles of nameless or script generated entities can be passed easily. |
FrameTime
|
float FrameTime()
|
Get the time spent on the server in the last frame |
GetDeveloperLevel
|
int GetDeveloperLevel()
|
Gets the level of the developer mode. |
GetMapName
|
string GetMapName()
|
Get the name of the map. |
LoopSinglePlayerMaps
|
bool LoopSinglePlayerMaps()
|
Run the single player maps in a continuous loop. |
PrintHelp
|
[待完善] | |
RandomFloat
|
float RandomFloat()
|
Generate a random floating point number. |
RandomFloat
|
float RandomFloat(float min, float max)
|
Generate a random floating point number within a range, inclusive |
RandomInt
|
int RandomInt()
|
Generate a random integer. |
RandomInt
|
int RandomInt(int min, int max)
|
Generate a random integer within a range, inclusive |
RecordAchievementEvent
|
void RecordAchievementEvent(string, int)
|
Records achievement event or progress |
RetrieveNativeSignature
|
void RetrieveNativeSignature(string or func)
|
Name suggests it would print the calling format for a native function, but I can't get it to output anything other than <unnamed>
|
ScriptGetGameMode
|
int ScriptGetGameMode()
|
Retrieves the set game_mode. See this list for a settings vs modes overview. |
ScriptGetGameType
|
int ScriptGetGameType()
|
Retrieves the set game_type. See this list for a settings vs modes overview. |
ScriptGetRoundsPlayed
|
int ScriptGetRoundsPlayed()
|
Get the number of rounds played so far. |
ScriptIsLocalPlayerUsingController
|
bool ScriptIsLocalPlayerUsingController()
|
Returns whether the player is playing with a controller or not. |
ScriptIsWarmupPeriod
|
bool ScriptIsWarmupPeriod()
|
Is it warmup or not. |
ScriptSetRadarHidden
|
void ScriptSetRadarHidden(bool hideRadar)
|
Toggles the visibility of the radar hud element. Only works in training mode (game_type 2, game_mode 0) and only for the first person connected. |
SendToConsole
|
void SendToConsole(string command)
|
Send a string to the console as a command. |
SendToConsoleServer
|
void SendToConsoleServer(string)
|
Send a string that gets executed on the server as a ServerCommand |
Time
|
float Time()
|
Get the current server time |
TraceLine
|
float TraceLine(Vector, Vector, handle)
|
given 2 points & ent to ignore, return fraction along line that hits world or models |
UniqueString
|
function UniqueString(string)
|
Generate a string guaranteed to be unique across the life of the script VM, with an optional root string. Useful for adding data to tables when not sure what keys are already in use in that table. |
__ReplaceClosures
|