Event Subroutines

This is a listing of the Event Subroutines used in quest scripts. Each of these Events is triggered as an action occurs.

Please note that while every effort is made to keep this wiki up to date, some items may have been overlooked. A complete list can be found in GitHub at Server / zone / embparser.cpp.

ProTip: hit ctrl + f (Windows) or ⌘ + f (Mac) to FIND something on this page

EVENT_AGGRO

Trigger

  • When a mob aggros a client.

Often used for flavor text--just remember that every NPC_Type has an EmoteID that can often handle this behavior.

Example

  • In this example, the NPC will say "Time to die PlayerName." when the NPC is aggro'd by the player.

Perl
Lua
Perl
sub EVENT_AGGRO {
quest::say("Time to die!");
}
Lua
function event_aggro(e)
e.self:Say("Time to die!");
end

EVENT_AGGRO_SAY

Trigger

  • When a mob is targeted, the player types something, and NPC is in combat.

Exports

Name

Type

Usage

data

int

quest::say($data); # returns int

text

int

quest::say($text); # returns int

langid

int

quest::say($langid); # returns int

Example

  • In this example, the NPC, if in combat, would say the names of everyone on its hate list, and include both the amount of damage the entity has done, as well as the amount of hate the entity has generated.

Perl
Lua
Perl
sub EVENT_AGGRO_SAY {
#:: Match "fight", case insensitive, if the NPC aggro
if ($text=~/fight/i) {
quest::say("I am fighting!");
}
}
Lua
function event_aggro_say(e)
if (e.message:findi("fight")) then
e.self:Say("I am fighting!");
end
end

EVENT_ATTACK

Trigger

  • When the NPC is attacked.

Note the subtle difference from EVENT_AGGRO, which is triggered when the NPC is aggro'd (which could occur through bad faction, for instance).

Example

  • In this example, the NPC will say "Time to die PlayerName." when the NPC is attacked by the player.

Perl
Lua
Perl
sub EVENT_ATTACK {
quest::say("Time to die $name.");
}
Lua
function event_attack(e)
e.self:Say("Time to die!");
end

EVENT_AUGMENT_ITEM

Trigger

  • When a client augments an item.

You would likely use this event in your global player.pl file.

Example

  • In this example, a message in yellow text is displayed to the client when the player adds an augment to an item.

Perl
Lua
Perl
sub EVENT_AUGMENT_ITEM{
$client->Message(15, "Yay, it fit!");
}
Lua
function event_augment_item(e)
e.owner:Message(15, "Yay, it fit!");
end

EVENT_AUGMENT_INSERT

Trigger

  • When a client inserts an augment into an item.

You would likely use this event in your global player.pl file.

Example

  • In this example, a message in yellow text is displayed to the client when the player puts the augment into the augment slot of an item.

Perl
Lua
Perl
sub EVENT_AUGMENT_INSERT {
$client->Message(15, "Yay, it fit!");
}
Lua
function event_augment_insert(e)
e.owner:Message(15, "Yay, it fit!");
end

EVENT_AUGMENT_REMOVE

Trigger

  • When a client removes an augment from an item. You would likely use this event in your global player.pl file.

Example

  • In this example, a message in yellow text is displayed to the client when the player removes an augment from an item.

Perl
Lua
Perl
sub EVENT_AUGMENT_REMOVE {
$client->Message(15, "Yay, you pulled it out!");
}
Lua
function event_augment_remove(e)
e.owner:Message(15, "Yay, you pulled it out!");
end

EVENT_BOT_COMMAND

Trigger

  • When a player says anything with the ^ command token preceding it that isn't handled by a system bot command.

  • Exception: ^help will invoke a special call so that scripted bot commands may be included in search listing.

Used in player files to handle script-based bot command processing.

Exports

Name

Type

Details

bot_command

string

A single, de-tokenized bot command name

args (perl)

string

An unseparated text line of additional parameters

args (lua)

string array

An array of single-word text parameters

Example

  • These examples are a working template for adding your own bot commands.

