L4D2 Vscripts

From Valve Developer Community
Revision as of 15:46, 13 February 2013 by ThaiGrocer (talk | contribs) (CPointTemplate)

Jump to: navigation, search

<Squirrel Language><Left 4 Dead 2> Left 4 Dead 2 vscripts are Squirrel language-based scripts that can be run in-game. For examples, please see L4D2 Vscript Examples.

Description

Left 4 Dead 2 vscripts are written in Squirrel, a compilable scripting language similar to Lua. The file extensions are .nut and .nuc, where .nuc denotes encryption of plain text .nut.

Usage

  • Director manipulation - onslaughts, CI wanderer options, complete emptiness/silence, prohibition of boss infected (tanks and witches), direction of mobs, specific spawning behavior, etc.
  • Finale - Custom sequences of events, Gauntlet and Scavenge Logic
  • Complex entity scripting - entity I/O, logic, arithmetic, loops, counters, timers, prop spawning, etc. (Example: Dark Carnival mini-games)
  • Game modes such as Mutations and Scavenge
  • Miscellaneous!

Location

Official .nuc script files are located in scripts/vscripts in multiple locations
Note:Browse and extract VPK files with third-party programs like GCFScape.
  • left 4 dead 2\left4dead2\pak01_dir.vpk
  • left 4 dead 2\left4dead2_dlc1\pak01_dir.vpk
April 22, 2010 The Passing update
  • left 4 dead 2\left4dead2_dlc2\pak01_dir.vpk
October 5, 2010 The Sacrifice update
  • left 4 dead 2\left4dead2_dlc3\pak01_dir.vpk
March 22, 2011 Cold Stream Beta / L4D1 Transition Project update
  • left 4 dead 2\update\pak01_dir.vpk
this is where mutations are updated/replaced bi-weekly.

Decrypting NUC files

.nuc files are ICE encrypted .nut files. The encryption key is SDhfi878. You can use VICE to decode them.

Packages with deciphered official scripts are also available.

Loading vscripts

  • Entities
    • Any entity is capable of loading a script on map spawn.
    • The vscript can be reloaded with console command ent_fire <name of entity> runscriptfile <relative vscript path>. This is useful for quick script reloading.
    • Script functions can be called with entity inputs like RunScriptCode.
    • Features thinkfunction, a keyvalue that calls a user-defined function every 0.1 seconds. While it has the potential to become expensive, a programmer is able to limit the amount of code executed. The shoot gallery in Dark Carnival relies on this.
    • Some functions are specialized for certain entity classes, such as point_template and env_entity_maker.
    • Also available is logic_script, an entity that registers multiple entities as an array EntityGroup.
  • info_director
    • Loads DirectorOptions such as onslaughts, panic events, infected limits, etc.
    • Custom DirectorOptions are used frequently to tweak director behavior that best suits the environment. c1_mall_ambient.nut is one such example.
Note:Scripts used with ScriptedPanicEvent will not work if they are in a subdirectory, even though you can use subdirectories in other script contexts. They must reside under the vscripts folder, or they will simply act as a 1 stage 1 second delay.
  • Game Modes
    • Scavenge
      • A per-map script is loaded automatically during Scavenge Mode
      • Name the script <map name>_scavenge.nut.
      • For example, c1m4_atrium_scavenge.nut.
    • Mutations
      • Will automatically run the script with the same name as the game mode.
      • For example, running a map map <map name> mutation12 will automatically load Realism Versus script.
  • Finale
    • Loaded via trigger_finale, either automatically or pointing to a specific vscript.
    • Automatically loads <map name>_finale.nut script on finale start.
    • Scavenge, Custom, and Gauntlet finales are dependent on vscripts.

Example scripts

Please see L4D2 Vscript Examples.

Director options

