List of ND Script Functions

This list contains all engine-related Squirrel variables, functions, and constants currently available for VScript in . Some are not available yet but guaranteed to be in the next update. More not yet listed are also being added to the game and not yet listed.
== Variables ==
== Classes ==
=== CEntities ===
Function 	Signature 	Description
CreateByClassname 	handle CEntities::CreateByClassname(string) 	Creates entity by class name.
FindByClassname 	handle CEntities::FindByClassname(handle, string) 	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, Vector, float) 	Find entities by class name nearest to a point.
FindByClassnameWithin 	handle CEntities::FindByClassnameWithin(handle, string, Vector, float)	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, string) 	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, string) 	Find entities by name. Pass 'null' to start an iteration, or reference to a previously found entity to continue a search
FindByNameNearest 	handle CEntities::FindByNameNearest(string, Vector, float) 	Find entities by name nearest to a point.
FindByNameWithin 	handle CEntities::FindByNameWithin(handle, string, Vector, float) 	Find entities by name within a radius. Pass 'null' to start an iteration, or reference to a previously found continue a search
FindByTarget 	handle CEntities::FindByTarget(handle, string) 	Find entities by targetname. Pass 'null' to start an iteration, or reference to a previously found entity to continue a search
FindInSphere 	handle CEntities::FindInSphere(handle, Vector, float) 	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
Next 	handle CEntities::Next(handle) 	Continue an iteration over the list of entities, providing reference to a previously found entity
=== CBaseEntity ===
Function 	Signature 	Description
ConnectOutput 	void ConnectOutput(string, string) 	Adds an I/O connection that will call the named function when the specified output fires
DisconnectOutput 	void DisconnectOutput(string, string) 	Removes a connected script function from an I/O event.
GetHealth 	int GetHealth() 	Returns health of the entity.
SetHealth 	void SetHealth(int) 	Sets health of the entity.
GetMaxHealth 	int GetMaxHealth() 	Returns maximum health amount of the entity.
GetTeam 	handle GetTeam() 	Returns handle to the entity's team.
GetTeamNumber 	int GetTeamNumber() 	Returns team index of the entity (0 - Unassigned, 1 - Spectator, 2 - Consortium, 3 - Empire).
GetLifeState 	int GetLifeState() 	Returns life state of the entity (0 - alive, 1 - dying, 2 - dead).
GetClassname 	string GetClassname() 	Returns classname of the entity.
GetName 	string GetName() 	Returns target name of the entity.
GetPreTemplateName 	string GetPreTemplateName() 	Get the entity name stripped of template unique decoration.
GetOrigin 	vector GetOrigin() 	Returns absolute origin of the entity.
SetOrigin 	void SetOrigin(vector) 	Sets absolute origin of the entity.
GetForwardVector 	vector GetForwardVector() 	Get the forward vector of the entity.
SetForwardVector 	void SetForwardVector(vector) 	Set the orientation of the entity to have this forward vector.
GetVelocity 	vector GetVelocity() 	Get the velocity of the entity.
SetVelocity 	void SetVelocity(vector) 	Set the velocity of the entity.
GetMoveParent 	handle GetMoveParent() 	Get handle to the move parent of the entity.
GetRootMoveParent 	handle GetRootMoveParent() 	Get handle to the root move parent of the entity.
FirstMoveChild 	handle FirstMoveChild() 	Get handle to the first move child of the entity.
NextMovePeer 	handle NextMovePeer() 	Get handle to the next move peer of the entity.
__KeyValueFromString	void __KeyValueFromString(string, string)	Sets string value for key name on the entity.
__KeyValueFromInt 	void __KeyValueFromInt(string, int) 	Sets int value for key name on the entity.
__KeyValueFromVector	void __KeyValueFromVector(string, vector)	Sets vector value for key name on the entity.
ValidateScriptScope 	bool ValidateScriptScope() 	Ensure that an entity's script scope has been created.
GetScriptScope 	handle GetScriptScope() 	Retrieve the script-side data associated with an entity.
GetScriptId 	int GetScriptId() 	Retrieve the unique identifier used to refer to the entity within the scripting system.
=== CNDPlayer ===
Function 	Signature 	Description
IsCommander 	bool IsCommander() 	Get whether or not the player is the commander for their team.
IsCommanding 	bool IsCommanding() 	Get whether or not the player is currently in RTS mode.
GetSquad 	handle GetSquad() 	Returns handle to the player's squad.
GetSquadNumber 	int GetSquadNumber() 	Returns squad index of the player (0 - Alpha, 1 - Bravo, 2 - Charlie, 3 - Delta).
GetClass 	int GetClass() 	Returns class index of the player.
GetKit 	int GetKit() 	Returns kit index of the player.
GetActiveGizmo 	int GetActiveGizmo() 	Returns index of the player's currently selected gizmo.
IsGizmoActive 	bool IsGizmoActive(int) 	Returns whether effect of gizmo is active, either from equipped on player or active gizmo for player's squad.
IsInCondition 	bool IsInCondition(int) 	Returns whether given condition is currently applied to the player.
GetWeaponByName	handle GetWeaponByName(string)	Returns handle to weapon owned by player of specified classname or null if unowned.
GetAmmoCount 	int GetAmmoCount(int) 	Returns reserve ammo count of the player of specificed ammo type.
GiveAmmo 	void GiveAmmo(int, int) 	Gives the player ammo of specified type.
=== CNDTeam ===
Function 	Signature 	Description
GetTeamName 	string GetTeamName() 	Returns name of the team.
GetResources 	int GetResources() 	Returns resource count of the team.
SetResources 	void SetResources(int)	Sets resource count of the team.
GetCommander 	handle GetCommander() 	Returns handle to team's commander player.
GetSquad 	handle GetSquad(int) 	Returns handle to indexed squad for the team.
GetPlayerCount	int GetPlayerCount() 	Returns the number of players in the team.
GetPlayer 	handle GetPlayer(int) 	Returns handle to player at specified index of team players (0-based).
=== CNDSquad ===
Function 	Signature 	Description
GetActiveGizmo	int GetActiveGizmo 	Returns the active gizmo for the squad.
AddPlayer 	void AddPlayer(handle) 	Adds player to the squad.
RemovePlayer 	void RemovePlayer(handle)	Removes player from the squad.
HasPlayer 	bool HasPlayer(handle) 	Returns whether or not the player is in the squad.
=== CNDBaseWeapon ===
Function 	Signature 	Description
GetClipAmmoCount 	int GetClipAmmoCount() 	Returns the current ammo count inside the clip of the weapon.
SetClipAmmoCount 	void SetClipAmmoCount(int) 	Sets the current ammo count inside the clip of the weapon.
GetAmmoType 	int GetAmmoType() 	Returns the ammo type used by the weapon.
GetMaxClipAmmoCount 	int GetMaxClipAmmoCount() 	Returns the maximum amount of ammo that the clip of the weapon can hold.
GetDefaultClipAmmoCount	int GetDefaultClipAmmoCount()	Returns the default amount of ammo that the clip of the weapon holds.
=== CEnvEntityMaker ===
=== CCallChainer ===
=== CSimpleCallChainer ===
=== regxp ===
=== Vector ===
== Other functions ==
=== Engine specific ===
Function 	Signature 	Description
DebugDrawBox 	void DebugDrawBox(Vector, Vector, Vector, int, int, int, int, float)	Draw a debug overlay box
DebugDrawLine 	void DebugDrawLine(Vector, Vector, int, int, int, bool, float) 	Draw a debug overlay box
DoIncludeScript	bool DoIncludeScript(string, handle) 	Execute a script (internal)
EntFire 	function EntFire(target, action, value, delay, activator) 	Generate and entity i/o event
GetTeam 	function GetTeam( int ) 	Returns handle to a team by index. (0 - Unassigned, 1 - Spectators, 2 - Consortium, 3 - Empire)
RandomFloat 	float RandomFloat(float, float) 	Generate a random floating point number within a range, inclusive
RandomInt 	int RandomInt(int, int) 	Generate a random integer within a range, inclusive
SendToConsole 	void SendToConsole(string) 	Send a string to the console as a command
ShowMessage 	void ShowMessage(string) 	Print a hud message on all clients
Time 	float Time() 	Get the current server time
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.
=== Standard Squirrel libary ===
== Constants ==
== See also ==
* L4D2 Vscripts
* L4D2 Vscript Examples
* List of Portal 2 Script Functions
Category:Nuclear Dawn
Category:Scripting