Pattern script
From Blood Wiki
(Difference between revisions)
(→GamemodelHitPattern) |
(→GamemodelHitPattern) |
||
Line 192: | Line 192: | ||
=== GamemodelHitPattern === | === GamemodelHitPattern === | ||
− | + | '''true''' | |
:Always yes | :Always yes | ||
Line 198: | Line 198: | ||
:Always no | :Always no | ||
− | + | '''pushonly''' | |
− | + | :System word. Allows to push object but not destroy. This should be the first operator in expression if used. | |
− | + | ||
− | + | '''tag_''tagname''''' | |
− | + | :Returns true if model tag closest to hit position matches this tag. Otherwise 0. | |
− | + | ||
− | + | '''''number''%''' | |
− | + | :Randomly returns true with this chance percentage. Typical values are 25%, 50%, 90% etc. | |
− | + | ||
− | + | '''damagetype''' | |
− | + | :Weapon that was used to hit model have this damage type. Damagetype should be one of following constants: | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
* '''slash''' - sword | * '''slash''' - sword | ||
* '''crush''' - mace | * '''crush''' - mace | ||
Line 234: | Line 223: | ||
* '''imploding''' - implode artefact | * '''imploding''' - implode artefact | ||
* '''soulreaver''' - soul reaver magic attack | * '''soulreaver''' - soul reaver magic attack | ||
− | |||
{{hidden end}} | {{hidden end}} | ||
== See also == | == See also == | ||
* [[Trigger event]] | * [[Trigger event]] |
Revision as of 02:38, 18 July 2012
Contents |
Introduction
Pattern scripts is special kind of expressions that returns 1 or 0. Script can check and combine wide range of conditions (gametime, special parms of entities, infoportions etc.). Patters script are used for enemy appearance, gamemodel damage masks, trigger touchability and other events which only need to control availability of some action.
Script input
- Pattern - script string
- Script owner - entity that owns pattern comparison
- Script activator - entity that launched comparison event
Script rules
- Instructions are case sensative
- Operators (excluding ()) should be separated by space or tab.
- Null script always returns 1
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 |
---|---|---|
Logical operators (only applicable between expressions) | ||
( ) | (expression) | Expression |
& | x & y | Logical 'And'. |
| | x | y | Logical 'Or'. |
not | x & not y | Logical Not. |
Comparison operators | ||
= | x = y | Equal |
!= | x != y | Not equal |
> | x > y | Greater |
>= | x >= y | Greater or equal |
< | x < y | Lesser |
<= | x <= y | Lesser or equal |
>< | x >< start end | x > start And x < end |
=>< | x =>< start end | x >= start And x < end |
><= | x ><= start end | x > start And x <= end |
=><= | 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.
Operator | Check for |
---|---|
true | Always yes |
false | Always no |
Entity checks | |
self.field | Checks one of the field of script owner. Fields could be:
|
enemy.field | Check field of script owner enemy. See fields list above. |
target<name>.field | Find entity by targetname (return first match). See fields list above. |
enemy<radius>.field | Find enemy of script owner within given radius. See fields list above. |
sid<name>.field | Find entity by SaveId. See fields list above. |
Activator checks | |
player | Script activator is player. |
monster | Is NPC. |
posessed | Is NPC posessed by player. |
info infoportion | Activator has this infoportion |
infovalue infoportion operator | Infoportion value comparison (false is always returned is there is no such infoportion). |
Gametime checks | |
fullmoon | Moon is on full state (note that moon can be on full state at day). |
newmoon | Moon is on null state. |
morning | Gametime hour is within 5.00 - 9.59. |
day | Gametime hour is within 10.00 - 18.59. |
evening | Gametime hour is within 19.00 - 22.59. |
night | Gametime hour is within 23.00 - 4.59. |
hour x operator | Gametime hour is within some bounds. |
time x operator | Gametime check using string gametime representation. All operators are supported. |
daytime x operator | Gametime check using float gametime representation (daytime). |
moontime x operator | Gametime check using float gametime representation (moontime). |
Other checks | |
raining | Check if it is raining or snow. |
GamemodelHitPattern
true
- Always yes
false
- Always no
pushonly
- System word. Allows to push object but not destroy. This should be the first operator in expression if used.
tag_tagname
- Returns true if model tag closest to hit position matches this tag. Otherwise 0.
number%
- Randomly returns true with this chance percentage. Typical values are 25%, 50%, 90% etc.
damagetype
- Weapon that was used to hit model have this damage type. Damagetype should be one of following constants:
- slash - sword
- crush - mace
- crushblow - mace special hit
- hack - axe
- impale - throwing knifes, arrows
- teeth - animals
- claw - animals, wolf form
- water - water damage
- energy - energy bolts, magic missiles
- spikes - spike zones
- flame - fire, flame sword
- flaying - flay artefact
- imploding - implode artefact
- soulreaver - soul reaver magic attack
</div></div>