Note: The scripting apis do not fully support the Bot object and scripting options will be limited.

Perl
Lua
Perl
sub EVENT_BOT_COMMAND {
my %bot_command_data = (
"scriptbotcommand1" => [0, "perl script-based supplementation test bot command 1"],
"scriptbotcommand2" => [100, "perl script-based supplementation test bot command 2"],
"scriptbotcommand3" => [250, "perl script-based supplementation test bot command 3"]
);
if ($bot_command eq "help" || $bot_command eq "?") { # always a supplemental call from within the system bot_command_help handler
my $available_bot_commands = 0;
foreach my $bot_command_name (sort {$a cmp $b} keys %bot_command_data) {
if ($status >= $bot_command_data{$bot_command_name}[0] && ($args eq "0" || $bot_command_name=~/$args/i)) {
$client->Message(15, "^$bot_command_name - $bot_command_data{$bot_command_name}[1]");
$available_bot_commands = $available_bot_commands + 1;
}
}
return $available_bot_commands;
}
elsif (exists($bot_command_data{$bot_command}) && $status >= $bot_command_data{$bot_command}[0]) {
if ($bot_command eq "scriptbotcommand1") {
$client->Message(14, "doing '$bot_command'...");
return 1;
}
elsif ($bot_command eq "scriptbotcommand2") {
$client->Message(14, "doing '$bot_command'...");
return 1;
}
elsif ($bot_command eq "scriptbotcommand3") {
$client->Message(14, "doing '$bot_command'...");
return 1;
}
}
return 0;
}
Lua
function event_bot_command(e)
local bot_command_data = {
["scriptbotcommand1"] = {0, "lua script-based supplementation test bot command 1"},
["scriptbotcommand2"] = {100, "lua script-based supplementation test bot command 2"},
["scriptbotcommand3"] = {250, "lua script-based supplementation test bot command 3"}
}
if (e.bot_command == "help" or e.bot_command == "?") then -- always a supplemental call from within the system bot_command_help handler
local available_bot_commands = 0;
local key_sort = {}
for key in pairs(bot_command_data) do
table.insert(key_sort, key);
end
table.sort(key_sort);
for index, key in ipairs(key_sort) do
if (e.self:Admin() >= bot_command_data[key][1] and (e.args[1] == nil or key:findi(e.args[1]))) then
e.self:Message(15, "^" .. key .. " - " .. bot_command_data[key][2]);
available_bot_commands = available_bot_commands + 1;
end
end
return available_bot_commands;
elseif (bot_command_data[e.bot_command] ~= nil and e.self:Admin() >= bot_command_data[e.bot_command][1]) then
if (e.bot_command == "scriptbotcommand1") then
e.self:Message(14, "doing '" .. e.bot_command .. "'...");
return 1;
elseif (e.bot_command == "scriptbotcommand2") then
e.self:Message(14, "doing '" .. e.bot_command .. "'...");
return 1;
elseif (e.bot_command == "scriptbotcommand3") then
e.self:Message(14, "doing '" .. e.bot_command .. "'...");
return 1;
end
end
return 0;
end

EVENT_CAST

Trigger

  • When a client casts a spell.

Exports

Name

Type

Usage

spell_id

int

quest::say($spell_id); # returns int

Example

  • In this example, the player would emote upon a successful cast.

Perl
Lua
Perl
sub EVENT_CAST {
quest::me("regains his concentration and casts his spell.");
}
Lua
function event_cast(e)
e.self:Emote("regains his concentration and casts his spell.");
end

EVENT_CAST_BEGIN

Trigger

  • When a client begins to cast a spell.

Exports

Name

Type

Usage

spell_id

int

quest::say($spell_id); # returns int

Example

  • In this example, the player would emote if they begin casting the gate spell. You would likely place this particular snippet into your global player.pl file.

