PDA

View Full Version : Spectral Guardian encounter


Asylum
08-18-2013, 11:56 AM
Hello everyone. First, I'd like to thank the entire community for contributing to the EQ emulator effort. jshows1 and I have been working on our own server for a while now (Jer's Server), as he mentioned in a previous post. Although I have created many events for our Norrath, here is one I found particularly satisfying, perhaps because it taught me how to do signalling. At any rate, I thought I'd share it with you.

Very brief overview: turn in 4 pure elements, defeat the encounter, get Convergence of the Elements as a reward, along with a chest of loot.

The 13 NPCs to be created are listed in the headers of the perl files (except the loot chest mob). The 5 items (mentioned in brief overview) are also described in the files.

The perl files:

#############
#Quest: Script for Spectral Guardian encounter
#NPCid 1269
#Name: Taris
#Race 128 (iksar), d_melee_texture1 and 2 = 11524 (spectral sword)
#Location: x=9133, y=925, z=1064, h=127 of dreadlands (behind grassy area near pyramid park (also need to relocate Klok F`tshai to outside pyramid park)
#Level: 40
#Type: quest NPC
#Loot: tableid
#HP: 5000
#############

sub EVENT_SPAWN {
quest::npcfeature("race", 128 );
$npc->NPCSpecialAttacks(HfDCAB, 0);
}

sub EVENT_SAY {
if($npc->GetRace() == 147) {
if($text=~/Hail/i){
quest::say("Help free me from this prison! The elements have used the power within my spectral swords to... What is that monstrosity in the distance?");
}
}
else {
if($text=~/Hail/i){
quest::say("Hello, $name. What brings to you the spires of Dreadlands, a convergence of the [elements]?");
}
if($text=~/elements/i){
quest::say("Not many know the true nature of the elements. If you should bring me a pure sample of each, I can combine them for you.");
}
}
}

sub EVENT_ITEM {
# 3871 pure_fire, 3885 pure_water, 3901 pure_air, 3902 pure_earth
if ((plugin::check_handin(\%itemcount, 3871 => 1, 3885 => 1, 3901 => 1, 3902 => 1)) && ($npc->GetRace() == 128 )) {
quest::emote("is shocked by the interaction of the pure elements.");
quest::say("I think something is happening...");
quest::npcfeature("race", 147);
quest::spawn2(1257,0,0,9318,779,1065,64); #spawns First_Spectral_Guardian
}
plugin::return_items(\%itemcount);
}

sub EVENT_SIGNAL {
if ($signal => 1) {
quest::npcfeature("race", 128 );
}
}

#############
#Quest: Script for Spectral Guardian encounter
#NPCid 1257
#Name: First_Spectral_Guardian
#Race 308 (storm golem), Texture of 0, Size 20, gender 2, runspeed 0
#Location: x, y, z of $zonesn
#Level: 47
#Type: monster
#Loot: tableid
#HP: 30,000
#############

sub EVENT_SPAWN {
quest::npcfeature("race", 308 );
$npc->NPCSpecialAttacks(fDCS, 0);
quest::setnexthpevent(60);
quest::modifynpcstat("max_hit",265);
quest::modifynpcstat("min_hit",90);
quest::shout("The elements combine into a living force.");
}

sub EVENT_HP {
if($hpevent == 60) {
quest::setnexthpevent(30);
quest::modifynpcstat("max_hit",350);
}
if($hpevent == 30) {
quest::modifynpcstat("min_hit",250);
}
}

sub EVENT_DEATH {
quest::emote("crumbles into dust. The winds gather the material into a new guardian nearby.");
quest::spawn2(1258,0,0,$x-250,$y,$z,$h); #spawns Second_Spectral_Guardian
}

#############
#Quest: Script for Spectral Guardian encounter
#NPCid 1258
#Name: Second_Spectral_Guardian
#Race 308 (storm golem), Texture of 0, Size 25, gender 2, runspeed 0
#Location: x, y, z of $zonesn
#Level: 50
#Type: monster
#Loot: tableid
#HP: 50,000
#############

