forked from ValveSoftware/source-sdk-2013
-
Notifications
You must be signed in to change notification settings - Fork 140
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:
PassesFilter
PassesDamageFilter
PassesFinalDamageFilter
BloodAllowed
DamageMod
These are documented in more detail on the VScript in Mapbase article. They can be used like this:
function CheckIfPassFilter( entity )
{
local filter = Entities.FindByName(null,"filter_acceptable")
if ( filter != null )
{
return filter.PassesFilter( self, entity )
}
else
{
return false;
}
}
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:
function PassesFilter()
{
if (activator.GetActiveWeapon())
{
local ammo = activator.GetActiveWeapon().Clip1()
if (ammo < 10)
{
printl("Has weapon with <10 ammo, damaging")
return true;
}
else
{
printl("Has weapon with " + ammo + " ammo, no damage")
return false;
}
}
printl("Returning false")
return false;
}
-
Something Index
- Something special
- Something else