Perl
Lua
Perl
sub EVENT_CAST_BEGIN {
#:: Match if $spell_id is 36 - Gate
if ($spell_id == 36) {
quest::me("begins casting the Gate spell.");
}
}
Lua
function event_cast_begin(e)
--:: Match if spell_id is 36 - Hate
local spell_id = e.spell:GetID();
if (spell_id == 36) then
e.self:Emote("begins casting the Gate spell.");
end
end

EVENT_CAST_ON

Trigger

  • When a player casts a spell on a player or NPC.

Exports

Name

Type

Usage

spell_id

int

quest::say($spell_id); # returns int

Example

  • In this example, if the player casts Banish Summoned on an NPC with a Summoned body type, the NPC will be killed. If you were placing this snippet in an NPC's quest script, you likely wouldn't bother matching body type.

Perl
Lua
Perl
sub EVENT_CAST_ON {
#:: Match if $spell_id is 116 - Banish Summoned
if ($spell_id == 116) {
#:: Match if the NPC's body type is 28 - Summoned Creature
if ($mob->GetBodyType() == 28) {
$npc->Kill();
}
else {
$client->Message(13, "This spell only effects summoned creatures");
}
}
}
Lua
function event_cast_on(e)
--:: Match if spell_id is 116 - Banish Summoned
local spell_id = e.spell:GetID();
if (spell_id == 116) then
--:: Match if the NPC's body type is 28 - Summoned Creature
local body_type = e.self:GetBodyType();
if (body_type == 28) then
e.self:Kill();
else
if (e.self:IsClient()) then
e.self:Message(13, "This spell only effects summoned creatures.");
end
end
end
end

EVENT_CLICKDOOR

Trigger

  • When the client clicks on a door object.

Note that you would likely use this event in the zone player.pl file. Since doors have open types and destination fields stored in the database, most "simple" doors do not require a separate quest script. An example of a "simple" door would be any door that requires a single keyitem (by Item ID) to open, like the door to the basement in Befallen.

Exports

Name

Type

Usage

doorid

int

quest::say($doorid); # returns int

version

int

quest::say($version); # returns int

Example

  • In this example, a player who is part of a Deepest Guk Adventure would be teleported to Deepest Guk when they click the doorway found in the Hollow Log.

Perl
Lua
Perl
sub EVENT_CLICKDOOR {
#:: Match if doorID is 1 - the door found in the Hollow Log that leads to Deepest Guk Adventures
if ($doorid == 1) {
#:: Create a variable to store the player's adventure zone instance ID
$GukAInstance = quest::GetInstanceID("guka",50);
#:: Match if the player has an instance
if ($GukAInstance > 0) {
#:: Teleport the player to their instance in Deepest Guk at the safe spot
quest::MovePCInstance(229, $GukAInstance, 101, -841, 2.38);
}
else {
$client->Message(13, "You are not a part of a Deepest Guk adventure instance!");
}
}
}
Lua
function event_click_door(e)
--:: Match if doorID is 1 - the door found in the Hollow Log that leads to Deepest Guk Adventures
local door_id = e.door:GetDoorID();
if (door_id == 1) then
--:: Create a variable to store the player's adventure zone instance ID
local guka_instance = eq.get_instance_id("guka", 50);
--:: Match if the player has an instance
if (guka_instance > 0) then
--:: Teleport the player to their instance in Deepest Guk at the safe spot
e.self:MovePCInstance(229, guka_instance, 101, -841, 2.38);
else
e.self:Message(13, "You are not a part of a Deepest Guk adventure instance!");
end
end
end

EVENT_CLICK_OBJECT

Trigger

  • When the client clicks on an object.

Note the similarity between this event and Perl EVENT_CLICKDOOR, since it is easy to confuse a door object (like a Plane of Knowledge Book) with Objects (IE Pottery wheels, Brew Barrels, etc.). You would likely use this event in the zone player.pl (or global_player.pl) files.

Exports

Name

Type

Usage

objectid

int

quest::say($objectid); # returns int

clicker_id

int

quest::say($clicker_id); # returns int

Example

  • In this example, a message is displayed to a player when they open the Ogre Cultural Forge in Oggok.