sub EVENT_SPAWN {
quest::emote("forms from the dust of the former guardian.");
quest::shout("I am reborn of the elements.");
quest::npcfeature("race", 308 );
$npc->NPCSpecialAttacks(fDCS, 0);
quest::setnexthpevent(90);
my $eid = $npc->GetID(); #get this npc's Entity_ID
quest::settimer("signal",6);
}

sub EVENT_TIMER {
if ($timer eq "signal") {
my $eid = $npc->GetID(); #get this npc's Entity_ID
quest::signalwith(quest::ChooseRandom(1259,1260,12 61,1262),$eid,0); #send Entity_ID as a signal to one of the Totems with delay 0 ms
quest::settimer("signal",6); #every 6 seconds
}
}

sub EVENT_HP {
if($hpevent == 90) {
quest::setnexthpevent(80);
quest::emote("calls upon Earth.");
quest::spawn2(1259,0,0,$x-50,$y-50,$z,32);
}
if($hpevent == 80) {
quest::setnexthpevent(70);
quest::emote("calls upon Air.");
quest::spawn2(1260,0,0,$x-50,$y+50,$z,96);
}
if($hpevent == 70) {
quest::setnexthpevent(60);
quest::emote("calls upon Water.");
quest::spawn2(1261,0,0,$x+50,$y-50,$z,-32);
}
if($hpevent == 60) {
quest::emote("calls upon Fire.");
quest::spawn2(1262,0,0,$x+50,$y+50,$z,-96);
}
}

sub EVENT_DEATH {
quest::shout("The elemental forces dispersed, I can no longer sustain this form.");
quest::spawn2(1267,0,0,$x+250,$y,$z,$h); #spawns Third_Spectral_Guardian
}

#############
#Quest: Script for Spectral Guardian encounter
#NPCid 1259
#Name: Earth_Totem
#Race 173 (totem), Texture of 0, Size 15, gender 2, runspeed 0, minhit 0, maxhit 0
#Location: x, y, z of $zonesn
#Level: 50
#Type: monster
#Loot: tableid
#HP: 20,000
#############

sub EVENT_SPAWN {
quest::npcfeature("race", 173);
$npc->NPCSpecialAttacks(HfDCAB, 0); #Invulnerable to melee, spell: "AB"
quest::settimer("vulner",100); #100 sec timer before totem become attackable
}

sub EVENT_SIGNAL {
if ($signal => 1) {
my $eid = $signal; #transfering the signal number for use in CastSpell
$npc->CastSpell(9965, $eid, 11); #Casts heal on signalling npc, slot 11 argument prevents fizzling
}
}

sub EVENT_TIMER {
if($timer eq "vulner") {
$npc->NPCSpecialAttacks(HfDC, 0); #Now attackable
}
}

sub EVENT_DEATH {
quest::spawn2(1263,0,0,$x,$y,$z,$h); #spawns a Living_Totem upon death, elemental of same type as totem, casts spell on itself instead of Guardian
}

#############
#Quest: Script for Spectral Guardian encounter
#NPCid 1260
#Name: Air_Totem
#Race 260 (bat), Texture of 0, Size 15, gender 2, runspeed 0, minhit 0, maxhit 0
#Location: x, y, z of $zonesn
#Level: 50
#Type: monster
#Loot: tableid
#HP: 20,000
#############

sub EVENT_SPAWN {
quest::npcfeature("race", 260);
$npc->NPCSpecialAttacks(HfDCAB, 0); #Invulnerable to melee, spell: "AB"
quest::settimer("vulner",100); #100 sec timer before totem become attackable
}

sub EVENT_SIGNAL {
if ($signal => 1) {
my $eid = $signal; #transfering the signal number for use in CastSpell
$npc->CastSpell(4740, $eid, 11); #Casts (Haste of the Tunat'Muram 50% haste, 60 DS) on signalling npc, slot 11 argument prevents fizzling
}
}

sub EVENT_TIMER {
if($timer eq "vulner") {
$npc->NPCSpecialAttacks(HfDC, 0); #Now attackable
}
}

sub EVENT_DEATH {
quest::spawn2(1264,0,0,$x,$y,$z,$h); #spawns a Living_Totem upon death, elemental of same type as totem, casts spell on itself instead of Guardian
}

