Editing Pattern script

Jump to: navigation, search

Warning: You are not logged in.

Your IP address will be recorded in this page's edit history.
The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.
Latest revision Your text
Line 1: Line 1:
{{TOCRIGHT}}
+
= Introduction =
==Introduction==
+
Pattern script is special kind of expressions that returns 1 or 0. Pattern scripts are used to determine availability of some functionality or event.
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 | infoportions]] etc.). Pattern 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 scripts are used:
* Pattern - script string
+
* Script owner - entity that owns script
+
* Script activator - entity that launched comparison event
+
  
===Script rules===
+
* By monsters to check if its a time to spawn/hide
* Instructions are case sensative
+
* By gamemodels to check if it could be hit by certain weapon
* Operators (excluding ''('' and '')'') should be separated with space or tab.
+
* Null script always returns 1
+
  
Basic syntax:
+
= Operators =
  
  // this script check if its a night or if there is an enemy within 300 units
+
{| border=1 cellspacing=0 cellpadding=3 style="border-collapse: collapse" width=60%
  night | enemy<300>.found
+
! width=5% | Operator
 
+
! width=10% | Description
  // this scripts check if gametime is between 12 and 14 hours
+
! width=5% | Operator
  hour =><= 12 14
+
! width=10% | Description
 
+
! width=5% | Operator
  // this script check if it's fullmoon night or raining
+
! width=10% | Description
  (night & fullmoon) | raining
+
 
+
==Operators==
+
{| width=800 border=1 cellspacing=0 cellpadding=5 style="border-collapse: collapse"
+
! width=10% | Operator
+
! width=20% | Example
+
! width=70% | Description
+
 
|-
 
|-
| colspan=3 class=shadow | Logical operators (only applicable between expressions)
+
| ( ''expression'' )  
|-
+
| align=center | '''( )'''
+
| align=center | '''('''''expression''''')'''
+
 
| Expression
 
| Expression
 
|-
 
|-
| align=center | '''&'''
+
| &  
| align=center | x '''&''' y
+
| Logic 'And'
| Logical 'And'.
+
 
|-
 
|-
| align=center | '''|'''
+
| |
| align=center | x '''|''' y
+
| Logic 'Or'
| Logical 'Or'.
+
 
|-
 
|-
| align=center | '''not'''
+
| >
| align=center | x & '''not''' y
+
| Bigger
| Logical Not.
+
 
|-
 
|-
| colspan=3 class=shadow | Comparison operators
+
| <  
|-
+
| align=center | '''='''
+
| align=center | x '''=''' y
+
| Equal
+
|-
+
| align=center | '''!='''
+
| align=center | x '''!=''' y
+
| Not equal
+
|-
+
| align=center | '''>'''
+
| align=center | x '''>''' y
+
| Greater
+
|-
+
| align=center | '''>='''
+
| align=center | x '''>=''' y
+
| Greater or equal
+
|-
+
| align=center | '''<'''
+
| align=center | x '''<''' y
+
 
| Lesser
 
| Lesser
|-
 
| align=center | '''<='''
 
| align=center | x '''<=''' y
 
| Lesser or equal
 
|-
 
| align=center | '''><'''
 
| align=center | x '''><''' start end
 
| x > start And x < end
 
|-
 
| align=center | '''=><'''
 
| align=center | x '''=><''' start end
 
| x >= start And x < end
 
|-
 
| align=center | '''><='''
 
| align=center | x '''><=''' start end
 
| x > start And x <= end
 
|-
 
| align=center | '''=><='''
 
| align=center | 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, [[Zones | zone appearance]].
 
 
'''true'''
 
:Always yes
 
 
'''false'''
 
:Always no
 
 
'''self'''.''field''
 
:Checks one of the field of script owner. Fields could be:
 
:* '''found''' - entity exists
 
:* '''touchable''' - entity is touchable trigger or zone
 
:* '''fired''' - trigger is deactivated. This is only applicable to: trigger_once, trigger_redirect, trigger_multi
 
:* '''solved''' - puzzle trigger is solved. This is only applicable to: trigger_puzzle
 
:* '''killed''' - entity was killed (deadflag is set)
 
:* '''dist''' ''x'' ''operator'' - check distance to activator
 
:* '''deadtime''' ''x'' ''operator'' - check time enemy being dead
 
 
'''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.
 
 
'''player'''
 
:Script activator is player.
 
 
'''monster'''
 
:Script activator is [[Radiant/Glossary | NPC]].
 
 
'''posessed'''
 
:Script activator is  [[Radiant/Glossary | NPC]] posessed by player.
 
 
'''info''' ''infoportion''
 
:Activator has this [[Infoportions | infoportion]]
 
 
'''infovalue''' ''infoportion'' ''operator''
 
:Infoportion value comparison (false is always returned is there is no such infoportion).
 
 
'''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).
 
 
'''fullmoon'''
 
:Moon is on full state (note that moon can be on full state at day).
 
 
'''newmoon'''
 
:Moon is on null state.
 
 
'''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
 
 
==See also==
 
* [[Trigger event]]
 

Please note that all contributions to Blood Wiki are considered to be released under the Creative Commons Attribution Share Alike (see BloodWiki:Copyrights for details). If you do not want your writing to be edited mercilessly and redistributed at will, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource. Do not submit copyrighted work without permission!

Cancel | Editing help (opens in new window)

Template used on this page:

Personal tools
Namespaces

Variants
Actions
Navigation
Toolbox