Uh oh!
There was an error while loading. Please reload this page.
forked from ValveSoftware/source-sdk-2013
- Notifications
You must be signed in to change notification settings - Fork 172
VScript Filters
Blixibon edited this page Mar 13, 2021
·
1 revision
Mapbase associates filters with VScript in a few different ways.
Mapbase adds a few new functions which could be used on entity handles in VScript code:
PassesFilterPassesDamageFilterPassesFinalDamageFilterBloodAllowedDamageMod
These are documented in more detail on the VScript in Mapbase article. They can be used like this:
functionCheckIfPassFilter( entity )
{
local filter = Entities.FindByName(null,"filter_acceptable")
if ( filter !=null )
{
return filter.PassesFilter( self, entity )
}
else
{
returnfalse;
}
}filter_script is a new filter entity which uses its entity scripts for all regular filter functions, including functions new with Mapbase.
For example, the following code uses the PassesFilter hook to only pass activators with a weapon that has <10 ammo in it:
functionPassesFilter()
{
if (activator.GetActiveWeapon())
{
local ammo = activator.GetActiveWeapon().Clip1()
if (ammo <10)
{
printl("Has weapon with <10 ammo, damaging")
returntrue;
}
else
{
printl("Has weapon with "+ ammo +" ammo, no damage")
returnfalse;
}
}
printl("Returning false")
returnfalse;
}