Portal 2 脚本函数列表
此列表包含可用于的所有与 传送门2VScript 游戏引擎的松鼠函数。 当游戏在工具模式 运行时可以使用
script_help
指令在控制台打印出来这些。
变量
实例 | 类型 | 描述 |
---|---|---|
Entities
|
CEntities
|
提供服务器中已生成实体的通道。 |
常量
实例 | 类型 | 值 |
---|---|---|
_charsize_
|
integer | 1 |
_floatsize_
|
integer | 4 |
_intsize_
|
integer | 4 |
_version_
|
string | "Squirrel 2.2.3 stable" |
RAND_MAX
|
integer | 32767 |
PI
|
float | 3.14159 |
类
CBaseEntity
这是实体的脚本句柄类。所有生成的实体都有一个使用此或其子类之一的脚本句柄。
游戏中的所有脚本句柄都可以从[[Zh/
- CEntities|Entities]]
self
关键字访问自己的脚本句柄。activator
和caller
关键字可以在函数调用时访问。 访问实体脚本, 可以使用
使用方法
函数
特征用法
描述
__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)
设置实体的某个Keyvalue 为[[Zh/
- Vector|向量(或矢量)]]
。它只更改值, 但不会执行实体处理KeyValue所需的任何代码, 因此可能会产生意想不到的副作用。
ConnectOutput
void CBaseEntity::ConnectOutput(string output, string func_name)
添加一个I/O连接, 当指定的输出触发时, 该连接将调用指定的函数。
Destroy
void CBaseEntity::Destroy()
消灭这个实体。
DisconnectOutput
void CBaseEntity::DisconnectOutput(string output, string func_name)
从I/O事件中删除连接的脚本函数。
EmitSound
void CBaseEntity::EmitSound(string sound)
从该实体处播放一段声音。
EyePosition
Vector CBaseEntity::EyePosition()
获得眼睛位置绝对坐标的向量。
FirstMoveChild
handle CBaseEntity::FirstMoveChild()
如果处于层次结构中,则获取则检索第一个(移动)实体的子级。
GetAngles
Vector CBaseEntity::GetAngles()
获得实体转换为向量的俯仰、左右、横滚的角度数值。
GetAngularVelocity
Vector CBaseEntity::GetAngularVelocity()
获取局部角速度-返回俯仰、左右、横滚的向量。
GetBoundingMaxs
Vector CBaseEntity::GetBoundingMaxs()
获取一个以对象为中心的最大边框的向量。
GetBoundingMins
Vector CBaseEntity::GetBoundingMins()
获取一个以对象为中心的最小边框的向量。
GetCenter
Vector CBaseEntity::GetCenter()
获取对象中心的向量-绝对坐标。
GetClassname
string CBaseEntity::GetClassname()
获取此实体的类名。
GetForwardVector
Vector CBaseEntity::GetForwardVector()
获取实体的正向向量(+X)。
GetHealth
int CBaseEntity::GetHealth()
返回实体现有的血量 。
GetLeftVector
Vector CBaseEntity::GetLeftVector()
获取实体的左向量。
GetMaxHealth
int CBaseEntity::GetMaxHealth()
返回实体最大血量。
GetModelKeyValues
handle CBaseEntity::GetModelKeyValues()
获取此实体模型上的键值类实例。
GetModelName
string CBaseEntity::GetModelName()
获取该实体模型名称。
GetMoveParent
handle CBaseEntity::GetMoveParent()
如果处于层次结构中, 则检索实体的父级。
GetName
string CBaseEntity::GetName()
获取此实体的Targetname。
GetOrigin
Vector CBaseEntity::GetOrigin()
返回此实体的局部原点位置坐标。
GetOwner
handle CBaseEntity::GetOwner()
获取此实体的所有者。
GetPreTemplateName
string CBaseEntity::GetPreTemplateName()
将实体名称从模板唯一装饰(&001后缀)中删除。
GetRootMoveParent
handle CBaseEntity::GetRootMoveParent()
如果处于层次结构中, 则向上遍历层次结构以查找根父级
GetScriptId
string CBaseEntity::GetScriptId()
检索用于引用脚本系统中实体的唯一标识符。
GetScriptScope
handle CBaseEntity::GetScriptScope()
Retrieve the script-side data associated with an entity.
GetSoundDuration
float CBaseEntity::GetSoundDuration(string, string)
Returns float duration of the sound. Takes soundname and optional actormodelname.
GetTeam
int CBaseEntity::GetTeam()
Get the team this entity is on.
GetUpVector
Vector CBaseEntity::GetUpVector()
Get the up vector (+Z) of the entity.
GetVelocity
Vector CBaseEntity::GetVelocity()
Get the velocity of the entity. Note that this reads the QPhysics velocity value, so it only works for players, NPCs and moving brush entities. VPhysics objects always have a velocity of zero. A workaround is to record the position over multiple frames, and derive the velocity manually.
IsValid
bool CBaseEntity::IsValid()
Returns true if this entity is valid.
NextMovePeer
handle CBaseEntity::NextMovePeer()
Return the next entity in the same movement hierarchy.
PrecacheSoundScript
void CBaseEntity::PrecacheSoundScript(string)
Precache a sound for later playing. Should be called in the 'Precache()' hook function.
SetAbsOrigin
void CBaseEntity::SetAbsOrigin(Vector)
Teleport the entity to this world position.
SetAngles
void CBaseEntity::SetAngles(float, float, float)
Set entity pitch, yaw, roll
SetAngularVelocity
void CBaseEntity::SetAngularVelocity(float, float, float)
Set the local angular velocity - takes float pitch,yaw,roll velocities
SetForwardVector
void CBaseEntity::SetForwardVector(Vector)
Set the orientation of the entity to have this forward (+X) vector.
SetHealth
void CBaseEntity::SetHealth(int)
Sets the current health.
SetMaxHealth
void CBaseEntity::SetMaxHealth(int)
Sets the maximum health.
SetModel
void CBaseEntity::SetModel(string)
Change the model used for the entity. This can be used to change models for prop_weighted_cube or other similar entities. The model must be precached, which is usually done by placing it elsewhere in the map.
SetOrigin
void CBaseEntity::SetOrigin(Vector)
Teleport this entity to the given location.
SetOwner
void CBaseEntity::SetOwner(handle)
Sets this entity's owner.
SetSize
void CBaseEntity::SetSize(Vector, Vector)
Sets the bounding box size.
SetTeam
void CBaseEntity::SetTeam(int)
Set the team this entity is on.
SetVelocity
void CBaseEntity::SetVelocity(Vector)
Set local velocity. Note that this sets the QPhysics velocity value, so it only works for players, NPCs and moving brush entities. On VPhysics objects, this has no effect.
ValidateScriptScope
bool CBaseEntity::ValidateScriptScope()
Ensure that an entity's script scope has been created. This should be called before assigning to the entity's scope.
entindex
int CBaseEntity::entindex()
Returns the entity index.
CBaseAnimating
Extends CBaseEntity
Script handle class for animating entities such as props.
Methods
Function
Signature
Description
GetAttachmentAngles
Vector CBaseAnimating::GetAttachmentAngles(int id)
Get the attachment id's angles as a p,y,r vector.
GetAttachmentOrigin
Vector CBaseAnimating::GetAttachmentOrigin(int id)
Get the attachment id's origin vector
GetObjectScaleLevel
int CBaseAnimating::GetObjectScaleLevel()
The scale size of the entity
IsSequenceFinished
bool CBaseAnimating::IsSequenceFinished()
Ask whether the main sequence is done playing
LookupAttachment
int CBaseAnimating::LookupAttachment(string)
Get the ID for the named attachment.
SetBodygroup
void CBaseAnimating::SetBodygroup(int group, int index)
Sets a bodygroup. Group is the index for the desired group, and index is the desired part to use.
CBaseFlex
Extends CBaseAnimating
Methods
Function
Signature
Description
GetCurrentScene
handle CBaseFlex::GetCurrentScene()
Returns the instance of the oldest active scene entity (if any).
GetSceneByIndex
handle CBaseFlex::GetSceneByIndex(int)
Returns the instance of the scene entity at the specified index.
CBasePlayer
Extends CBaseAnimating
Methods
Function
Signature
Description
IsNoclipping
bool CBasePlayer::IsNoclipping()
Returns true if the player is in noclip mode.
CEntities
Script 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. Example:
//The first way
local ent = null; //The variable name "ent" is arbitrary.
while(ent = Entities.FindByName(ent, "entityname")) //Indeed, we mean '=' and not '==' ! The loop aborts if "ent" becomes null.
{
//... //In every iteration, "ent" is not null.
}
//The second way
for(local ent;ent = Entities.FindByName(ent, "entityname");) //The variable name "ent" is arbitrary. Indeed, we mean '=' and not '==' ! The loop aborts if "ent" becomes null. (All the semicolons are correctly placed)
{
//... //In every iteration, "ent" is not null.
}
Methods
Function
Signature
Description
CreateByClassname
handle CEntities::CreateByClassname(string)
Creates an entity by classname
FindByClassname
handle CEntities::FindByClassname(handle start_ent, string classname)
Find entities by class name. Pass 'null' to start an iteration, or reference to a previously found entity to continue a search
FindByClassnameNearest
handle CEntities::FindByClassnameNearest(string classname, Vector loc, float radius)
Find entities by class name nearest to a point.
FindByClassnameWithin
handle CEntities::FindByClassnameWithin(handle start_ent, string classname, Vector loc, float radius)
Find entities by class name within a radius. Pass 'null' to start an iteration, or reference to a previously found entity to continue a search
FindByModel
handle CEntities::FindByModel(handle start_ent, string model)
Find entities by model name. Pass 'null' to start an iteration, or reference to a previously found entity to continue a search
FindByName
handle CEntities::FindByName(handle start_ent, string targetname)
Find entities by name (including wildcards). Pass 'null' to start an iteration, or reference to a previously found entity to continue a search.
FindByNameNearest
handle CEntities::FindByNameNearest(string targetname, Vector loc, float radius)
Find entities by name nearest to a point.
FindByNameWithin
handle CEntities::FindByNameWithin(handle, string, Vector loc, float radius)
Find entities by name within a radius. Pass 'null' to start an iteration, or reference to a previously found entity to continue a search
FindByTarget
handle CEntities::FindByTarget(handle start_ent, string targetname)
Find entities with a specific target
keyvalue. Pass 'null' to start an iteration, or reference to a previously found entity to continue a search
FindInSphere
handle CEntities::FindInSphere(handle start_ent, Vector loc, float radius)
Find entities within a radius. Pass 'null' to start an iteration, or reference to a previously found entity to continue a search
First
handle CEntities::First()
Begin an iteration over the list of entities. Equivalent to Next(null).
Next
handle CEntities::Next(handle)
Continue an iteration over the list of entities, providing reference to a previously found entity.
CEnvEntityMaker
Extends CBaseEntity
Script handle class for env_entity_maker.
Methods
Function
Signature
Description
SpawnEntity
void CEnvEntityMaker::SpawnEntity()
Create an entity at the location of the maker
SpawnEntityAtEntityOrigin
void CEnvEntityMaker::SpawnEntityAtEntityOrigin(handle)
Create an entity at the location of a specified entity instance
SpawnEntityAtLocation
void CEnvEntityMaker::SpawnEntityAtLocation(Vector, Vector)
Create an entity at a specified location and orientaton, orientation is Euler angle in degrees (pitch, yaw, roll)
SpawnEntityAtNamedEntityOrigin
void CEnvEntityMaker::SpawnEntityAtNamedEntityOrigin(string)
Create an entity at the location of a named entity
CLinkedPortalDoor
[待完善]
Methods
Function
Signature
Description
GetPartnerInstance
handle CLinkedPortalDoor::GetPartnerInstance()
Get the instance handle of the door's linked partner
GetPartnername
string CLinkedPortalDoor::GetPartnername()
Returns the partnername of the door.
CPlayerVoiceListener
[待完善]
Methods
Function
Signature
Description
GetPlayerSpeechDuration
float CPlayerVoiceListener::GetPlayerSpeechDuration(int)
Returns the number of seconds the player has been continuously speaking.
IsPlayerSpeaking
bool CPlayerVoiceListener::IsPlayerSpeaking(int)
Returns whether the player specified is speaking.
CPortal_Player
[待完善]
Methods
Function
Signature
Description
GetWheatleyMonitorDestructionCount
int CPortal_Player::GetWheatleyMonitorDestructionCount()
Get number of wheatley monitors destroyed by the player.
IncWheatleyMonitorDestructionCount
void CPortal_Player::IncWheatleyMonitorDestructionCount()
Set number of wheatley monitors destroyed by the player.
TurnOffPotatos
void CPortal_Player::TurnOffPotatos()
Turns Off the Potatos material light
TurnOnPotatos
void CPortal_Player::TurnOnPotatos()
Turns On the Potatos material light
CPropLinkedPortalDoor
[待完善]
Methods
Function
Signature
Description
GetPartnerInstance
handle CPropLinkedPortalDoor::GetPartnerInstance()
Get the instance handle of the door's linked partner
GetPartnername
string CPropLinkedPortalDoor::GetPartnername()
Returns the partnername of the door.
CSceneEntity
Extends CBaseEntity
Methods
Function
Signature
Description
AddBroadcastTeamTarget
void CSceneEntity::AddBroadcastTeamTarget(int)
Adds a team (by index) to the broadcast list
EstimateLength
float CSceneEntity::EstimateLength()
Returns length of this scene in seconds.
FindNamedEntity
handle CSceneEntity::FindNamedEntity(string)
given an entity reference, such as !target, get actual entity from scene object
IsPaused
bool CSceneEntity::IsPaused()
If this scene is currently paused.
IsPlayingBack
bool CSceneEntity::IsPlayingBack()
If this scene is currently playing.
LoadSceneFromString
bool CSceneEntity::LoadSceneFromString(string, string)
given a dummy scene name and a vcd string, load the scene
RemoveBroadcastTeamTarget
void CSceneEntity::RemoveBroadcastTeamTarget(int)
Removes a team (by index) from the broadcast list
CScriptKeyValues
Script handle representation of a models $keyvalues block.
Sub keys are instances of the same class.
Methods
Function
Signature
Description
FindKey
handle CScriptKeyValues::FindKey(string)
Given a KeyValues object and a key name, find a KeyValues object associated with the key name
GetFirstSubKey
handle CScriptKeyValues::GetFirstSubKey()
Given a KeyValues object, return the first sub key object
GetKeyBool
bool CScriptKeyValues::GetKeyBool(string)
Given a KeyValues object and a key name, return associated bool value
GetKeyFloat
float CScriptKeyValues::GetKeyFloat(string)
Given a KeyValues object and a key name, return associated float value
GetKeyInt
int CScriptKeyValues::GetKeyInt(string)
Given a KeyValues object and a key name, return associated integer value
GetKeyString
string CScriptKeyValues::GetKeyString(string)
Given a KeyValues object and a key name, return associated string value
GetNextKey
handle CScriptKeyValues::GetNextKey()
Given a KeyValues object, return the next key object in a sub key group
IsKeyEmpty
bool CScriptKeyValues::IsKeyEmpty(string)
Given a KeyValues object and a key name, return true if key name has no value
ReleaseKeyValues
void CScriptKeyValues::ReleaseKeyValues()
Given a root KeyValues object, release its contents
CTriggerCamera
Extends CBaseEntity
Methods
Function
Signature
Description
GetFov
int CTriggerCamera::GetFov()
get camera's current fov setting as integer
SetFov
void CTriggerCamera::SetFov(int, float)
set camera's current fov in integer degrees and fov change rate as float
Math
The built-in Squirrel math library.
Function
Signature
Description
abs
int abs(float x)
Returns the absolute value of x
as an integer.
acos
float acos(float x)
Returns the arccosine of x
.
asin
float asin(float x)
Returns the arcsine of x
.
atan
float atan(float x)
Returns the arctangent of x
.
atan2
float atan2(float x, float y)
Returns the arctangent of x/y
.
ceil
float ceil(float x)
Returns a float value representing the smallest integer that is greater than or equal to x
.
cos
float cos(float x)
Returns the cosine of x
.
exp
float exp(float x)
Returns the exponential value (e^x
) of the float parameter x
.
fabs
float fabs(float x)
Returns the absolute value of x
as a float.
floor
float floor(float x)
Returns a float value representing the largest integer that is less than or equal to x
.
log
float log(float x)
Returns the natural logarithm of x
.
log10
float log10(float x)
Returns the logarithm base-10 of x
.
pow
float pow(float x, float y)
Returns x
raised to the power of y
.
rand
int rand()
Returns a pseudorandom integer in the range 0 to RAND_MAX
.
sin
float sin(float x)
Returns the sine of x
.
sqrt
float sqrt(float x)
Returns the square root of x
.
srand
void srand(float seed)
Sets the starting point for generating a series of pseudorandom integers.
tan
float tan(float x)
Returns the tangent of x
.
Vector
Represents an x/y/z position, returned/passed to many functions. It takes the 3 x/y/z positions as a parameter.
A few math operations can be applied to vectors - +/- between any two vectors, and Vector * number
in that order only. All three operations return another vector. Other math operations are done with method calls:
Methods
Function
Signature
Description
Cross
Vector Vector::Cross(Vector other)
Return the vector cross product - this × other
.
Dot
float Vector::Dot(Vector other)
Return the vector dot product - this · other
.
Length
float Vector::Length()
Return the distance from the origin.
Length2D
float Vector::Length2D()
Return the distance from the origin, ignoring the Z axis.
LengthSqr
float Vector::LengthSqr()
Return the distance from the origin, but squared. This is faster to compute since a square root isn\'t required.
Length2DSqr
float Vector::Length2DSqr()
Return the distance from the origin, ignoring the Z axis and squared. This is faster to compute since a square root isn\'t required.
Norm
float Vector::Norm()
Modify the vector to have a length of 1, and return its original length.
ToKVString
string Vector::ToKVString()
Return a string in the form "X Y Z".
Other functions
Function
Signature
Description
Assert
void Assert(exp, string message = null)
Throws an exception if exp equates to false, optionally with message.
CreateProp
handle CreateProp(string classname, Vector origin, string modelname, int activity)
Create a prop. The class should be a prop_physics style entity.
CreateSceneEntity
handle CreateSceneEntity(string)
Create a scene entity to play the specified scene.
DebugDrawBox
void DebugDrawBox(Vector origin, Vector mins, Vector maxs, int r, int g, int b, int alpha, float duration)
Draw a debug box, for visualizing code. It's positioned at origin
, with the dimensions mins
/maxs
Developer must be on to show this, and it'll stay around for duration
seconds (or 1 frame if -1.0). The color ranges from 0-255.
DebugDrawLine
void DebugDrawLine(Vector start, Vector end, int r, int g, int b, bool hitTest, float duration)
Draw a debug line, for visualizing code. Developer must be on to show this, and it'll stay around for duration
seconds (or 1 frame if -1.0). The color ranges from 0-255.
DoIncludeScript
bool DoIncludeScript(string filename, table scope)
Execute the script file "scripts/vscripts/" + filename
in the scope of scope
. The extension .nut
can be omitted.
IncludeScript
bool IncludeScript(string filename, table scope = null)
Execute the script file "scripts/vscripts/" + filename
in the scope of scope
, this
by default. The extension .nut
can be omitted.
DoEntFire
void DoEntFire(string target, string action, string value, float delay, handle activator, handle caller)
Generate an entity I/O event.
EntFire
function EntFire(target, action, value, delay, activator)
Generate an entity I/O event. Value, delay and activator are optional.
EntFireByHandle
void EntFireByHandle(handle target, string action, string value, float delay, handle activator, handle caller)
Generate an entity I/O event. First parameter is an entity instance.
FrameTime
float FrameTime()
Get the time spent on the server in the last frame.
GetDeveloperLevel
int GetDeveloperLevel()
Gets the level of 'developer'.
GetMapIndexInPlayOrder
int GetMapIndexInPlayOrder()
For workshop maps, determines which index (by order played) this map is. Returns -1 if entry is not found or -2 if this is not a workshop map.
GetMapName
string GetMapName()
Get the name of the map.
GetNumMapsPlayed
int GetNumMapsPlayed()
Returns how many workshop maps the player has played through.
GetPlayerSilenceDuration
float GetPlayerSilenceDuration(int player_index)
Time that the specified player has been silent on the mic.
IsMultiplayer
bool IsMultiplayer()
Returns true if this is a multiplayer game, or false if singleplayer.
LoopSinglePlayerMaps
bool LoopSinglePlayerMaps()
Returns true if the cvar loopsingleplayermaps
is enabled. Still works in multiplayer.
RandomFloat
float RandomFloat(float min, float max)
Generate a random floating point number within a range, inclusive
RandomInt
int RandomInt(int min, int max)
Generate a random integer within a range, inclusive
RecordAchievementEvent
void RecordAchievementEvent(string name, int player_index)
Earns a given achievement or increases progress.
RequestMapRating
void RequestMapRating()
In workshop maps, pops up the map rating dialog for user input.
RetrieveNativeSignature
void RetrieveNativeSignature(string nativeFunction)
[待完善]
SendToConsole
void SendToConsole(string command)
Send a string to the console as a command. The command is treated as coming from the host in multiplayer.
SetDucking
void SetDucking(string, string, float)
Set the level of an audio ducking channel.
SetMapAsPlayed
int SetMapAsPlayed()
For workshop maps, adds the current map to the play order and returns the new index therein. Returns -2 if this is not a workshop map.
ShowMessage
void ShowMessage(string)
Print a HUD message on all clients.
Time
float Time()
Get the current server time
TraceLine
float TraceLine(Vector start, Vector end, handle ignored_ent)
Given 2 points and an entity to ignore, returns fraction along line that hits the world. Does not hit entities, seemingly making the ignored entity parameter useless.
UniqueString
string UniqueString(string suffix = "")
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. Equivalent to DoUniqueString(suffix)
.
DoUniqueString
string DoUniqueString(string suffix)
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
void __ReplaceClosures(function script, table scope)
Internal function called in script_reload_
server commands.
Singleplayer only
These functions can only be used in singleplayer games, and may cause errors if used in multiplayer.
Function
Signature
Description
GetPlayer
handle GetPlayer()
Returns the player.
GivePlayerPortalgun
void GivePlayerPortalgun()
Equips the player with a blue-only portalgun.
PrecacheMovie
void PrecacheMovie(string)
Precaches a named movie. Only valid to call within the entity's 'Precache' function called on mapspawn.
ScriptShowHudMessageAll
void ScriptShowHudMessageAll(string, float)
Show center print text message for specified number of seconds.
ScriptSteamShowURL
bool ScriptSteamShowURL(string)
Bring up the steam overlay and shows the specified URL. (Full address with protocol type is required, e.g. http://www.steamgames.com/)
TryDLC1InstalledOrCatch
void TryDLC1InstalledOrCatch()
Throws an exception if the Peer Review DLC isn't installed. Useless in the current PC version of the game, as Peer Review will always be present.
UpgradePlayerPortalgun
void UpgradePlayerPortalgun()
Upgrades the player's portalgun to shoot orange portals.
UpgradePlayerPotatogun
void UpgradePlayerPotatogun()
Upgrades the player's portalgun to shoot orange portals and have PotatOS impaled on it.
Multiplayer only
These functions can only be used in multiplayer games, and may cause errors if used in singleplayer.
Function
Signature
Description
AddBranchLevelName
void AddBranchLevelName(int, string)
Adds a level to the specified branch's list.
注意:In co-op maps, this function must be called at least once or players will not be able to move.
AddCoopCreditsName
void AddCoopCreditsName(string)
Adds a name to the coop credit's list.
AddGladosSpokenFlags
void AddGladosSpokenFlags(int, int)
Adds bit flags for specific lines that are tracked per session.
CoopGladosBlowUpBots
void CoopGladosBlowUpBots()
Blows up both robots and prevents respawning.
CoopGetNumPortalsPlaced
int CoopGetNumPortalsPlaced()
Returns the number of portals the players have placed so far.
CoopGetLevelsCompletedThisBranch
int CoopGetLevelsCompletedThisBranch()
Returns the number of levels the players have completed in their run of the current branch.
CoopGetBranchTotalLevelCount
int CoopGetBranchTotalLevelCount()
Returns the number of levels in the current branch.
CoopSetCameFromLastDLCMap
void CoopSetCameFromLastDLCMap(bool)
Set whether the players came from the last coop DLC map or not.
CoopSetMapRunTime
void CoopSetMapRunTime(float runLength)
Sets the time to complete a coop map from spawn to completing the puzzle. (Possibly related to the Triple Crown achievement.)
GetBluePlayerIndex
int GetBluePlayerIndex()
Player index of the blue player.
GetCameFromLastDLCMap
bool GetCameFromLastDLCMap()
Returns true if coming from the last DLC coop map (as set by CoopSetCameFromLastDLCMap
).
GetCoopBranchLevelIndex
int GetCoopBranchLevelIndex(int)
Given the 'branch' argument, returns the current chosen level.
GetCoopSectionIndex
int GetCoopSectionIndex()
Section that the coop players have selected to load.
GetGladosSpokenFlags
int GetGladosSpokenFlags(int)
Returns bit flags for specific lines that are tracked per session.
GetHaveSeenDLCTubesReveal
bool GetHaveSeenDLCTubesReveal()
Get whether players have seen the DLC tubes reveal this session (as set by SetHaveSeenDLCTubesReveal
).
GetHighestActiveBranch
int GetHighestActiveBranch()
Returns which branches should be available in the hub.
GetNumPlayersConnected
int GetNumPlayersConnected()
Returns how many players are connected. In normal co-op, this will almost always be 2.
GetOrangePlayerIndex
int GetOrangePlayerIndex()
Player index of the orange player.
GetPlayerDeathCount
int GetPlayerDeathCount(int player)
Returns the number of times that a specific player has died in the session.
IsBranchComplete
bool IsBranchComplete(int course)
Returns true if every level in the course has been completed by either player.
IsLevelComplete
bool IsLevelComplete(int course, int level)
Returns true if the level in the specified course is completed by either player.
IsLocalSplitScreen
bool IsLocalSplitScreen()
Returns true if players are in split screen.
IsPlayerBranchComplete
bool IsPlayerBranchComplete(int player, int course)
Returns true if every level in the course has been completed by the specified player.
IsPlayerLevelComplete
bool IsPlayerLevelComplete(int, int, int)
Returns true if the level in the specified course is completed by a specific player.
MarkMapComplete
void MarkMapComplete(string)
Marks a maps a complete for both players.
NotifySpeedRunSuccess
void NotifySpeedRunSuccess(int runLength, string mapname)
Tells the client that a successful speed run has been completed. (Used for the Triple Crown achievement.)
SaveMPStatsData
void SaveMPStatsData()
Save the multiplayer stats for the score board.
SetHaveSeenDLCTubesReveal
void SetHaveSeenDLCTubesReveal()
Set that players have seen the DLC tubes reveal this session.
See also