This is by no means an exhaustive list of all the director options. Additions and updates can be found in the Steam Forums

  • A_CustomFinaleX = stage type (enumerated PANIC, ONSLAUGHT, DELAY, TANK); where X is the stage number. For scripted panic event or custom finale.
  • A_CustomFinaleValueX = Value depends on the stage type. Please see example article or official decrypted scripts. For scripted panic event or custom finale.
  • AlwaysAllowWanderers = true|false
  • BehindSurvivorsSpawnDistance = Appears to require PreferredSpecialDirection = SPAWN_BEHIND_SURVIVORS
  • BileMobSize = NUM ? Doesn't seem to do anything (found in c6m3_port_finale.nut)
  • BoomerLimit = maximum number of boomers allowed
  • BuildUpMinInterval
  • ChargerLimit = maximum number of chargers allowed
  • CommonLimit = maximum number of commons allowed
  • DisallowThreatType = ZOMBIE_WITCH, ZOMBIE_TANK (other values???) Ex: c8m1_apartment.nut
  • FallenSurvivorPotentialQuantity = int
  • FallenSurvivorSpawnChance = float [0...1]
  • DominatorLimit To do: confirm category/working
  • GasCansOnBacks = true|false
  • HunterLimit = maximum number of hunters allowed
  • IntensityRelaxAllowWanderersThreshold
  • IntensityRelaxThreshold = All survivors must be below this intensity before a Peak is allowed to switch to Relax (in addition to the normal peak timer)
  • IntensityThreshold
  • JockeyLimit = maximum number of jockeys allowed
  • LockTempo = 0 ???
  • MaxSpecials = number of specials allowed at once
  • MegaMobMaxSize = maximum megamob size
  • MegaMobMinSize = minimum megamob size
  • MegaMobSize To do: confirm category/working
  • MinimumStageTime = in seconds Ex: c1m4_delay.nut To do: possibly finale or custom panic event specific
  • MobMaxPending = Guessing it's the maximum mob size that can be pending for spawn.
  • MobMaxSize = max mob size
  • MobMinSize = min mob size
  • MobRechargeRate = Guessing it's the speed at which a mob regenerates (ie next mob)
  • MobSpawnMaxTime = max time in seconds for mob spawn
  • MobSpawnMinTime = min time in seconds? for mob spawn
  • MobSpawnSize
  • MusicDynamicMobScanStopSize = When see fewer than this many of a mob, music stops
  • MusicDynamicMobSpawnSize = ???Spawning a mob this large can play music
  • MusicDynamicMobStopSize = When a mob gets to this size we think about stopping the music
  • NumReservedWanderers = the number of infected that cannot be absorbed
  • PanicForever * this seems to only work in gauntlets
  • PanicWavePauseMax (float) To do: confirm category/working
  • PanicWavePauseMin (float) To do: confirm category/working
  • PreferredMobDirection = SPAWN_ABOVE_SURVIVORS, SPAWN_ANYWHERE, SPAWN_BEHIND_SURVIVORS, SPAWN_FAR_AWAY_FROM_SURVIVORS, SPAWN_IN_FRONT_OF_SURVIVORS , SPAWN_LARGE_VOLUME, SPAWN_NEAR_IT_VICTIM, SPAWN_NO_PREFERENCE
Note:SPAWN_NEAR_IT_VICTIM does not exist before a finale and will cause an error, so I'm assuming the director picks someone as IT when the finale starts. SPAWN_LARGE_VOLUME is what makes you be a mile away on DC finale.
  • PreferredSpecialDirection
Note:The same values for PreferredMobDirection appear to work, BUT I've also seen the following, I don't know if it's just redundancy or what.

SPAWN_SPECIALS_ANYWHERE

SPAWN_SPECIALS_IN_FRONT_OF_SURVIVORS
  • PreTankMobMax = int To do: confirm category/working; possibly gauntlet specific
  • ProhibitBosses = true|false - prohibit tanks/witches
  • RelaxMaxFlowTravel = 600
  • RelaxMaxInterval = 5
  • RelaxMinInterval = 5
  • ShouldAllowMobsWithTank = true|false
  • ShouldAllowSpecialsWithTank = true|false
  • ShouldConstrainLargeVolumeSpawn = true|false
  • SmokerLimit = maximum number of smokers allowed
  • SpecialInitialSpawnDelayMin
  • SpecialInitialSpawnDelayMax
  • SpecialRespawnInterval = time in seconds for special respawns
  • SpitterLimit = maximum number of spitters allowed
  • SurvivorMaxIncapacitatedCount = Maximum amount of survivor incapacitating before dying
  • SustainPeakMaxTime = in minutes
  • SustainPeakMinTime = in minutes
  • TankHitDamageModifierCoop = float (mutation1.nut Last Man on Earth) {todo|confirm category}}
  • TankHitDamageModifierVersus = float To do: confirm category
  • TankLimit = maximum number of tanks allowed (for example, used in c7m3_port.nut)
  • TankRunSpawnDelay = in seconds (mutation19.nut Taaannnkk!) To do: confirm category
  • TempHealthDecayRate = 0.27 // pain_pills_decay_rate default, higher values equals quicker decay
  • WanderingZombieDensityModifier = float To do: confirm category/working
  • WitchLimit = maximum number of witches allowed (used in c7m3_port.nut)
  • ZombieSpawnRange = How far away can zombies spawn?
  • ZombieSpawnInFog = true|false
  • function Update()
