Left 4 Dead 2/Scripting/Script Functions: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
(Created page with "{{sq}} This list contains all engine-related Squirrel functions available for VScript in {{game link|Left 4 Dead 2}}. It can be printed in-game with the <code>scipt_help</cod...")
 
Line 191: Line 191:
== See also ==
== See also ==
* {{portal2}} [[List of Portal 2 Script Functions]]
* {{portal2}} [[List of Portal 2 Script Functions]]
* [[L4D2 Vscripts]]


[[Category:Left 4 Dead 2]]
[[Category:Left 4 Dead 2]]
[[Category:Scripting]]
[[Category:Scripting]]

Revision as of 17:00, 17 August 2011

Squirrel This list contains all engine-related Squirrel functions available for VScript in Left 4 Dead 2 Left 4 Dead 2 . It can be printed in-game with the scipt_help command while running in tools mode.

CDirector

Function Signature Description
GetAveragedSurvivorSpan float CDirector::GetAveragedSurvivorSpan() Get the distance between the lead and trailing survivors, smoothed over time
GetAveragedSurvivorSpeed float CDirector::GetAveragedSurvivorSpeed() Get the rate at which the lead survivor is moving along the flow, smoothed over time
GetCommonInfectedCount int CDirector::GetCommonInfectedCount() Returns number fo infected currently spawned
GetFurthestSurvivorFlow float CDirector::GetFurthestSurvivorFlow() Get the maximum distance along the flow that the survivors have reached
GetGameMode string CDirector::GetGameMode() Get the current game mode
GetPendingMobCount int CDirector::GetPendingMobCount() Returns tnumber of infected waiting to spawn
HasAnySurvivorLeftSafeArea bool CDirector::HasAnySurvivorLeftSafeArea() True when one or more survivors have left the starting safe area
IsAnySurvivorInCombat bool CDirector::IsAnySurvivorInCombat() Returns true if any survivor recently dealt or took damage
IsPlayingOnConsole bool CDirector::IsPlayingOnConsole() Return true if game is running on a console (such as Xbox 360)
IsSinglePlayerGame bool CDirector::IsSinglePlayerGame() Return true if game is in single player
IsTankInPlay bool CDirector::IsTankInPlay() Returns true if any tanks are aggro on survivors
L4D1SurvivorGiveItem void CDirector::L4D1SurvivorGiveItem() Let the L4D1 survivors know that now is a good time to give the players an item
PlayMegaMobWarningSounds void CDirector::PlayMegaMobWarningSounds() Plays a horde scream sound and asks survivors to speak 'incoming horde' lines
ResetMobTimer void CDirector::ResetMobTimer() Trigger a mob as soon as possible when in BUILD_UP
UserDefinedEvent1 void CDirector::UserDefinedEvent1() generic user defined event fired from a squirrel script
UserDefinedEvent2 void CDirector::UserDefinedEvent2() generic user defined event fired from a squirrel script
UserDefinedEvent3 void CDirector::UserDefinedEvent3() generic user defined event fired from a squirrel script
UserDefinedEvent4 void CDirector::UserDefinedEvent4() generic user defined event fired from a squirrel script

CEntities

Function Signature Description
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

CNavMesh

Function Signature Description
UnblockRescueVehicleNav void CNavMesh::UnblockRescueVehicleNav() Unblock the rescue vehicle nav areas so bots can path through them

Other functions

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
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.

See also