PDA

View Full Version : Starting a second say event


Pretentious
09-09-2009, 12:09 AM
So, right now, I have a quest.

In the quest, you are supposed to get an item from a boss, and then when you do that, you turn the item in to the guy, and it should start up a second dialect.

It isn't working right now. Are there custom flags I could use perhaps?

Keep in mind, I am not the best of Perl coders. I learned it just 2 days ago, and this is what I have to show for it so far. (not really impressive, right?)

So, what I'm wondering is after


sub EVENT_ITEM {
# Instructions ID - 1050
my $instructions = 0;
if (plugin::check_handin(\%itemcount,1037 =>1 )) {
quest::emote("stares at you and then bursts into tears.");
$client->Message(5, "I am so sorry! I should never have sent you to that place! Can you ever [forgive me]?");

if it's possible for the npc to remember that you have turned in that item, and as a result, when you hail him the second time, he will start with the text after this, rather than the stuff at the time.

sub EVENT_SAY
{
if($text=~/Hail/i)
{
quest::emote("jumps at your voice, and begins breathing heavily...");
$client->Message(5, "Oh, it's just you. I bet [you think I'm crazy] too, huh? Everyone thinks I'm crazy!");
}

if($text=~/you're not crazy/i)
{
quest::emote("nods while looking at you...");
$client->Message(5, "Before I hit rock bottom I was a successful merchant right here in Freeport. I made my living crafting marvelous gems. One night, while I was closing up shop, I was approached by a strange [man].");
}

if($text=~/what man?/i)
{
$client->Message(5, "He never gave me a name. He handed me a list of [instructions], written in a strange language. They described in extraordinary detail how to gather materials for and craft the most remarkable of gems.");
}

if($text=~/What instructions?/i)
{
$client->Message(5, "I told him it would take countless platinum to make what he asked, and he walked away in a scuff. He told me where he got them, though. If you can [bring me the instructions], I can tell you where to get the required materials, and will craft this gem for you, free of charge.");
}

if($text=~/i will bring you the instructions/i)
{
quest::emote("cackles, almost.. crazily...");
$client->Message(5, "Very good sir! There.. there is a slight [problem] though...");
}

if($text=~/what problem?/i)
{
$client->Message(5, "I overheard people talking. The man was eaten by none other than [Untel'Dak]. You must slay this beast and bring me the instructions he will surely have in... most unpleasant places.");
}

if($text=~/untel'dak?/i)
{
quest::emote("shrugs");
$client->Message(5, "I wish I could tell you more, but I have never laid eyes on him. He is not of this world; he resides in a place where only nightmares dwell.");
}
}

sub EVENT_ITEM {
# Instructions ID - 1050
my $instructions = 0;
if (plugin::check_handin(\%itemcount,1037 =>1 )) {
quest::emote("stares at you and then bursts into tears.");
$client->Message(5, "I am so sorry! I should never have sent you to that place! Can you ever [forgive me]?");
}

if($text=~/i forgive you/i)
{
$client->Message(5, "You must be exceptionally strong. As promised, I will craft you the gem. You just have to bring me the [items] on the list.");
}

if($text=~/what items?/i)
{
$client->Message(5, "To craft this item for you, I will need [three items] of extremely rare quality.");
}

if($text=~/three items?/i)
{
$client->Message(5, "Yes. The [first] and [second] should come with only slight difficulty. The [third] you may have some trouble with.");
}

if($text=~/the first/i)
{
$client->Message(5, "The first gem is held by Overking Bathezid. He will not part with it willingly. It is his most prized possesion. If power is what you seek, you will have to take it from him.");
}

if($text=~/the second/i)
{
$client->Message(5, "The second gem is held by The Junk Beast in the Plane of Innovation. The [clockwork] some how got a hold of it, and now are refusing to give it up.");
}

if($text=~/what clockwork?/i)
{
$client->Message(5, "The clockwork are mechanical beings that reside in the Plane of Innovation. They are ruthless, as they have no souls. Be careful in there.");
}

if($text=~/the third/i)
{
$client->Message(5, "The third gem is held by none other than Aerin'Dar. His lair lies in the Plane of Valor. Thousands have died before his claws. Be careful.");
}
}
sub EVENT_ITEM_2 {
if($itemcount{1038} == 1 && $itemcount{1040} == 1 && $itemcount{1050} == 1){
$client->Message(5, "I have done it! You are truly strong! This gem is fit for someone of your power! I hope you enjoy it!");
quest::summonitem("1038");
} else {
$client->Message(5, "I don't need this.");
if($item1 > 0){quest::summonitem("1038");}
if($item2 > 0){quest::summonitem("1040");}
if($item3 > 0){quest::summonitem("1050");}
}
}

ChaosSlayerZ
09-09-2009, 12:39 AM
ok first of all there is no such thing as sub EVENT_ITEM_2

there can only be ONE of any special subs.

2nd the say check will not work from inside sub EVENT_ITEM or any other sub other than EVENT_SAY

what you need for npc to remember you is to use a global variable.

there is an example in details in the wiki on how to use it.
i don't have a sample handy atm

Pretentious
09-09-2009, 12:53 AM
Is it alright to use the same function twice?

I appreciate the help, and apologize for the noobiness.

ChaosSlayerZ
09-09-2009, 01:19 AM
if by function you mean the subs- then no.
if you need to make more than 1 item hand in check you simple put them in one after another, like this:




sub EVENT_ITEM
{


if(plugin::check_handin(\%itemcount, 1001 => 1))
{
quest::say("You gave me item 1001!");
quest::summonitem("1002");
}

if(plugin::check_handin(\%itemcount, 1002 => 1))
{
quest::say("You gave me item 1002!");
quest::summonitem("1001");
}


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

}