PDA

View Full Version : Lost Love (Timers, Signals, Proximity, Quest Globals and Follow)


trevius
03-17-2008, 04:30 PM
This quest is called "Lost Love" and the description of the quest sounds very simple, but it actually took some thinking to get everything to work perfectly.

Quest Outline:
A Human named Marvin has lost his wife, a Human named Serra, somewhere in the Estate of Unrest.

Little does Marvin know that his wife was killed and came back as a Zombie due to the magical properties of Unrest.

Marvin will hint that Serra is in the underwater cave in Unrest.

When Undead Serra is found, she tells the player to go back to Marvin and tell him that they found her.

Once told, Marvin will follow the player back to Undead Serra.

Upon arrival, Marvin freaks out not knowing that the Zombie they brought him to is his Undead Wife.

Marvin gives the player an unlimited invis to undead potion and runs away in fright and suggests that the player do the same.

A few seconds after Marvin runs away, Undead Serra tells the player she is still in need of their help.

When hailed this time, Undead Serra tells the player of a possible cure that was discovered by a Gnome named Khrix.

Undead Serra hints that Krix isn't very brave so he is probably hiding in a corner (he is in a closet) somewhere in the Estate itself.

Undead Serra asks that the player find the cure and bring it back to her.

The player finds Khrix and kills him, because he isn't willing to share his cure and is pretty aggressive about it.

The player returns the cure (Gnomish Potion of Regeneration) to Undead Serra.

Upon drinking the cure potion, Undead Serra despawns and instantly respawns as a Human Female version of herself.

The freshly cured Serra then says she is going back to Marvin and walks back towards him and despawns.

The End :)

The quest has 4 NPCs involved, and 3 items. It would be easy to customize to anyone's liking for any zone with any NPCs and any rewards.

I have verified that all parts of this quest are working as intended. It took quite a bit of work to perfect it as I haven't used some of these systems before.

Onto the quests (4 quests in 2 posts due to length):

Undead Serra's Quest:

#############
#Quest Name: Lost Love (Undead_Serra Portion)
#Author: Trevius of Storm Haven
#NPC's Involved: Undead_Serra, Marvin, Serra, Khrix
#Items Involved: Potion of Unlimited Invisibily, Potion of Infinite Invis to Undead, Gnomish Potion of Regeneration
#############
###NPC 1
#Name: Undead_Serra
#Race 70 (Zombie), Texture 0, Size 5, gender 1, body type 3
#Location: -283, 688, 2.6 of the Estate of Unrest (In the underwater Cave)
#level: 25
#Type: Quest NPC
#Loot: N/A
#############
###Item 1
#Name: Potion of Unlimited Invisibily
#Item ID: 2420 (Custom Made Item)
#Stats: MAGIC, LORE, NO DROP, click effect Invisibility, maxcharges -1, cast time 1 second
#Attained From: Undead_Serra rewards this when she is given the cure (Gnomish Potion of Regeneration)
#############
###Item 2
#Name: Potion of Infinite Invis to Undead
#Item ID: 2421 (Custom Made Item)
#Stats: MAGIC, LORE, NO DROP, click effect Invis vs undead, maxcharges -1, cast time 1 second
#Attained From: Undead_Serra rewards this when Marvin is brought to her, but it appears like Marvin gave it to you
#############
###Item 3
#Name: Gnomish Potion of Regeneration
#Item ID: 2831 (Custom Made Item)
#Stats: MAGIC, LORE, NO DROP
#Attained From: Killing and looting Khrix
#############

#Set a small proximity when spawned for use later on in the quest
sub EVENT_SPAWN {

my $x;
my $y;
my $z;
my $h;

$x = $npc->GetX();
$y = $npc->GetY();
$z = $npc->GetZ();
$h = $npc->GetHeading();

quest::set_proximity( $x-8,$x+8,$y-8,$y+8,$z-8,$z+8);

}


#If player with global find_serra 2 enters the proximity, reward them and signal Marvin to run away
sub EVENT_ENTER {

if ($find_serra == 2) {
quest::say("There you are, my love!");
quest::summonitem(2421);
quest::exp(4500);
quest::setglobal("find_serra", 3, 5, "F");
quest::signalwith(2700412,1,2); }

{
$find_serra=undef;
}

}


sub EVENT_SAY {

if ($text=~/Hail/i && $find_serra == undef) {
quest::say("H..h..hello? Can you help me? I have been killed...err hurt badly and I know that my [Marvin] must be worried sick about me."); }

#Set global find_serra to 1 so Marvin will have a new response when hailed
if ($text=~/marvin/i && $find_serra == undef) {
quest::say("Marvin is my husband, and I have been lost for quite a while now. If you see him, let him know that you found me.");
quest::setglobal("find_serra", 1, 5, "F"); }

#Reminder response if person forgets what they are supposed to be doing
if ($text=~/Hail/i && $find_serra == 1) {
quest::say("Find my husband and bring him to me, please."); }

#This response should never be seen, but added it just in case
if ($text=~/Hail/i && $find_serra == 2) {
quest::say("Find my husband and bring him to me, please."); }

#These are the responses after Marvin is brought to Serra and runs away
if ($text=~/Hail/i && $find_serra == 3) {
quest::say("I can't believe he didn't even recognize me. Am I really that disgusting now? Maybe there is a [cure]."); }

if ($text=~/cure/i && $find_serra == 3) {
quest::say("I have heard rumors that a gnome named [Khrix] has discovered a way to bring the undead back to life and restore them to their prior selves."); }

if ($text=~/khrix/i && $find_serra == 3) {
quest::say("Last I heard, Khrix was planning to run some experiments in the Estate itself. But he isn't the brave type, so he is probably cowering in a corner somewhere right about now. If you find the cure, please bring it to me."); }

#This is a generic response after all quests are completed
if ($text=~/Hail/i && $find_serra == 4) {
quest::say("Thank you!"); }

{
$find_serra=undef;
}

}


