From ad71571d1b41fa94153849ff9c3f6347d61f7a80 Mon Sep 17 00:00:00 2001 From: TurmoilToad Date: Mon, 19 Feb 2018 20:13:37 -0500 Subject: [PATCH] Created Perl EVENT_ENTERZONE (markdown) --- Perl-EVENT_ENTERZONE.md | 49 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 Perl-EVENT_ENTERZONE.md diff --git a/Perl-EVENT_ENTERZONE.md b/Perl-EVENT_ENTERZONE.md new file mode 100644 index 0000000..fd06393 --- /dev/null +++ b/Perl-EVENT_ENTERZONE.md @@ -0,0 +1,49 @@ +EVENT_ENTERZONE is triggered when a player enters a zone--not to be confused with [Perl EVENT_ZONE](https://github.com/EQEmu/Server/wiki/Perl-EVENT_ZONE), which is triggered when a player LEAVES a zone. + +This event allows you to send the player an emote (like the Wayfarer Brotherhood text), set a compass mark (for an LDON adventure), start timers, check tasks, and a great number of other functions. + +This perl event is most commonly used in the zone's player.pl file, or in the global_player.pl file. + +### Triggered + +* When a player enters a zone. + +### Examples + +* In this example, every time someone enters the zone, they will hear the DING! sound that plays when you gain a level. + +```perl +sub EVENT_ENTERZONE { + #:: Because it's funny. + quest::ding(); +} +``` + +* In this example, when a player is part of a Rujarkian Hills Adventure, they will see a mark on their compass. + +```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); + } +} +``` + +* In this example, we set the player's 1H Slashing skill (Skill ID 1) to zero if we haven't set it to zero before. +* We then set a quest global so that we don't zero the skill out the next time the player enters a zone. + +```perl +sub EVENT_ENTERZONE { + #:: Check that the 'onehandslashingzerodout' quest global does not exist + if (!defined $qglobals{"onehandslashingzerodout"}) { + #:: Set the skill ID 1 to value 0 + $client->SetSkill(1, 0); + #:: Set a quest global so that we do not zero the skill on the next zone in + quest::setglobal("onehandslashingzerodout", 1, 5, "F"); + } +} +``` \ No newline at end of file