If you define an Update() function in your vscript, it will run repeatedly much like a Think() function, but ONLY a finale via trigger_finale is triggered, if you have multiple scripts that are running that define it, they all will be called. The use of Update() is also found in the Bleed Out mutation (mutation3.nut), but needs further testing to see see if it behaves the same way like during a finale.

Finale Specific/Related

A normal finale consists of X number of stages. Some variables in DirectorOptions can only be used during finales.

  • A_CustomFinale_StageCount
  • A_CustomFinaleX = stage type (enumerated PANIC, ONSLAUGHT (AKA SCRIPTED), DELAY, TANK), where X is the stage number. Also used in scripted panic events.
  • A_CustomFinaleValueX = Value depends on the stage type above. Also used in scripted panic events. Please see the example.
  • A_CustomFinaleMusicX = Soundscript entry to play. For instance, A_CustomFinaleMusic1 = "C2M5.BadManTank2". Note that c2m5_concert_finale.nut does not use this method and instead opted to use entities within the map instead. In the c2m5 script A_CustomFinaleMusic4 = "", suggesting that no song is actually played automatically via script.
Note:There is also a D_CustomFinale_StageCount, D_CustomFinaleX, etc. found in c3m4_plantation_finale.nut but the difference between A and D are unknown. B_, C_, and E_ are also available.
  • EscapeSpawnTanks = true|false
  • HordeEscapeCommonLimit = number of commons allowed when the escape vehicle has arrived
  • function OnBeginCustomFinaleStage( num, type )
If defined, will be called on every stage change with the number, and type, this is how you would change director options between stages (spawn directions, etc). num refers to the finale stage number passed by the director and type is the stage type (PANIC, TANK, etc.).
  • function OnChangeFinaleMusic() To do: confirm category/working

A stage can be one of 4 types (other values will break the finale and go right to ESCAPE):

  • PANIC - a panic event, the value is the number of them (ie 2 would be 2 panic events in a row)
  • TANK - spawn a tank(s), the value is the number of tanks to spawn
  • DELAY - a delay, the value is the number of seconds to wait before proceeding to the next stage
  • ONSLAUGHT - The value should be the name of a vscript to call or "" (which will do nothing), any bad value here will crash you to the desktop. Your onslaught script is responsible for sending an EndCustomScriptedStage input to the director (a goal of your choice, like a certain trigger volume, timer, random value, etc.). Otherwise, the onslaught will not end.

An example custom finale script:

ERROR <- -1
PANIC <- 0
TANK <- 1
DELAY <- 2
ONSLAUGHT <- 3 // In some vscripts (c8m5_rooftop_finale), ONSLAUGHT is labeled as SCRIPTED

DirectorOptions <-
{
	//-----------------------------------------------------
	 CommonLimit = 10
	 A_CustomFinale_StageCount = 8  
	 
	 A_CustomFinale1 = PANIC
	 A_CustomFinaleValue1 = 2   // two panic events
	 
	 A_CustomFinale2 = DELAY
	 A_CustomFinaleValue2 = 12  // delay for twelve seconds in addition to stage delay
	 
	 A_CustomFinale3 = TANK
	 A_CustomFinaleValue3 = 3  // 3 tanks!
	 
	 A_CustomFinale4 = DELAY
	 A_CustomFinaleValue4 = 12 // wait some more
	 
	 A_CustomFinale5 = ONSLAUGHT
	 A_CustomFinaleValue5 = "my_onslaught_script.nut" // run our onslaught script
	 
	 A_CustomFinale6 = DELAY
	 A_CustomFinaleValue6 = 15 // wait 15 seconds
	 
	 A_CustomFinale7 = TANK
	 A_CustomFinaleValue7 = 1  // one more tank

	 A_CustomFinale8 = DELAY
	 A_CustomFinaleValue8 = 10 // wait ten seconds ... rescue!
	 
	 SpecialRespawnInterval = 25

	//-----------------------------------------------------
}