#After Marvin runs away, he sends this signal so Serra can tell the player there is more to do
sub EVENT_SIGNAL {

if ($signal == 2) {
quest::settimer("serra_say",5); }

}


#Serra says she needs more help a few seconds after Marvin leaves so they know to hail her again
sub EVENT_TIMER {

if ($timer eq "serra_say") {
quest::stoptimer("serra_say");
quest::say ("Oh no! Please don't leave yet. I am going to need more help for sure!"); }

}


#When the cure is given, Undead_Serra despawns the Zombie version of herself and respawns a human version
sub EVENT_ITEM {

#Give quest reward, set global to find_serra 4 so all quests are completed, and spawn Human Serra on a grid to walk back to Marvin
if (plugin::check_handin(\%itemcount, 2831 => 1)) {
quest::say("Oh! you found it!");
quest::emote("drinks the potion.");
quest::exp(4500);
quest::setglobal("find_serra", 4, 5, "F");
quest::summonitem(2420);
quest::spawn2(2700414,36,0,-283,688,2.6,136.5);
quest::depop(); }

else {
plugin::return_items(\%itemcount);
}

{
$find_serra=undef;
}

}

trevius
03-17-2008, 04:33 PM
Marvin's Quest:
#############
#Quest Name: Lost Love (Marvin Portion)
#Author: Trevius of Storm Haven
#NPC's Involved: Undead_Serra, Marvin, Serra, Khrix
#Items Involved: Potion of Unlimited Invisibily, Potion of Infinite Invis to Undead, Gnomish Potion of Regeneration
#############
###NPC 1
#Name: Marvin
#Race 1 (Human), Texture 0, Size 6, gender 0, body type 1
#Location: Zone in of the Estate of Unrest
#level: 25
#Type: Quest NPC
#Loot: N/A
#############

sub EVENT_SAY
{
if ($text =~/Hail/i && $find_serra == undef) {
quest::say ("Oh where, oh where is my [Serra]? She has been missing for days now."); }

if ($text =~/serra/i && $find_serra == undef) {
quest::say ("Serra is my beautiful wife. The last report I heard was that she was here in the Estate of Unrest and may have been swimming in the [water] here."); }

if ($text =~/water/i && $find_serra == undef) {
quest::say ("I have heard rumors that there are secret underwater caves in this area. If you can find her, please tell her I am looking for her."); }

#If the player has spoken with Serra, Marvin gives the global find_serra 1 response
if ($text =~/Hail/i && $find_serra == 1) {
quest::say ("Have you [found] Serra yet?"); }

#Marvin follows the player to Serra and sets the global find_serra to 2. He also sets a timer for Marvin to return if he isn't brought to Serra within 5 minutes
if ($text =~/found/i && $find_serra == 1) {
quest::say ("Take me to her right away! I will follow you there.");
quest::setglobal("find_serra", 2, 5, "F");
quest::follow($userid);
quest::settimer("return_marvin",300); }

#If Marvin returns after the timer runs out, this allows him to follow the player again and sets the timer again as well
if ($text =~/Hail/i && $find_serra == 2) {
quest::say ("Let's get going. This place is spooky.");
quest::follow($userid);
quest::settimer("return_marvin",300); }

#Response if player hails Marvin while he is supposed to be looking for the cure after Marvin ran away
if ($text =~/Hail/i && $find_serra == 3) {
quest::say("Ewwe, that was one spooky creature! Please keep looking for my Serra."); }

#Response once all quests are completed
if ($text =~/Hail/i && $find_serra == 4) {
quest::say ("Thank you $name for returning my Serra to me. I thought I would never find her in such a dreary place."); }

{
$find_serra=undef;
}

}


#Signal from Undead_Serra to Marvin when the player brings Marvin to her
sub EVENT_SIGNAL {

if ($signal == 1) {
quest::say ("That isn't my Serra! That's a living dead creature of the night! Take this, $name, and lets get out of here!");
quest::stoptimer("return_marvin");
quest::settimer("sfollow_marvin",3);
quest::signalwith(63029,2,8); }

}


