Left 4 Dead 2 Guide

VSLib Developer Guide - Damage, Update, Chat Hooks

Sharing is temporarily disabled

Left 4 Dead 2 Guide

InterceptChat() Hooks

Sometimes, you just want plain 'ol Valve InterceptChat(). You can access this by typing the following:
// str is the original string, and srcEnt is the CBaseEntity object that spoke function MyInterceptChat ( str, srcEnt ) { ... } // Add the intercept chat hook EasyLogic.AddInterceptChat ( MyInterceptChat ); // And here's how you remove the hook if needed EasyLogic.RemoveInterceptChat ( MyInterceptChat );
Using this approach, you can have as many InterceptChat functions as you want...

AllowTakeDamage() Hooks

Creating the Hooks

The process for damage hooking is pretty simple. Just create a function somewhere with the following template:
function EasyLogic::OnTakeDamage::YourFunctionName ( damageTable ) { ... your code AllowTakeDamage code ... }
You can have as many as you want. Just be sure to change the function name each time.


Filtering by Classname

There's also a handy feature to filter damage notifications by classname. For example, to only receive damage notifications on players and prop_physics:
// For dynamic props function EasyLogic::OnDamage::prop_physics ( victim, attacker, damageDone, damageTable ) { ... your code for prop_physics damage calculation ... } // For players function EasyLogic::OnDamage::player ( victim, attacker, damageDone, damageTable ) { ... your code for player damage calculation ... }
You can define as many different classnames as you want, mix and match with the previous OnTakeDamage hooks, and whatnot. Hopefully that made sense.

Update() Hooks

Same process. Just create a function somewhere with the following template:
function EasyLogic::Update::YourFunctionName ( ) { ... your Update code ... }
You can have as many as you want. Just be sure to change the function name each time.

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

    7,424
  • 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...

    22,215
  • 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 _____________________________________________________________________________...

    14,098
  • 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...

    29,364
  • 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...

    26,133

Feedback

Be the first to post a comment!