Perl
Lua
Perl
sub EVENT_CLICK_OBJECT {
#:: Match to the ogre cultural forge in Oggok by object ID
if ($objectid == 1075) {
#:: Check to see if the player who clicked is a race other than Ogre
if ($race ne "Ogre") {
#:: Send the client a message in color 1 (gray)
$client->Message(1,"The foul stench of Ogre overwhelms you as you open the forge.");
} else {
$client->Message(1,"Mmmm--dis smells just like home.");
}
}
}
Lua
function event_click_object(e)
--:: Match to the ogre cultural forge in Oggok by object ID
local object_id = e.object:GetID();
if (object_id == 1075) then
--:: Check to see if the player who clicked is a race other than Ogre
local race_id = e.self:GetRace();
if (race_id != 10) then
--:: Send the client a message in color 1 (gray)
e.self:Message(1,"The foul stench of Ogre overwhelms you as you open the forge.");
else
e.self:Message(1,"Mmmm--dis smells just like home.");
end
end
end

EVENT_COMBAT

Trigger

  • When an NPC enters or leaves combat.

Exports

Name

Type

Usage

combat_state

int

quest::say($combat_state); # returns int

Example

  • In this example, the NPC will say some flavor text when entering combat.

Perl
Lua
Perl
sub EVENT_COMBAT {
#:: combat state 0 = False, 1 = True
if ($combat_state == 1) {
quest::say("Time to die!");
}
}
Lua
function event_combat(e)
--:: e.joined is true/false
if (e.joined) then
e.self:Say("Time to die!");
end
end

EVENT_COMBINE_FAILURE

Trigger

  • When a combine is unsuccessful. You would likely use this event in your global / player.pl file.

Exports

Name

Type

Usage

recipe_id

int

quest::say($recipe_id); # returns int

recipe_name

int

quest::say($recipe_name); # returns int

Example

  • In this example, we watch for a player failing the combine for a Hand Made Backpack and then tease them.

Perl
Lua
Perl
sub EVENT_COMBINE_FAILURE {
#:: Match Recipe 2686: "Hand Made Backpack" by ID
if ($recipe_id == 2686) {
#:: Send the client a message in color 15 (yellow)
$client->Message(15,"Awww...now where are you going to put all of your stuff?");
}
}
Lua
function event_combine_failure(e)
--:: Match Recipe 2686: "Hand Made Backpack" by ID
if (e.recipe_id == 2686) then
--:: Send the client a message in color 15 (yellow)
e.self:Message(15, "Awww...now where are you going to put all of your stuff?");
end
end

EVENT_COMBINE_SUCCESS

Trigger

  • When a combine is successful.

Exports

Name

Type

Usage

recipe_id

int

quest::say($recipe_id); # returns int

recipe_name

int

quest::say($recipe_name); # returns int

Example

  • In this example, we send the client a message when they successfully combine a Hand Made Backpack

Perl
Lua
Perl
sub EVENT_COMBINE_SUCCESS {
#:: Match Recipe 2686: "Hand Made Backpack" by ID
if ($recipe_id == 2686) {
#:: Send the client a message in color 15 (yellow)
$client->Message(15,"Yay, now you have a place to put all of your stuff!");
}
}
Lua
function event_combine_success(e)
--:: Match Recipe 2686: "Hand Made Backpack" by ID
if (e.recipe_id == 2686) then
--:: Send the client a message in color 15 (yellow)
e.self:Message(15, "Yay, now you have a place to put all of your stuff!");
end
end

EVENT_COMMAND

Trigger

  • When a player says anything with the # command token preceding it that isn't handled by a system command.

  • Exception: #help will invoke a special call so that scripted commands may be included in search listing.

Used in player files to handle script-based command processing.

Exports

Name

Type

Details

command

string

A single, de-tokenized command name

args (perl)

string

An unseparated text line of additional parameters

args (lua)

string array

An array of single-word text parameters

Example

  • These examples are a working template for adding your own commands.

