Pattern script
From Blood Wiki
(Difference between revisions)
(→Functions) |
(→Functions) |
||
Line 111: | Line 111: | ||
This is generic appearance pattern. It used on enemies appearance, [[Zones | zone appearance]]. | This is generic appearance pattern. It used on enemies appearance, [[Zones | zone appearance]]. | ||
+ | {{hidden begin | GenericPattern functions}} | ||
{| width=800 border=1 cellspacing=0 cellpadding=5 style="border-collapse: collapse" | {| width=800 border=1 cellspacing=0 cellpadding=5 style="border-collapse: collapse" | ||
! width=25% bgcolor=#EEDFDF | Operator | ! width=25% bgcolor=#EEDFDF | Operator | ||
Line 140: | Line 141: | ||
| | | | ||
|} | |} | ||
+ | {{hidden end}} | ||
=== GamemodelHitPattern === | === GamemodelHitPattern === | ||
Line 145: | Line 147: | ||
Used on [[misc_gamemodel]] when model is hit. | Used on [[misc_gamemodel]] when model is hit. | ||
+ | {{hidden begin | GamemodelHitPattern functions}} | ||
{| width=800 border=1 cellspacing=0 cellpadding=5 style="border-collapse: collapse" | {| width=800 border=1 cellspacing=0 cellpadding=5 style="border-collapse: collapse" | ||
! width=25% bgcolor=#EEDFDF | Operator | ! width=25% bgcolor=#EEDFDF | Operator | ||
Line 181: | Line 184: | ||
* soulreaver - soul reaver magic attack | * soulreaver - soul reaver magic attack | ||
|} | |} | ||
+ | {{hidden end}} |
Revision as of 23:07, 17 July 2012
Contents |
Introduction
Pattern scripts is special kind of expressions that returns 1 or 0 used to determine availability of some functionality or event. This scripts can check for very wide range of conditions (gametime, special parms of entities, infoportions etc.).
Usage examples:
- Enemy appearance (some enemies are only active at night, some only at day etc.)
- Gamemodels damage masks (checks if could be damaged by certain weapon)
- Checking if trigger could be touched
Basic syntax:
// this script check if its a night or if there is an enemy within 300 units night | enemy<300>.found
// this scripts check if gametime is between 12 and 14 hours hour =><= 12 14
// this script check if it's fullmoon night or raining (night & fullmoon) | raining
Operators
# | Operator | Example | Description |
---|---|---|---|
1 | ( ) | ( expression ) | Expression |
2 | & | x & y | Logical 'And' |
3 | | | x | y | Logical 'Or' |
4 | = | x = y | Equal |
5 | != | x != y | Not equal |
6 | > | x > y | Greater |
7 | >= | x >= y | Greater or equal |
8 | < | x < y | Lesser |
9 | <= | x <= y | Lesser or equal |
10 | not | x & not y | Logical Not |
11 | >< | x >< start end | x > start And x < end |
12 | =>< | x =>< start end | x >= start And x < end |
13 | ><= | x ><= start end | x > start And x <= end |
14 | =><= | x =><= start end | x >= start And x <= end |
Functions
Set of functions is determined by pattern implementation. There is two pattern implementations as of yet.
GenericPattern
This is generic appearance pattern. It used on enemies appearance, zone appearance.
GenericPattern functions
Operator | Description |
---|---|
true | Always returns 1 |
false | Always returns 0 |
self.field | Checks one of the field of script owner. Fields could be:
|
target<name>.field | |
enemy<radius>.field | |
sid<name>.field |
GamemodelHitPattern
Used on misc_gamemodel when model is hit.
GamemodelHitPattern functions
Operator | Description |
---|---|
true | Always returns 1 |
false | Always returns 0 |
pushonly | System word. Allows to push object but not destroy. This should be the first operator in expression if used. |
tag_tagname | Returns 1 if model tag closest to hit position matches this tag. Otherwise 0. |
number% | Randomly returns 1 with this chance percentage. Typical values are 25%, 50%, 90% etc. |
damagetype | Check if weapon have this damage type. Damagetype should be one of following constants:
|