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

VSLib Developer Guide - Damage, Update, Chat Hooks
- 10.7K
- 0
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.
Be the first to post a comment!