function OnBeginCustomFinaleStage( num, type )
{
      printl( "Beginning custom finale stage " + num + " of type " + type );
      MapScript.DirectorOptions.CommonLimit = num * 10 // increase commons by 10 linearly with stages
}

Gauntlet Specific/Related

Most of these can be found in director_gauntlet.nut

  • CustomTankKiteDistance (3000 is the default) To do: confirm category/working
  • GauntletMovementThreshold
  • GauntletMovementTimerLength
  • GauntletMovementBonus
  • GauntletMovementBonusMax

Mutation Specific/Related

Some of these values are mutation specific values of the global ones (cm_CommonLimit,cm_MaxSpecials, etc.), so use them if you are making a mutation, incase any map scripts are changing the global values.

  • ActiveChallenge
  • cm_AggressiveSpecials
  • cm_AllowPillConversion
  • cm_AllowSurvivorRescue
  • cm_AutoReviveFromSpecialIncap Used by "The Last Man On Earth" and "Lone Gunman" mutations (mutation1.nut and mutation17.nut)
  • cm_BaseCommonAttackDamage
  • cm_BaseSpecialLimit
  • cm_CommonLimit
  • cm_DominatorLimit
  • cm_FirstManOut Used by the "Room For One" mutation (mutation10.nut)
  • cm_frustrationTimer
  • cm_HeadshotOnly
  • cm_HealingGnome
  • cm_InfiniteFuel (mutation7.nut Chainsaw Massacre)
  • cm_MaxSpecials
  • cm_NoRescueClosets
  • cm_NoSurvivorBots
  • cm_ProhibitBosses
  • cm_ShouldHurry
  • cm_SingleScavengeCluster Used for scavenge cans to spawn one-by-one
  • cm_SpecialRespawnInterval
  • cm_SpecialSlotCountdownTime
  • cm_TankLimit
  • cm_TankRun Used in Taaank! mutation (mutation19.nut)
  • cm_TempHealthOnly Only temporary health
  • cm_VIPTarget
  • cm_WanderingZombieDensityModifier
  • cm_WitchLimit
  • function AllowWeaponSpawn()
Returns true or false if the given classname is allowed to spawn, used by several mutations
  • function ConvertWeaponSpawn()
Converts a weapon spawn of given classname to another, used by several mutations
  • function ConvertZombieClass()
Converts one spawn into another, used by the tankss! mutation (mutation19.nut)
  • function GetDefaultItem()
ID starts from 0 and ends in an unknown point. Return a string of a weapon name to make it a default item for survivors. Used in several mutations
  • function ShouldAvoidItem()
Probably a bot related function or spawn related, not sure

Scavenge Specific/Related

  • ScavengeClusterBonusTime = float To do: confirm category/working
  • ScavengeRoundInitialTime = float To do: confirm category/working
  • ScavengeScoreBonusTime = float (used in mutation13.nut Follow the Liter)

Survival Specific/Related

  • SurvivalSetupTime = (Used in mutation15.nut for Survival Versus with setup time of 90 seconds)

Squirrel in L4D2

Please see List of L4D2 Script Functions. To do: Merge!


The following are available in L4D2 by default.[1][2] Warning: NEVER use the = operator when trying to influence the director. Use <-. The difference is semantics. If you use =, it will throw an error if the table slot isn't defined (like if a previous script didn't define it). <-, on the other hand, will create the variable if it does not exist.

Variables

To do: Add Variables

Classes

CDirector