#############
#Quest: Script for Spectral Guardian encounter
#NPCid 1261
#Name: Water_Totem
#Race 187 (siren), Texture of 0, Size 15, gender 2, runspeed 0, minhit 0, maxhit 0
#Location: x, y, z of $zonesn
#Level: 50
#Type: monster
#Loot: tableid
#HP: 20,000
#############

sub EVENT_SPAWN {
quest::npcfeature("race", 187);
$npc->NPCSpecialAttacks(HfDCAB, 0); #Invulnerable to melee, spell: "AB"
quest::settimer("vulner",100); #100 sec timer before totem become attackable
}

sub EVENT_SIGNAL {
if ($signal => 1) {
my $eid = $signal; #transfering the signal number for use in CastSpell
$npc->CastSpell(25321, $eid, 11); #Casts (Armor of Courage PAL/88 ) on signalling npc, slot 11 argument prevents fizzling
}
}

sub EVENT_TIMER {
if($timer eq "vulner") {
$npc->NPCSpecialAttacks(HfDC, 0); #Now attackable
}
}

sub EVENT_DEATH {
quest::spawn2(1265,0,0,$x,$y,$z,$h); #spawns a Living_Totem upon death, elemental of same type as totem, casts spell on itself instead of Guardian
}

#############
#Quest: Script for Spectral Guardian encounter
#NPCid 1262
#Name: Fire_Totem
#Race 126 (djinn), Texture of 0, Size 15, gender 2, runspeed 0, minhit 0, maxhit 0
#Location: x, y, z of $zonesn
#Level: 50
#Type: monster
#Loot: tableid
#HP: 20,000
#############

sub EVENT_SPAWN {
quest::npcfeature("race", 126);
$npc->NPCSpecialAttacks(HfDCAB, 0); #Invulnerable to melee, spell: "AB"
quest::settimer("vulner",100); #100 sec timer before totem become attackable
}

sub EVENT_SIGNAL {
if ($signal => 1) {
my $eid = $signal; #transfering the signal number for use in CastSpell
$npc->CastSpell(10434, $eid, 11); #Casts (Fermata of Preservation BRD/73) on signalling npc, slot 11 argument prevents fizzling
}
}

sub EVENT_TIMER {
if($timer eq "vulner") {
$npc->NPCSpecialAttacks(HfDC, 0); #Now attackable
}
}

sub EVENT_DEATH {
quest::spawn2(1266,0,0,$x,$y,$z,$h); #spawns a Living_Totem upon death, elemental of same type as totem, casts spell on itself instead of Guardian
}

#############
#Quest: Script for Spectral Guardian encounter
#NPCid 1263
#Name: Living_Earth
#Race 209 (earth elemental), Texture of 0, Size 12, gender 2, runspeed 0
#Location: x, y, z of $zonesn
#Level: 50
#Type: monster
#Loot: tableid
#HP: 20,000
#############

sub EVENT_SPAWN {
quest::npcfeature("race", 209);
$npc->NPCSpecialAttacks(fDCS, 0);
quest::settimer("totem", 20); #20 sec timer for totem spell
}

sub EVENT_TIMER {
if($timer eq "totem") {
$npc->CastSpell(9965,$npc->GetID()); #Casts heal on self, slot 11 argument prevents fizzling
quest::settimer("totem", 20);
}
}

#############
#Quest: Script for Spectral Guardian encounter
#NPCid 1264
#Name: Living_Air
#Race 210 (air elemental), Texture of 0, Size 12, gender 2, runspeed 0
#Location: x, y, z of $zonesn
#Level: 50
#Type: monster
#Loot: tableid
#HP: 20,000
#############

sub EVENT_SPAWN {
quest::npcfeature("race", 210);
$npc->NPCSpecialAttacks(fDCS, 0);
quest::settimer("totem", 20); #20 sec timer for totem spell
}

sub EVENT_TIMER {
if($timer eq "totem") {
$npc->CastSpell(3150,$npc->GetID()); #Cast (Direption of Dreams Cancel Magic (9) x 12) on self, slot 11 argument prevents fizzling, removes 12 buffs
quest::settimer("totem", 20);
}
}