Perl
Lua
Perl
sub EVENT_COMMAND {
my %command_data = (
"scriptcommand1" => [0, "perl script-based supplementation test command 1"],
"scriptcommand2" => [100, "perl script-based supplementation test command 2"],
"scriptcommand3" => [250, "perl script-based supplementation test command 3"]
);
if ($command eq "help") { # always a supplemental call from within the system command_help handler
my $available_commands = 0;
foreach my $command_name (sort {$a cmp $b} keys %command_data) {
if ($status >= $command_data{$command_name}[0] && ($args eq "0" || $command_name=~/$args/i)) {
$client->Message(15, "#$command_name - $command_data{$command_name}[1]");
$available_commands = $available_commands + 1;
}
}
return $available_commands;
}
elsif (exists($command_data{$command}) && $status >= $command_data{$command}[0]) {
if ($command eq "scriptcommand1") {
$client->Message(14, "doing '$command'...");
return 1;
}
elsif ($command eq "scriptcommand2") {
$client->Message(14, "doing '$command'...");
return 1;
}
elsif ($command eq "scriptcommand3") {
$client->Message(14, "doing '$command'...");
return 1;
}
}
return 0;
}
Lua
function event_command(e)
local command_data = {
["scriptcommand1"] = {0, "lua script-based supplementation test command 1"},
["scriptcommand2"] = {100, "lua script-based supplementation test command 2"},
["scriptcommand3"] = {250, "lua script-based supplementation test command 3"}
}
if (e.command == "help") then -- always a supplemental call from within the system command_help handler
local available_commands = 0;
local key_sort = {}
for key in pairs(command_data) do
table.insert(key_sort, key);
end
table.sort(key_sort);
for index, key in ipairs(key_sort) do
if (e.self:Admin() >= command_data[key][1] and (e.args[1] == nil or key:findi(e.args[1]))) then
e.self:Message(15, "#" .. key .. " - " .. command_data[key][2]);
available_commands = available_commands + 1;
end
end
return available_commands;
elseif (command_data[e.command] ~= nil and e.self:Admin() >= command_data[e.command][1]) then
if (e.command == "scriptcommand1") then
e.self:Message(14, "doing '" .. e.command .. "'...");
return 1;
elseif (e.command == "scriptcommand2") then
e.self:Message(14, "doing '" .. e.command .. "'...");
return 1;
elseif (e.command == "scriptcommand3") then
e.self:Message(14, "doing '" .. e.command .. "'...");
return 1;
end
end
return eq.DispatchCommands(e); -- needed to invoke lua-based command system
end

EVENT_CONNECT

Trigger

  • when a player connects to the world.

You would likely be using this event in your global_player.pl.

Example

  • In this example, veteran AAs are awarded based on accumulated play time.

Perl
Lua
Perl
sub EVENT_CONNECT {
my %vet_aa = (481 => [31536000, 1, 1],
482 => [63072000, 1, 1],
483 => [94608000, 1, 1],
484 => [126144000, 1, 1],
485 => [157680000, 1, 1],
486 => [189216000, 1, 1],
487 => [220752000, 1, 1],
511 => [252288000, 1, 1],
2000 => [283824000, 1, 1],
8081 => [315360000, 1, 1],
8130 => [346896000, 1, 1],
453 => [378432000, 1, 1],
182 => [409968000, 1, 1],
600 => [441504000, 1, 1]);
foreach my $key (keys %vet_aa) {
if ($vet_aa{$key}[2] && ($vet_aa{$key}[2] || $client->GetAccountAge() >= $vet_aa{$key}[0])) {
$client->GrantAlternateAdvancementAbility($key, 1);
}
}
}
Lua
--[[ the main key is the ID of the AA
-- the first set is the age required in seconds
-- the second is if to ignore the age and grant anyways live test server style
-- the third is enabled
--]]
vet_aa = {
[481] = { 31536000, true, true}, -- Lesson of the Devote 1 yr
[482] = { 63072000, true, true}, -- Infusion of the Faithful 2 yr
[483] = { 94608000, true, true}, -- Chaotic Jester 3 yr
[484] = {126144000, true, true}, -- Expedient Recovery 4 yr
[485] = {157680000, true, true}, -- Steadfast Servant 5 yr
[486] = {189216000, true, true}, -- Staunch Recovery 6 yr
[487] = {220752000, true, true}, -- Intensity of the Resolute 7 yr
[511] = {252288000, true, true}, -- Throne of Heroes 8 yr
[2000] = {283824000, true, true}, -- Armor of Experience 9 yr
[8081] = {315360000, true, true}, -- Summon Resupply Agent 10 yr
[8130] = {346896000, true, true}, -- Summon Clockwork Banker 11 yr
[453] = {378432000, true, true}, -- Summon Permutation Peddler 12 yr
[182] = {409968000, true, true}, -- Summon Personal Tribute Master 13 yr
[600] = {441504000, true, true}, -- Blessing of the Devoted 14 yr
}
function event_connect(e)
local age = e.self:GetAccountAge();
for aa, v in pairs(vet_aa) do
if v[3] and (v[2] or age >= v[1]) then
e.self:GrantAlternateAdvancementAbility(aa, 1)
end
end
end