Game Instance: Director

  • Class Methods
    • .Clear() - Wipe Director Options
    • .GetAveragedSurvivorSpan() - Get the distance between the lead and trailing survivors, smoothed over time
    • .GetAveragedSurvivorSpeed() - Get the rate at which the lead survivor is moving along the flow, smoothed over time
    • .GetCommonInfectedCount() - GetCommonInfectedCount (no longer is there a need to count another way)
    • .GetFurthestSurvivorFlow() - Get the maximum distance along the flow that the survivors have reached
    • .GetGameMode() - Get the current game mode "versus", "coop", etc.
    • .GetPendingMobCount() - Returns the number of infected waiting to spawn
    • .HasAnySurvivorLeftSafeArea() - True when one or more survivors have left the starting safe area
    • .IsAnySurvivorInCombat() - Returns true if any survivor recently dealt or took damage
    • .IsPlayingOnConsole() - Returns true if player is running the client on a console like Xbox 360
    • .IsSinglePlayerGame() - Return true if game is in single player
    • .IsTankInPlay() - Returns true if any tanks are aggro on survivors
    • .IsValid()
    • .L4D1SurvivorGiveItem() - This makes l4d1 survivors give an item
    • .PlayMegaMobWarningSounds() - Plays a horde scream sound and asks survivors to speak 'incoming horde' lines
    • .ResetMobTimer() - Trigger a mob as soon as possible when in BUILD_UP (refer to director_debug 1)
    • .UserDefinedEvent1()-.UserDefinedEvent4() - Generic "user defined script event" hook that can be fired from Squirrel and fires outputs on the director entity in the map, OnUserDefinedScriptEvent1-4. For an example, refer to c7m3_port_finale.nut and the info_director entity output list in c7m3_port.vmf.
  • Director Enumerations
    Note:These are (or some are) script specific, hence the duplicate values.
    • FINALE_CUSTOM_DELAY = 10
    • FINALE_CUSTOM_PANIC = 7
    • FINALE_CUSTOM_SCRIPTED = 9
    • FINALE_CUSTOM_TANK = 8
    • FINALE_FINAL_BOSS = 5
    • FINALE_GAUNTLET_1 = 0
    • FINALE_GAUNTLET_2 = 3
    • FINALE_GAUNTLET_BOSS = 15
    • FINALE_GAUNTLET_BOSS_INCOMING = 14
    • FINALE_GAUNTLET_ESCAPE = 16
    • FINALE_GAUNTLET_HORDE = 12
    • FINALE_GAUNTLET_HORDE_BONUSTIME = 13
    • FINALE_GAUNTLET_START = 11
    • FINALE_HALFTIME_BOSS = 2
    • FINALE_HORDE_ATTACK_1 = 1
    • FINALE_HORDE_ATTACK_2 = 4
    • FINALE_HORDE_ESCAPE = 6
    • SPAWN_ABOVE_SURVIVORS = 6
    • SPAWN_ANYWHERE = 0
    • SPAWN_BEHIND_SURVIVORS = 1
    • SPAWN_FAR_AWAY_FROM_SURVIVORS = 5
    • SPAWN_IN_FRONT_OF_SURVIVORS = 7
    • SPAWN_LARGE_VOLUME = 9
    • SPAWN_NEAR_IT_VICTIM = 2
    • SPAWN_NO_PREFERENCE = -1
    • SPAWN_SPECIALS_ANYWHERE = 4
    • SPAWN_SPECIALS_IN_FRONT_OF_SURVIVORS = 3
    • SPAWN_VERSUS_FINALE_DISTANCE = 8
    • ZOMBIE_TANK = 8
    • ZOMBIE_WITCH = 7

CEntities