#############
#Quest: Script for Spectral Guardian encounter
#NPCid 1265
#Name: Living_Water
#Race 211 (water elemental), Texture of 0, Size 12, gender 2, runspeed 0
#Location: x, y, z of $zonesn
#Level: 50
#Type: monster
#Loot: tableid
#HP: 20,000
#############

sub EVENT_SPAWN {
quest::npcfeature("race", 211);
$npc->NPCSpecialAttacks(fDCS, 0);
quest::settimer("totem", 20); #20 sec timer for totem spell
quest::set_proximity($x - 50, $x + 50, $y - 50, $y + 50);
}

sub EVENT_TIMER {
if($timer eq "totem") {
$npc->CastSpell(25321,$npc->GetID()); #Cast (Armor of Courage PAL/88 ) on self, slot 11 argument prevents fizzling
quest::settimer("totem", 20);
}
}

sub EVENT_ENTER {
quest::selfcast(6560); #Casts Golem Slow on player, 1: Max HP change by (-20%) 2: Decrease Movement by 40% 3: Decrease Attack Speed by 15%
quest::set_proximity($x - 50, $x + 50, $y - 50, $y + 50);
}

#############
#Quest: Script for Spectral Guardian encounter
#NPCid 1266
#Name: Living_Fire
#Race 212 (fire elemental), Texture of 0, Size 12, gender 2, runspeed 0
#Location: x, y, z of $zonesn
#Level: 50
#Type: monster
#Loot: tableid
#HP: 20,000
#############

sub EVENT_SPAWN {
quest::npcfeature("race", 212);
$npc->NPCSpecialAttacks(fDCS, 0);
quest::settimer("totem", 20); #20 sec timer for totem spell
quest::set_proximity($x - 50, $x + 50, $y - 50, $y + 50);
}

sub EVENT_TIMER {
if($timer eq "totem") {
$npc->CastSpell(10434,$npc->GetID()); #Cast (Fermata of Preservation BRD/73) on self, slot 11 argument prevents fizzling
quest::settimer("totem", 20);
}
}

sub EVENT_ENTER {
quest::selfcast(7123); #Casts Eaten Flesh on player, 650 per tick and root BPAE
quest::set_proximity($x - 50, $x + 50, $y - 50, $y + 50);
}

#############
#Quest: Script for Spectral Guardian encounter
#NPCid 1267
#Name: Third_Spectral_Guardian
#Race 308 (storm golem), Texture of 0, Size 30, gender 2, runspeed 0, very high AC, very resistant to all spells, d_melee_texture1 and 2 = 11524 (spectral sword)
#Location: x, y, z of $zonesn
#Level: 53
#Type: monster
#Loot: tableid
#HP: 80,000
#############

sub EVENT_SPAWN {
quest::npcfeature("race", 308 );
$npc->NPCSpecialAttacks(fDCS, 0);
quest::snow(1);
quest::setsky(0);
quest::set_proximity($x - 50, $x + 50, $y - 50, $y + 50);
quest::setnexthpevent(90);
quest::shout("Witness the true power of the Guardian.");
}

sub EVENT_HP {
if($hpevent == 90) { #begins using spell ability at 90% HP
quest::settimer("spell", quest::ChooseRandom(15,20,25,30)); #random timer for spell
quest::setnexthpevent(70);
}
if($hpevent == 70) { #begins using spell2 ability at 70% HP
quest::settimer("spell2", quest::ChooseRandom(15,20,25,30)); #random timer for spell2
}
}

sub EVENT_TIMER {
if($timer eq "spell") {
$npc->CastSpell(7132,$client); #Casts Bleak Promise, decrease hitpoints by 1125 (L1) to 1225 (L100) PBAE 30 range
quest::settimer("spell", quest::ChooseRandom(15,20,25,30)); #random timer for spell
}
if($timer eq "spell2") {
$npc->CastSpell(21789,$NPC_ID); #Flusterbolt Memblur Effect, 100% memblur on self
quest::emote("channels the elements through its body, taking on their form.");
quest::npcfeature("race", quest::ChooseRandom(209,210,211,212,308 ));
quest::settimer("spell2", quest::ChooseRandom(15,20,25,30)); #random timer for spell2
}
}