EVENT_DEATH

Trigger

  • When the NPC dies. Fires before death finishes.

Exports

Name

Type

Details

client

client

client who killed mob

npc

npc

npc that was killed

killer_id

int

client ID of killer. (Does not seem castable to mob)

killer_damage

int

How much damage was dealt on killing blow

killer_spell

int

Spell ID used to kill mob

killer_skill

int

Skill ID used to kill mob

charid

int

Character ID who killed mob

class

string

Class Name who killed mob

faction

int

Faction comparison of killed mob vs killer

h

float

heading of mob during death

hpratio

float

percent health of mob after death (negative value)

mlevel

int

level of mob killed

mname

string

name of mob killed

mobid

int

id of mob killed

name

string

name of killer

race

string

race of killer

status

int

account status of killer

uguild_id

int

uguild of killer

ulevel

int

level of killer

userid

int

user id of killer

x

float

x position of killed mob

y

float

y position of killed mob

z

float

z position of killed mob

zonehour

int

hour of zone when mob died

zoneid

int

zone id where mob died

zoneln

string

long name of zone where mob died

zonemin

int

minimum level to enter zone where mob died

zonesn

string

short name of zone where mob died

zonetime

int

time of zone where mob died

zoneweather

int

EVENT_DEATH_COMPLETE

Trigger

  • When the NPC dies.

Often used to spawn adds or send signals upon the death of an NPC.

Exports

Name

Type

Usage

killer_id

int

quest::say($killer_id); # returns int

killer_damage

int

quest::say($killer_damage); # returns int

killer_spell

int

quest::say($killer_spell); # returns int

killer_skill

int

quest::say($killer_skill); # returns int

Example

  • In this example, we spawn a fire beetle after the death of our NPC at the NPC's location.

Perl
Lua
Perl
sub EVENT_DEATH_COMPLETE {
#:: Spawn a 2024 - a_fire_beetle by NPC Type ID, grid 0, guildwarset 0, current X, Y, Z, and heading
quest::spawn2(2024,0,0,$x,$y,$z,$h);
}
Lua
function event_death_complete(e)
--:: Spawn a 2024 - a_fire_beetle by NPC Type ID, grid 0, guildwarset 0, current X, Y, Z, and heading
eq.spawn2(2024, 0, 0, e.self:GetX(), e.self:GetY(), e.self:GetZ(), e.self:GetHeading());
end

EVENT_DEATH_ZONE

Trigger

  • When the NPC dies.

Used by the zone controller.

Exports

Name

Type

Usage

killer_id

int

quest::say($killer_id); # returns int

killer_damage

int

quest::say($killer_damage); # returns int

killer_spell

int

quest::say($killer_spell); # returns int

killer_skill

int

quest::say($killer_skill); # returns int

