mirror of
https://github.com/mapbase-source/source-sdk-2013.git
synced 2024-12-24 13:55:31 +03:00
Page:
VScript Filters
Pages
Base Animating
Base Combat Character
Base Entity
Base NPC
Base Weapon
Convar Lookup
Debug Commands
Drawing entities in specific view IDs
Entity List
Enum Reference
Filters
Frequently Asked Questions (FAQ)
Gameplay Changes
Graphical Changes
Home
How Mapbase can be used in specific settings
I O System Changes
Introduction to Mapbase
List of Modified Source Files
Map Compilers
Map Specific Scripts
Mapbase Credits
Mapbase Disclaimers
Mapbase Multi Tool
Mapbase Setup Troubleshooting
Media Resources
Modding with Mapbase
Prefabs and workarounds obsoleted by Mapbase
Projected textures
RPC Integration (Discord, etc.)
Reviewing Mapbase pull requests
Setting up Mapbase
Shader Changes
Skyboxes
Using Git with Mapbase
Using Mapbase Content
Using VScript as a HL2 mapper
VScript Basic Entity Code Tutorial
VScript Basic IO Tutorial
VScript Filters
VScript VScriptProxy
VScript in Mapbase
Wildcards and Matchers
math_lightpattern
1
VScript Filters
Blixibon edited this page 2021-03-13 11:12:12 -06:00
Table of Contents
Mapbase associates filters with VScript in a few different ways.
Functions
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
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