Game Instance: Entities

  • Class Methods
    • .FindByClassname (null|prev,classname) - Find entities by class name. Pass 'null' to start an iteration, or reference to a previously found entity to continue a search Continue an iteration over the list of entities, providing reference to a previously found entity
    • .FindByClassnameNearest (classname, vector, radius) - Find the entity of a given class name nearest to a point. If radius is 0, searches the whole map.
    • .FindByClassnameWithin (null|prev, classname, vector, 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. If radius is 0, simply returns FindByClassname()'s result.
    • .FindByModel (null|prev, modelname) - Find entities by model name. Pass 'null' to start an iteration, or reference to a previously found entity to continue a search
    • .FindByName (null|prev, entname) - Find named entities. Pass 'null' to start an iteration, or reference to a previously found entity to continue a search.
    • .FindByNameNearest (name, vector, radius) - Find the entity nearest to a given point. If radius is 0, searches the whole map.
    • .FindByNameWithin (null|prev, name, vector, 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. If radius is 0, simply returns FindByName()'s result.
    • .FindByTarget (null|prev, targetname) - Find entities by target. Pass 'null' to start an iteration, or reference to a previously found entity to continue a search
    • .FindInSphere (null|prev, vector, radius) - Find entities within a radius. Pass 'null' to start an iteration, or reference to a previously found entity to continue a search.
    • .IsValid() - whether entity is valid
    • .First() - Begin an iteration over the list of entities
    • .Next(null|prev) - Returns the next entity in the Entities list

CBaseEntity

Game Instance: N/A

  • Class Methods
    • .__KeyValueFromInt(key,int) - Sets a keyvalue from an integer, the keys available for all __KeyValue are from the DEFINE_KEYFIELD in baseentity.cpp (classname,rendermode, renderfx, etc.)
    • .__KeyValueFromString(key,string) - Sets a keyvalue from a string, the keys available for all __KeyValue are from the DEFINE_KEYFIELD in baseentity.cpp (classname,rendermode, renderfx, etc.)
    • .__KeyValueFromVector(key,vector) - Sets a keyvalue from a vector, the keys available for all __KeyValue are from the DEFINE_KEYFIELD in baseentity.cpp (classname,rendermode, renderfx, etc.)
    • .ConnectOutput(outputname,functioname) - Adds an I/O connection that will call the named function when the specified output fires
    • .DisconnectOutput(event) - Removes a connected script function from an I/O event
    • .FirstMoveChild() - returns entity's first move child if exists
    • .GetClassname() - returns classname
    • .GetForwardVector() - returns Vector instance
    • .GetHealth() - returns entity health
    • .GetMoveParent() - If in hierarchy, retrieves the entity's parent
    • .GetName() - returns targetname of entity (if entity is named)
    • .GetOrigin() - returns origin vector
    • .GetPreTemplateName - Get the entity name stripped of template unique decoration. ie myitem&0125 returns myitem
    • .GetRootMoveParent() - If in hierarchy, walks up the hierarchy to find the root parent
    • .GetScriptId() - Retrieve the unique identifier used to refer to the entity within the scripting system
    • .GetScriptScope() - Retrieve the script-side data associated with an entity
    • .GetVelocity() - returns velocity vector
    • .IsValid() - whether entity is valid
    • .NextMovePeer - returns next child entity
    • .SetForwardVector(vector) - Set the orientation of the entity to have this forward vector
    • .SetHealth(int) - sets entity health
    • .SetOrigin(vector) - sets entity position in world
    • .SetVelocity(vector) - sets entity velocity
    • .ValidateScriptScope - Ensure that an entity's script scope has been created
Functions
  • function OnPostSpawn()
If you declare a function OnPostSpawn() in your vscript, when the entity that is using the script is spawned, it will run this function automatically. You could use this to have an entity register itself with a master script or just do whatever needed to be down immediately after spawn.

CEnvEntityMaker

  • Class Methods
    • SpawnEntity() - Create an entity at the location of the maker
    • SpawnEntityAtEntityOrigin(handle) - Create an entity at the location of a specified entity instance
    • SpawnEntityAtLocation(Vector, Vector) - Create an entity at a specified location and orientaton, orientation is Euler angle in degrees (pitch, yaw, roll)
    • SpawnEntityAtNamedEntityOrigin(string) - Create an entity at the location of a named entity

CPointTemplate

Note:These functions apparently work with point_template. In other words, designate a vscript in the entity KeyValues and include the function.
  • function PostSpawn( entities )
Called after the entity was spawned, you could use this to connect outputs or do whatever needs to be done after the entity was created.
function PostSpawn( entities )
{
	foreach( k, v in entities ) //name, ent ref
	{
		printl( k + ": " + v );
	}
}
  • function PreSpawnInstance(entityClass, entityName)
If this is defined, it will be called right before the entity is created, any key,values returned will be assigned to the entity.
function PreSpawnInstance( entityClass, entityName )
{
return { 
   rendercolor = "0 255 0"
   targetname = "blah"
};	
}
You could use this to dynamically assign target names, colors, even models. Unfortunately, models don't work like you would think. Yes, you can change that gas tank into a football model, will even keep the weapon_gascan class, but it won't behave like one. Also tested this out on zombie spawners, but unfortunately, they don't use these hooks which is a shame, because how cool would it have been to have 3 tank models in play at once?

CBaseAnimating

Extends CBaseEntity

  • Class Methods
    • .__KeyValueFromInt(key,int) - Sets a keyvalue from an integer, the keys available for all __KeyValue are from the DEFINE_KEYFIELD in baseentity.cpp (classname,rendermode, renderfx, etc)
    • .__KeyValueFromString(key,string) - Sets a keyvalue from a string, the keys available for all __KeyValue are from the DEFINE_KEYFIELD in baseentity.cpp (classname,rendermode, renderfx, etc)
    • .__KeyValueFromVector(key,vector) - Sets a keyvalue from a vector, the keys available for all __KeyValue are from the DEFINE_KEYFIELD in baseentity.cpp (classname,rendermode, renderfx, etc)
    • .ConnectOutput(outputname,functioname) - Adds an I/O connection that will call the named function when the specified output fires
    • .DisconnectOutput(event) - Removes a connected script function from an I/O event
    • .FirstMoveChild() - returns entity's first move child if exists
    • .GetClassname() - returns classname
    • .GetForwardVector() - returns Vector instance
    • .GetHealth() - returns entity health
    • .GetMoveParent() - If in hierarchy, retrieves the entity's parent
    • .GetName() - returns named (if entity is named)
    • .GetOrigin() - returns origin vector
    • .GetPreTemplateName - Get the entity name stripped of template unique decoration. ie myitem&0125 returns myitem
    • .GetRootMoveParent() - If in hierarchy, walks up the hierarchy to find the root parent
    • .GetScriptId() - Retrieve the unique identifier used to refer to the entity within the scripting system
    • .GetScriptScope() - Retrieve the script-side data associated with an entity
    • .GetVelocity() - returns velocity vector
    • .IsValid() - whether entity is valid
    • .NextMovePeer - returns next child entity
    • .SetForwardVector(vector)
    • .SetHealth(int) - sets entity health
    • .SetOrigin(vector) - sets entity position in world
    • .SetVelocity(vector) - sets entity velocity
    • .ValidateScriptScope - Ensure that an entity's script scope has been created

CNavMesh

Game Instance: NavMesh

  • Class Methods
    • .IsValid
    • .UnblockRescueVehicleNav() - Removes the block for rescue vehicle. Normally is blocked before the finale is finished, but is necessary for bots to access like in the Atrium finale, c1m4_atrium.bsp.

CCallChainer

Game Instance: N/A

  • Class Methods
    • .chains
    • .constructor
    • .PostScriptExecute
    • .prefix
    • .scope

CSimpleCallChainer

  • Class Methods
    • .Call
    • .chain
    • .constructor
    • .exactMatch
    • .PostScriptExecute
    • .prefix
    • .scope

regxp

To do Game Instance:

  • Class Methods

Vector

Game Instance: None

  • Class Methods
    • .constructor
    • .Cross
    • .Dot
    • .Length
    • .Length2D
    • .Length2DSqr
    • .LengthSqr
    • .Norm
    • .ToKVString

Functions

  • Assert(value, "optional message") - test value and if not true, throws exception, optionally with messsage
  • ConnectOutputs(table) - sets output functions for entity by table TODO
  • DebugDrawBox(Vector, Vector, Vector, int, int, int, int, float) - Draw a debug overlay box
  • DebugDrawLine(Vector, Vector, int, int, int, bool, float) - Draw a debug overlay line
  • Developer() - returns 1 or TRUE when in developer mode
  • DoEntFire( target.tostring(), action, value, delay, activator, caller ) - Fire an event
  • EntFire(target, action, value, delay, activator) - "ent_fire target event" - wrapper for DoEntFire() that sets activator and caller to null
  • DoIncludeScript(string, caller) - Execute a script (internal)
  • IncludeScript - Wrapper for DoIncludeScript
  • GetFunctionSignature
  • Msg("message here") - prints message to console
  • printl("message") - prints message with carriage return
  • RandomFloat() - Returns a random float
  • RandomFloat(float, float) - Generate a random floating point number within a range, inclusive
  • RandomInt() - Returns a random int between 0 and 32767
  • RandomInt(int, int) - Generate a random integer within a range, inclusive
  • RetrieveNativeSignature
  • SendToConsole("string")- send a string to the console as a command
  • ShowMessage("message") - Print a hud message on all clients
  • Time() - Get the current server time
  • DoUniqueString - Called by UniqueString, prob want to call that instead
  • UniqueString() - 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.

<Squirrel Language>Standard Squirrel library functions (consult official Squirrel language league for more details): abs, acos, array, asin , assert, atan , atan2, ceil, collectgarbage, compilestring, cos, exp , fabs , floor, format, getconsttable, getroottable, getstackinfos, log, log10, lstrip, pow, print, rand, rstrip, setconsttable, seterrorhandler, setroottable, type, sin, split, sqrt, srand, strip, suspend, tan

Constants

To do: Add Constants

See also

External links

Alternative Documentation
Deciphered Official Scripts
<Squirrel Language>+<Left 4 Dead 2> = Pnkhrt-16px.png