sub EVENT_TIMER {

#After Marvin is brought to Undead_Serra, this timer is set to have him run away back to his spawn point
if ($timer eq "sfollow_marvin") {
quest::stoptimer("sfollow_marvin");
quest::say("I can't take it here any longer! Run for your life!");
quest::sfollow(); }

#This is the timer to return Marvin if the player takes too long to find Serra. This keeps the quest from getting bugged by players
if ($timer eq "return_marvin") {
quest::stoptimer("return_marvin");
quest::say("This is taking too long! I'm going back!");
quest::sfollow();
quest::setglobal("find_serra", 1, 5, "F"); }

{
$find_serra=undef;
}

}

Human Serra's Quest:
#############
#Quest Name: Lost Love (Serra Portion)
#Author: Trevius of Storm Haven
#NPC's Involved: Undead_Serra, Marvin, Serra, Khrix
#Items Involved: Potion of Unlimited Invisibily, Potion of Infinite Invis to Undead, Gnomish Potion of Regeneration
#############
###NPC 1
#Name: Serra
#Race 1 (Human), Texture 0, Size 5, gender 1, body type 1
#Location: -283, 688, 2.6 of the Estate of Unrest (In the underwater Cave)
#level: 25
#Type: NPC that walks back toward Marvin when quest is completed
#Loot: N/A
#############

#When the cure is given to Undead_Serra, she respawns in Human form and walks towards Marvin and despawns
sub EVENT_SPAWN {

quest::settimer("serra",30);
quest::say("I feel much better already! I must go tell Marvin of your heroic deed. I am sure he will be glad to see me like this again!");
quest::emote("leaves a potion for you.");

}


#This depops Serra in her Human form while she is walking back to Marvin
sub EVENT_TIMER {

if ($timer eq "serra") {
quest::stoptimer("serra");
quest::depop(); }

}


sub EVENT_SAY {

if ($text=~/Hail/i) {
quest::say("Thank you again! I can finally return to Marvin and never scare him like that again."); }

}


Khrix's Quest:
#############
#Quest Name: Lost Love (Khrix Portion)
#Author: Trevius of Storm Haven
#NPC's Involved: Undead_Serra, Marvin, Serra, Khrix
#Items Involved: Potion of Unlimited Invisibily, Potion of Infinite Invis to Undead, Gnomish Potion of Regeneration
#############
###NPC 4
#Name: Khrix
#Race 12 (Gnome), Texture 1, Size 3, gender 0, body type 1
#Location: In a closet inside the Estate of Unrest
#level: 25
#Type: NPC
#Loot: Gnomish Potion of Regeneration
#############
###Item 1
#Name: Gnomish Potion of Regeneration
#Item ID: 2831 (Custom Made Item)
#Stats: MAGIC, LORE, NO DROP
#Attained From: Killing and looting Khrix
#############

sub EVENT_ATTACK {

quest::say("You'll never get my secret cure! And now that you know about it, you must die!");

}

trevius
03-17-2008, 04:35 PM
Here is a complete list of all included NPCs and Items for all involved quest parts. It is too long to put all of these in each quest, so I put them all together here for reference:

#############
#Quest Name: Lost Love
#Author: Trevius of Storm Haven
#NPC's Involved: Undead_Serra, Marvin, Serra, Khrix
#Items Involved: Potion of Unlimited Invisibily, Potion of Infinite Invis to Undead, Gnomish Potion of Regeneration
#############
###NPC 1
#Name: Undead_Serra
#Race 70 (Zombie), Texture 0, Size 5, gender 1, body type 3
#Location: -283, 688, 2.6 of the Estate of Unrest (In the underwater Cave)
#level: 25
#Type: Quest NPC
#Loot: N/A
#############
###NPC 2
#Name: Serra
#Race 1 (Human), Texture 0, Size 5, gender 1, body type 1
#Location: -283, 688, 2.6 of the Estate of Unrest (In the underwater Cave)
#level: 25
#Type: NPC that walks back toward Marvin when quest is completed
#Loot: N/A
#############
###NPC 3
#Name: Marvin
#Race 1 (Human), Texture 0, Size 6, gender 0, body type 1
#Location: Zone in of the Estate of Unrest
#level: 25
#Type: Quest NPC
#Loot: N/A
#############
###NPC 4
#Name: Khrix
#Race 12 (Gnome), Texture 1, Size 3, gender 0, body type 1
#Location: In a closet inside the Estate of Unrest
#level: 25
#Type: NPC
#Loot: Gnomish Potion of Regeneration
#############
###Item 1
#Name: Potion of Unlimited Invisibily
#Item ID: 2420 (Custom Made Item)
#Stats: MAGIC, LORE, NO DROP, click effect Invisibility, maxcharges -1, cast time 1 second
#Attained From: Undead_Serra rewards this when she is given the cure (Gnomish Potion of Regeneration)
#############
###Item 2
#Name: Potion of Infinite Invis to Undead
#Item ID: 2421 (Custom Made Item)
#Stats: MAGIC, LORE, NO DROP, click effect Invis vs undead, maxcharges -1, cast time 1 second
#Attained From: Undead_Serra rewards this when Marvin is brought to her, but it appears like Marvin gave it to you
#############
###Item 3
#Name: Gnomish Potion of Regeneration
#Item ID: 2831 (Custom Made Item)
#Stats: MAGIC, LORE, NO DROP
#Attained From: Killing and looting Khrix
#############