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}}
+
{{article unfinished}}
==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 | 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===
+
== 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 | 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
 
* Pattern - script string
* Script owner - entity that owns script
+
* Script owner - entity that owns pattern comparison
 
* Script activator - entity that launched comparison event
 
* Script activator - entity that launched comparison event
  
===Script rules===
+
=== Script rules ===
 
* Instructions are case sensative
 
* Instructions are case sensative
* Operators (excluding ''('' and '')'') should be separated with space or tab.
+
* Operators (excluding ''()'') should be separated by space or tab.
 
* Null script always returns 1
 
* Null script always returns 1
  
Line 24: Line 25:
 
   (night & fullmoon) | raining
 
   (night & fullmoon) | raining
  
==Operators==
+
== Operators ==
 
{| 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=10% | Operator
 
! width=10% | Operator
Line 91: Line 92:
 
|}
 
|}
  
==Functions==
+
== Functions ==
  
 
Set of functions is determined by pattern implementation. There is two pattern implementations as of yet.
 
Set of functions is determined by pattern implementation. There is two pattern implementations as of yet.
  
===GenericPattern===
+
=== GenericPattern ===
  
 
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]].
  
'''true'''
+
{| width=800 border=1 cellspacing=0 cellpadding=5 style="border-collapse: collapse"
:Always yes
+
! width=25% | Operator
 
+
! width=75% | Check for
'''false'''
+
|-
:Always no
+
| '''true'''
 
+
| Always yes
'''self'''.''field''
+
|-
:Checks one of the field of script owner. Fields could be:
+
| '''false'''
:* '''found''' - entity exists
+
| Always no
:* '''touchable''' - entity is touchable trigger or zone
+
|-
:* '''fired''' - trigger is deactivated. This is only applicable to: trigger_once, trigger_redirect, trigger_multi
+
| colspan=2 class=shadow | Entity checks
:* '''solved''' - puzzle trigger is solved. This is only applicable to: trigger_puzzle
+
|-
:* '''killed''' - entity was killed (deadflag is set)
+
| '''self'''.''field''
:* '''dist''' ''x'' ''operator'' - check distance to activator
+
| Checks one of the field of script owner. Fields could be:
:* '''deadtime''' ''x'' ''operator'' - check time enemy being dead
+
* '''found''' - entity exists.
 
+
* '''touchable''' - entity is touchable trigger or zone.
'''enemy'''.''field''
+
* '''fired''' - trigger is deactivated. This is only applicable to: trigger_once, trigger_redirect, trigger_multi.
:Check field of script owner enemy. See fields list above.
+
* '''solved''' - puzzle trigger is solved. This is only applicable to: trigger_puzzle.
 
+
* '''killed''' - entity was killed (deadflag is set).
'''target<'''''name'''''>'''.''field''
+
* '''dist''' ''x'' ''operator'' - check distance to activator.
:Find entity by targetname (return first match). See fields list above.
+
* '''deadtime''' ''x'' ''operator'' - check time enemy being dead.
 
+
|-
'''enemy<'''''radius'''''>'''.''field''
+
| '''enemy'''.''field''
:Find enemy of script owner within given radius. See fields list above.
+
| Check field of script owner enemy. See fields list above.
 
+
|-
'''sid<'''''name'''''>'''.''field''
+
| '''target<'''''name'''''>'''.''field''
:Find entity by [[SaveId]]. See fields list above.
+
| Find entity by targetname (return first match). See fields list above.
 
+
|-
'''player'''
+
| '''enemy<'''''radius'''''>'''.''field''
:Script activator is player.
+
| Find enemy of script owner within given radius. See fields list above.
 
+
|-
'''monster'''
+
| '''sid<'''''name'''''>'''.''field''
:Script activator is [[Radiant/Glossary | NPC]].
+
| Find entity by [[SaveId]]. See fields list above.
 
+
|-
'''posessed'''
+
| colspan=2 class=shadow | Activator checks
:Script activator is  [[Radiant/Glossary | NPC]] posessed by player.
+
|-
 
+
| '''player'''
'''info''' ''infoportion''
+
| Script activator is player.
:Activator has this [[Infoportions | infoportion]]
+
|-
 
+
| '''monster'''
'''infovalue''' ''infoportion'' ''operator''
+
| Is [[Radiant Glossary | NPC]].
:Infoportion value comparison (false is always returned is there is no such infoportion).
+
|-
 
+
| '''posessed'''
'''morning'''
+
| Is [[Radiant Glossary | NPC]] posessed by player.
:[[Gametime]] hour is within 5.00 - 9.59.
+
|-
 +
| '''info''' ''infoportion''
 +
| Activator has this [[Infoportion | infoportion]]
 +
|-
 +
| '''infovalue''' ''infoportion'' ''operator''
 +
| Infoportion value comparison (false is always returned is there is no such infoportion).
 +
|-
 +
| colspan=2 class=shadow | [[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).
 +
|-
 +
| colspan=2 class=shadow | Other checks
 +
|-
 +
| '''raining'''
 +
| Check if it is raining or snow.
 +
|}
  
'''day'''
 
:Gametime hour is within 10.00 - 18.59.
 
  
'''evening'''
+
=== GamemodelHitPattern ===
:Gametime hour is within 19.00 - 22.59.
+
  
'''night'''
+
{{hidden begin | GamemodelHitPattern functions}}
:Gametime hour is within 23.00 - 4.59.
+
{| width=800 border=1 cellspacing=0 cellpadding=5 style="border-collapse: collapse"
 
+
! width=25% | Operator
'''hour''' x ''operator''
+
! width=75% | Check for
:Gametime hour is within some bounds.
+
|-
 
+
| '''true'''
'''time''' x ''operator''
+
| Always yes
:Gametime check using string gametime representation. All operators are supported.
+
|-
 
+
| '''false'''
'''daytime''' x ''operator''
+
| Always no
:Gametime check using float gametime representation (daytime).
+
|-
 
+
| '''pushonly'''
'''moontime''' x ''operator''
+
| System word. Allows to push object but not destroy. This should be the first operator in expression if used.
:Gametime check using float gametime representation (moontime).
+
|-
 
+
| '''tag_''tagname'''''
'''fullmoon'''
+
| Returns true if model tag closest to hit position matches this tag. Otherwise 0.
:Moon is on full state (note that moon can be on full state at day).
+
|-
 
+
| '''''number''%'''
'''newmoon'''
+
| Randomly returns true with this chance percentage. Typical values are 25%, 50%, 90% etc.
:Moon is on null state.
+
|-
 
+
| '''''damagetype'''''
'''raining'''
+
| Weapon that was used to hit model have this damage type. Damagetype should be one of following constants:
:Check if it is raining or snow.
+
* '''slash''' - sword
 
+
* '''crush''' - mace
===GamemodelHitPattern===
+
* '''crushblow''' - mace special hit
 
+
* '''hack''' - axe
'''true'''
+
* '''impale''' - throwing knifes, arrows
:Always yes
+
* '''teeth''' - animals
 
+
* '''claw''' - animals, wolf form
'''false'''
+
* '''water''' - water damage
:Always no
+
* '''energy''' - energy bolts, magic missiles
 
+
* '''spikes''' - spike zones
'''pushonly'''
+
* '''flame''' - fire, flame sword
:System word. Allows to push object but not destroy. This should be the first operator in expression if used.
+
* '''flaying''' - flay artefact
 
+
* '''imploding''' - implode artefact
'''tag_''tagname'''''
+
* '''soulreaver''' - soul reaver magic attack
:Returns true if model tag closest to hit position matches this tag. Otherwise 0.
+
|}
 
+
{{hidden end}}
'''''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==
+
== See also ==
 
* [[Trigger event]]
 
* [[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