Example
This is a full example to demonstrate usage. Guard Pineshade at the orc lift in gfaydark provides an expedition to crushbone
gfaydark/Guard_Pineshade.pl
1
my $expedition_name = "Crushbone, DVinn's Stronghold";
2
my $min_players = 1;
3
my $max_players = 6;
4
my $dz_zone = "crushbone";
5
my $dz_version = 0;
6
my $dz_duration = 3600; # 1 hour
7
8
sub EVENT_SAY {
9
if ($text =~ /hail/i) {
10
my $dz = $client->GetExpedition();
11
if ($dz && $dz->GetName() eq $expedition_name) {
12
quest::say("Tell me when you're [" . quest::saylink("ready") . "] to enter");
13
}
14
else {
15
quest::say("Would you like to [" . quest::saylink("request") . "] the expedition?");
16
}
17
}
18
elsif ($text =~ /request/i) {
19
my $dz = $client->CreateExpedition($dz_zone, $dz_version, $dz_duration, $expedition_name, $min_players, $max_players);
20
if ($dz) {
21
$dz->SetCompass("gfaydark", 238.0, 987.0, -24.90); # pointing to guard pineshade
22
$dz->SetSafeReturn("gfaydark", 245.84, 987.93, -27.6, 484.0); # orc lift in gfay
23
$dz->SetZoneInLocation(479.44, -500.18, 5.75, 421.8); # bridge in crushbone
24
$dz->AddReplayLockout(7200); # immediately add a 2 hour replay lockout on creation
25
quest::say("Tell me when you're [" . quest::saylink("ready") . "] to enter");
26
}
27
}
28
elsif ($text =~ /ready/i) {
29
$client->MovePCDynamicZone("crushbone");
30
}
31
}
Copied!
crushbone/zone_controller.pl
1
# this requires the Zone:UseZoneController rule to be enabled
2
my $initialized = 0;
3
4
sub Initialize {
5
quest::debug("Initializing expedition");
6
my $dz = quest::get_expedition();
7
if ($dz) {
8
# bind unique npc types to events to prevent any looting exploits
9
$dz->SetLootEventByNPCTypeID(58032, "Emperor Crush"); # npc: Emperor_Crush
10
$dz->SetLootEventByNPCTypeID(317109, "Ambassador Mata Muram"); # npc: Overlord_Mata_Muram
11
12
# spawn any events that the expedition doesn't have a lockout for
13
if (!$dz->HasLockout("Ambassador Mata Muram")) {
14
quest::spawn2(317109, 0, 0, 130.78, -149.09, 88.70, 270.8); # npc: Overlord_Mata_Muram
15
}
16
}
17
}
18
19
sub EVENT_SPAWN_ZONE {
20
# note: zone_controller spawns before expeditions can be cached, so we delay
21
# expedition init until first npc spawns instead of using our EVENT_SPAWN
22
if (!$initialized) {
23
$initialized = 1; # set first to prevent infinite recursion from spawning npcs in init()
24
Initialize();
25
}
26
27
if ($spawned_npc_id == 58032) { # npc: Emperor_Crush
28
my $dz = quest::get_expedition();
29
if ($dz && $dz->HasLockout("Emperor Crush")) {
30
quest::depop(58032); # depop emperor crush due to lockout
31
}
32
}
33
}
34
35
sub EVENT_DEATH_ZONE {
36
if ($killed_npc_id == 58032) { # npc: Emperor_Crush
37
my $dz = quest::get_expedition();
38
if ($dz) {
39
$dz->AddLockout("Emperor Crush", 86400); # 1 day lockout
40
}
41
}
42
elsif ($killed_npc_id == 317109) { # npc: Overlord_Mata_Muram
43
my $dz = quest::get_expedition();
44
if ($dz) {
45
$dz->AddLockout("Ambassador Mata Muram", 604800); # 7 day lockout
46
47
# spawn a chest and bind its spawn id to the event to prevent loot exploits
48
my $chest_id = quest::spawn2(893, 0, 0, 130.78, -149.09, 88.70, 0);
49
$dz->SetLootEventBySpawnID($chest_id, "Ambassador Mata Muram");
50
}
51
}
52
}
Copied!
Last modified 8mo ago
Copy link