Encounter scripts are quest scripts that are only loaded after explicitly called with:
They will load one and only one from the following location. Which ever it finds first in the following order:
Encounter scripts listen for specific events from other script types with the following functions:
Void register_npc_event(String name, Integer evt, Integer npc_id, luafunction func);
Void register_player_event(String name, Integer evt, luafunction func);
Void register_item_event(String name, Integer evt, Integer item_id, luafunction func);
Void register_spell_event(String name, Integer evt, Integer spell_id, luafunction func);
Note: Passing a value of -1 for npc, item or spell id to watch will watch every npc, item or spell for those events.
- Encounter scripts cannot properly catch EVENT_COMMAND or EVENT_TRADE unless an existing quest is already listening for them.
- Encounter scripts also run before any normal script.