killer_npc_id

int

quest::say($killer_npc_id); # returns int

EVENT_DESTROY_ITEM

Trigger

  • When a client destroys an item.

Used mainly for logging purposes.

EVENT_DISCONNECT

Trigger

  • When a player disconnects from the world.

Used mainly for logging purposes.

EVENT_DISCOVER_ITEM

Trigger

  • When an item is discovered.

Used in conjunction with World Rule EnableDiscoveredItems.

Exports

Name

Type

Usage

itemid

int

quest::say($itemid); # returns int

Example

Perl
Lua
Perl
sub EVENT_DISCOVER_ITEM {
#:: Create a scalar variable to store the item link
$discovereditem = quest::varlink($itemid);
#:: Shout the discovery to all zones
quest::shout2("$name has discovered $discovereditem! Yay!");
}
Lua
function event_discover_item(e)
--:: Create a scalar variable to store the item link
local item_link = eq.item_link(e.item:GetID());
--:: Emote the discovery to all zones
eq.world_emote(335, "$name has discovered " .. item_link .. "! Yay!");
end

EVENT_DROP_ITEM

Trigger

  • When a client drops an item.

Mainly used for logging purposes.

Exports

Name

Type

Usage

quantity

int

quest::say($quantity); # returns int

itemname

int

quest::say($itemname); # returns int

itemid

int

quest::say($itemid); # returns int

spell_id

int

quest::say($spell_id); # returns int

slotid

int

quest::say($slotid); # returns int

EVENT_DUEL_LOSE

Trigger

  • When a client loses a duel.

You would use this event in the global global_player.pl file.

Example

  • In this example, we set a data bucket to keep track of a player's dueling failures.

Perl
Lua
Perl
sub EVENT_DUEL_LOSE {
my $bucket_name = $client->CharacterID() . "-losses";
my $bucket_value = (quest::get_data($bucket_name) + 1);
quest::set_data($bucket_name, $bucket_value);
}
Lua
function event_duel_lose(e)
local bucket_name = e.self:CharacterID() .. "-losses";
local bucket_value = (eq.get_data(bucket_name) + 1);
eq.set_data(bucket_name, bucket_value);
end

EVENT_DUEL_WIN

Trigger

  • when a client wins a duel.

You would use this event in the global global_player.pl file.

Example

  • In this example, we set a data bucket to keep track of a player's dueling wins.

Perl
Lua
Perl
sub EVENT_DUEL_WIN {
my $bucket_name = $client->CharacterID() . "-wins";
my $bucket_value = (quest::get_data($bucket_name) + 1);
quest::set_data($bucket_name, $bucket_value);
}
Lua
function event_duel_win(e)
local bucket_name = e.self:CharacterID() .. "-wins";
local bucket_value = (eq.get_data(bucket_name) + 1);
eq.set_data(bucket_name, bucket_value);
end

EVENT_ENTER

Trigger

  • When a client enters a mob's proximity (as defined by quest::set_proximity(min_x, max_x, min_y, max_y, min_z, max_z)).

Example

  • In this example, we first set the NPC's proximity; when a player enters the proximity, they become PVP (red).

Perl
Lua
Perl
sub EVENT_SPAWN {
#:: Create a proximity, 100 units across, 100 units tall, without proximity say
quest::set_proximity($x - 50, $x + 50, $y - 50, $y + 50, $z - 50, $z + 50, 0);
}
sub EVENT_ENTER {
#:: Turn pvp on
quest::pvp("on");
}
Lua
function event_spawn(e)
--:: Create a proximity, 100 units across, 100 units tall, without proximity say
local x = e.self:GetX();
local y = e.self:GetY();
local z = e.self:GetZ();
eq.set_proximity((x - 50), (x + 50), (y - 50), (y + 50), (z - 50), (z + 50), 0);
end
function event_enter(e)
--:: Turn pvp on
e.other:SetPVP("on");
end

EVENT_ENTER_AREA

Trigger

  • when a client enters the area of a mob.

