RuneScript/NPC Queues: Difference between revisions
No edit summary |
|||
Line 1: | Line 1: | ||
NPC queues aren’t referenced by names. They are queued by “ID” | NPC queues aren’t referenced by names. They are queued by “ID” (for lack of a better name), this allows NPCs to override global behavior without checking NPC type in each queue. | ||
Processing is done very similarly to players, and will not run if the queue isn’t ready or the NPC is delayed. | Processing is done very similarly to players, and will not run if the queue isn’t ready to execute or the NPC is delayed. | ||
== Command == | == Command == | ||
<code>npc_queue(id, delay, arg);</code> | <code>npc_queue(id, delay, arg);</code> | ||
NPC queues may pass one int argument here for the queue to use. | NPC queues may pass one int argument here for the queue to use. The active NPC pointer must be set. | ||
==== Additional Args ==== | ==== Additional Args ==== | ||
Line 18: | Line 16: | ||
The <code>ai_queue</code> trigger has 20 queue IDs available to use. The trigger’s subject is the NPC type. These queue IDs are arbitrary outside of a few conventions. | The <code>ai_queue</code> trigger has 20 queue IDs available to use. The trigger’s subject is the NPC type. These queue IDs are arbitrary outside of a few conventions. | ||
When the trigger runs, you may use <code>last_int</code> to reference the arg passed to the queue. | |||
There are a few conventions used globally: | There are a few conventions used globally: | ||
Line 29: | Line 27: | ||
<code>[ai_queue8,type]</code> runs on '''bind spells''' - this means something has hit them with a bind spell and movement will be blocked for a period of time. | <code>[ai_queue8,type]</code> runs on '''bind spells''' - this means something has hit them with a bind spell and movement will be blocked for a period of time. | ||
== Hunt Modes == | |||
Hunt modes may be configured to run a queue when they find a target. This allows a developer to implement extra logic before deciding (or not deciding) to attack. |
Revision as of 19:10, 12 January 2025
NPC queues aren’t referenced by names. They are queued by “ID” (for lack of a better name), this allows NPCs to override global behavior without checking NPC type in each queue.
Processing is done very similarly to players, and will not run if the queue isn’t ready to execute or the NPC is delayed.
Command
npc_queue(id, delay, arg);
NPC queues may pass one int argument here for the queue to use. The active NPC pointer must be set.
Additional Args
We do not support this! For documentation purposes only:
Jagex has an asterisked variant of this command that lets you pass additional arguments: npc_queue*(id, delay)(args, …);
Trigger
The ai_queue
trigger has 20 queue IDs available to use. The trigger’s subject is the NPC type. These queue IDs are arbitrary outside of a few conventions.
When the trigger runs, you may use last_int
to reference the arg passed to the queue.
There are a few conventions used globally:
[ai_queue1,type]
runs on retaliate - this means something has hit them and will set their mode to attack back.
[ai_queue2,type]
runs on damage - this means something has hit them and damage is being applied.
[ai_queue3,type]
runs on death - this means something has dropped their health to 0 and will drop items, or advance a player’s quest state.
[ai_queue8,type]
runs on bind spells - this means something has hit them with a bind spell and movement will be blocked for a period of time.
Hunt Modes
Hunt modes may be configured to run a queue when they find a target. This allows a developer to implement extra logic before deciding (or not deciding) to attack.