Left 4 Dead 2 Guide

VSLib Developer Guide - Utilities

Sharing is temporarily disabled

Left 4 Dead 2 Guide

Utilities

Here are a couple of utilities that you can use.

Click here for a complete list.

String Functions

- Utils.StringReplace( string, find, replace ) - Allows you to find and replace portions of a string.

- Utils.CombineArray( array, delimiter = " " ) - Combines all the elements of an array into one string delimited by spaces.

- Utils.BuildProgressBar(width, count, goal, fill = "|", empty = ".") - Builds a textual progress bar.

Print Functions

-printf( string, ... ) - C style printf function with up to 12 arguments; prints to console

-Utils.SayToAll( string, ... ) - C style printf function that prints to the chatbox

-Utils.SayToAllDel( string, ... ) - C style printf function that prints to the chatbox with a 100 ms delay.

-Utils.SayToTeam(player, string, ...) - C style printf function that prints something to the specified src entity's (VSLib.Player) team

-Utils.SayToTeamDel(player, string, ...) - C style printf function that prints something to the specified src entity's (VSLib.Player) team with 100 ms delay

Spawn Functions

-Utils.CreateEntity( classname, spawnPos = Vector(0,0,0), angles = Vector(0,0,0), otherKeyValues = { } ) - Creates a new entity with the specified keyvalues and returns the VSLib.Entity to you.

-Utils.SpawnL4D1Survivor( survivor = BILL, spawnPos = Vector(0,0,0), angles = Vector(0,0,0) ) - Spawns a L4D1 survivor at the specified location with the specified angles: BILL, ZOEY, FRANCIS, and LOUIS

-Utils.SpawnZombie(pos, zombieType = "default", attackOnSpawn = true) - Spawns a zombie at the specified location with info_zombie_spawn.

-Utils.SpawnZombieNearPlayer( player, zombieNum, maxDist = 128, minDist = 32 ) - Spawns the requested zombie near a player and also checks to make sure that the spawn point is not visible to any survivor. Attempts to locate a position 20 times. If it can't find a suitable spawn location, it'll return false. Keep in mind that the closer the min and max distances are to each other, the lesser the chance that a suitable spawn will be found. For a good spawn chance, keep the min and max dist far apart. If by chance the survivors are looking everywhere at once, the infected prob won't spawn!

Math Functions

-Utils.CalculateDistance(vec1, vec2) - Calculates the distance between two vectors.

-Utils.VectorDotProduct(a, b) - Calculates the dot product of two vectors.

-Utils.VectorCrossProduct(a, b) - Calculates the cross product of two vectors.

-Utils.VectorFromQAngle(angles, radius = 1.0) - Converts QAngles into vectors, with an optional vector length.

Misc Functions

-Utils.SearchMainTables ( idx ) - Searches for an index at the root, round vars, and user vars tables.

-Utils.ForcePanicEvent( ) - Forces a panic event.

Tagged

Community Tags

  • VSLib

Guide Credits

You may like

  • Mod
    Anti-Trolls System
    N/A

    This mod made to prevent those team killers(aka Trolls) from killing all teammates and abuse vote system >>This mod is using vscripts. so it can not be used together with any other mods of mine or Vscripts driven mods. Such as Admin Syst...

    6,154
  • Mod
    Brutal Apocalypse
    N/A

    THIS MOD IS USING A VSLIBs scripts. So it might be collided some Vslibs/Vscripts mods THIS MOD DOES NOT WORK ON CUSTOM CAMPAIGNS. ⋙WARNING!!!!⋘ This mod makes the game much more difficult. if you're easy to upset or play serious, you mig...

    20,689
  • Mod
    Augmented Bots
    N/A

    This mod makes bots pretty stronger than vanilla bots Can not use together with other vscripts mods such as Rectus' Custom weapons, Admin System or any other mods of mine Mod Features - Cs weapons are unlocked - Bots have 150 shield po...

    23,740
  • Mod
    Guns+ and SI+
    N/A

    it's a vscripts mod. so, can't be used together with mods that alternate gameplay directly(such as Admin System) but works fine with Weapon Script mods since i didn't use weapon script files Works only on Local Host and Singleplay. Does...

    27,591
  • Mod
    Insanity Worlds
    N/A

    This is a vscripts driven mod Note that this mod doesn't work on any Custom Maps or Official Servers This mod is not mutation. it can runs on every game mode _____________________________________________________________________________...

    12,391

Feedback

Be the first to post a comment!