RuneWiki Mechanics/Scratchpad


From RuneWiki

There needs to be a zone system tracking nearby entities.

Entities can be players, NPCs, projectiles, locs, or objstacks.

Locs need to be tracked as entities because the client maps have a fixed state of locs to start. When you operate a door, or chop down a tree, the loc gets replaced with a different one. The server needs to send the difference in state to the client when they're in range.

There are different types of interactions that can cause a script to be added to the player's script queue.

The x corresponds to a specific option element defined in the cache/code (1 - 5).

OPPLAYERx: Attack, trade, follow, ... on a player

OPNPCx: Attack, talk-to, ... on a NPC

OPLOCx: Open, Pray-at, Search, ... on a loc

OPOBJx: Light, ... on a objstack

OPHELDx: Eat, drink, identify, ... on a inv obj in the backpack interface

IF_BUTTONx: Used for interface inv obj options (like make 5, sell 5, store 5) - NOT the backpack interface

The packets may be called OP, but the scripting system interprets what kind of state they're really in. If the player needs to walk to the location then it will trigger a [ap*] script if one exists. If the player is within (melee) range of the target, then it will trigger a [op*] script if one exists.

OP: Operable (able to be used).

AP: Approachable (can be used when within range).