sub EVENT_EXIT {
quest::selfcast(2811); #Player casts Abysmal Banishment on self, 1: Blindness (3) 2: Decrease HP when cast by 700 3: Decrease Hitpoints by 700 per tick
quest::set_proximity($x - 50, $x + 50, $y - 50, $y + 50);
}

sub EVENT_DEATH {
if($npc->GetRace() == 308 ) {
quest::snow(0);
$client->Message(15, "Having destroyed the Guardian while all four elements were occupying the creature, it cannot be recreated. The elemental forces instead converge on you.");
$client->Message(15, "You have been granted a temporary surname!");
$client->Message(15, "Taris wakes from a living nightmare, remembering nothing.");
quest::summonitem(3903); #summons Convergence of the Elements, quest item
quest::signalwith(1269,1,0); #send 1 as a signal to Taris, returning him to regular iksar from spectral iksar race
quest::surname(the_Spectral_Guardian); #changes player surname to "the Spectral Guardian"
quest::spawn2(1268,0,0,$x+100,$y,$z,$h); #spawns chest with loot, 3 x Spectral Guardian's Cloak
}
else {
quest::shout("Although you have managed to remove one of the elements visibly harboring in the Guardian, the others focus to recreate the creature.");
quest::spawn2(1267,0,0,$x,$y,$z,$h); #respawns Third_Spectral_Guardian
}
}

************************

Please leave comments and/or suggestions as we hope to improve our server and attract a playerbase to test this for us. Thank you to those who have been playing and finding bugs. Once I finish all the epic 0.5 quests (intended for lvl 30-40), I will post them here as well.

Salvanna Emberleaf the Immortal
GM/quest designer of Jer's Server

sorvani
08-18-2013, 01:30 PM
All that work and you do not know how to use a code tag.

Asylum
08-22-2013, 02:24 PM
I have updated the Taris.pl file to include links to the quest items in his conversation as well as clues to where players may obtain them.


#############
#Quest: Script for Spectral Guardian encounter
#NPCid 1269
#Name: Taris
#Race 128 (iksar)
#Location: x, y, z of $zonesn
#Level: 40
#Type: quest NPC
#Loot: tableid
#HP: 5000
#############

sub EVENT_SAY {
if($npc->GetRace() == 147) {
if($text=~/Hail/i){
quest::say("Help free me from this prison! The elements have used the power within my spectral swords to... What is that monstrosity in the distance?");
}
}
else {
my $fire = quest::varlink(3871);
my $water = quest::varlink(3885);
my $air = quest::varlink(3901);
my $earth = quest::varlink(3902);
if($text=~/Hail/i){
quest::say("Hello, $name. What brings to you the spires of Dreadlands, a convergence of the [elements]?");
}
if($text=~/elements/i){
quest::say("Not many know the true nature of the elements. If you should bring me a pure [sample] of each, I can combine them for you.");
}
if($text=~/sample/i){
quest::say("I require samples of $fire , $water , $air , and $earth . These may be found from living elementals.");
}
}
}

sub EVENT_ITEM {
# 3871 pure_fire, 3885 pure_water, 3901 pure_air, 3902 pure_earth
if ((plugin::check_handin(\%itemcount, 3871 => 1, 3885 => 1, 3901 => 1, 3902 => 1)) && ($npc->GetRace() == 128)) {
quest::emote("is shocked by the interaction of the pure elements.");
quest::say("I think something is happening...");
quest::npcfeature("race", 147);
quest::spawn2(1257,0,0,9318,779,1065,64); #spawns First_Spectral_Guardian
}
plugin::return_items(\%itemcount);
}

sub EVENT_SIGNAL {
if ($signal => 1) {
quest::npcfeature("race", 128);
}
}

Asylum
08-26-2014, 10:30 AM
Update: If you wish to use the above encounter Perl files, please make the change of sub EVENT_DEATH to sub EVENT_DEATH_COMPLETE due to the script now executing this sub prior to despawn/corpse appear, not after.

More free encounter files to come soon...