EVENT_ENTERZONE

Trigger

  • When a player enters the zone. Likely you will add to the zone player.pl file.

Example

  • In this example we remove the LDON compass mark.

Perl
Lua
Perl
sub EVENT_ENTERZONE {
#:: Clear the LDON Compass mark
$client->ClearCompassMark();
}
Lua
function event_enterzone(e)
--:: Clear the LDON Compass mark
e.self:ClearCompassMark();
end
  • In this example we create a LDON compass mark

Perl
Lua
Perl
sub EVENT_ENTERZONE {
#:: Create a scalar for storing the instance ID
$RujDInstance = quest::GetInstanceID("rujd",50);
#:: If the instance ID exists, it should be greater than 0--mark the player's compass if it is
if ($RujDInstance > 0) {
#:: Create a line on the compass leading the player to X,Y,Z
$client->MarkCompassLoc(-157.09, 19.31, 100);
}
}
Lua
function event_enterzone(e)
--:: Create a variable for storing the instance ID
local rujd_instance = eq.get_instance_id("rujd", 50);
--:: If the instance ID exists, it should be greater than 0--mark the player's compass if it is
if (rujd_instance > 0) then
--:: Create a line on the compass leading the player to X,Y,Z
e.self:MarkCompassLoc(-157.09, 19.31, 100);
end
end

EVENT_ENVIRONMENTAL_DAMAGE

Trigger

  • When taking any sort of environmental damage.

Exports

Name

Type

Usage

env_damage

int

quest::say($env_damage); # returns int

env_damage_type

int

quest::say($env_damage_type); # returns int

env_final_damage

int

quest::say($env_final_damage); # returns int

EVENT_EQUIP_ITEM

Trigger

  • When a player equips an item.

EVENT_EXIT

Trigger

  • When a client leaves a mob's proximity (as defined by quest::set_proximity).

Example

  • In this example, we first set the NPC's proximity; when a player exits the proximity, they are no longer PVP (blue).

Example

Perl
Lua
Perl
sub EVENT_SPAWN {
#:: Create a proximity, 100 units across, 100 units tall, without proximity say
quest::set_proximity($x - 50, $x + 50, $y - 50, $y + 50, $z - 50, $z + 50, 0);
}
sub EVENT_EXIT {
#:: Turn pvp off
quest::pvp("off");
}
Lua
function event_spawn(e)
--:: Create a proximity, 100 units across, 100 units tall, without proximity say
local x = e.self:GetX();
local y = e.self:GetY();
local z = e.self:GetZ();
eq.set_proximity((x - 50), (x + 50), (y - 50), (y + 50), (z - 50), (z + 50), 0);
end
function event_exit(e)
--:: Turn pvp off
e.other:SetPVP("off");
end

EVENT_FEIGN_DEATH

Trigger

  • When a client feigns death.

Example

Perl
Lua
Perl
sub EVENT_FEIGN_DEATH {
#:: See if the player has a pet
if ($client->GetPetID()) {
#:: Identify the pet by ID and kill it
$pet_entity = $entity_list->GetMobByID($client->GetPetID());
$pet_entity->Kill();
}
}
Lua
function event_feign_death(e)
--:: See if the player has a pet
local pet_id = e.other:GetPet():GetID();
if (pet_id > 0) then
--:: Identify the pet by ID and kill it
local pet_entity = entity_list:GetMob(pet_id);
pet_entity:Kill();
end
end

EVENT_FISH_FAILURE

Trigger

  • When a client fails at fishing.

You would use this event in the zone player.pl file.

Example

  • In this example, we set a data bucket to keep track of a player's fishing failures.

  • You would use this event in the global global_player.pl file.

Perl
Lua
Perl
sub EVENT_FISH_FAILURE {
my $bucket_name = $client->CharacterID() . "-fish-fail";
my $bucket_value = (quest::get_data($bucket_name) + 1);
quest::set_data($bucket_name, $bucket_value);
$client->Message(1, "Maybe you're using the wrong bait!")
}
Lua