OnTouch:
/ OnTouchNPC:
/ OnUnTouch:
¶
Syntax¶
Description¶
Defines an area that when walked into will trigger one of two event labels. If it is a Player, trigger OnTouch:
label. If it is a monster, trigger OnTouchNPC:
label.
The OnUnTouch:
label works opposite way. This label trigger when a player leave the area.
Calculating spawned area==¶
[[File:Ontouch.jpg|thumbnail|A 7*7 area spawned by X:3 Y:3]]
These triggers will define an area, centered on the NPC and spanning triggerX
cells in every direction across X coordinate axis and triggerY
cells in every direction across Y coordinate axis. Thus each one will have N*2 cells, where N is triggerX
or triggerY
, plus the one that the NPC is.
Unlike in arithmetics X and Y will also be taken into account when calculating the area that will trigger the NPC. There are four quadrants, each with triggerX * triggerY
cells plus both axes.
Note
Note that each coordinate is a cell and does not represent map coordinates!
A simple way to measure the area of any polygon that will be covered by OnTouch
is (triggerX * 2 + 1) * (triggerY * 2 + 1)
Tip
Trick: Using end;
at the beginning of the script stops players from executing the script by clicking on the NPC, so they can only execute it if they walk into the specified area.
Event labels¶
Two event labels are defined and each one handles one of two block types BL_PC
or BL_MOB
id est a player or a mob.
Info
Handles player types (BL_PC
)
Info
Handles mob types (BL_MOB)
If no trigger label is defined the code will execute from the beginning of the script, the same way that it would if someone clicked on the NPC.