PDA

View Full Version : Question..again


Bandor
04-14-2015, 10:11 PM
I know this is getting to be a weekly thing but I have yet another slightly broken quest lol. Please be patient with me im learning!


All of this works except the final part,were you say pick for the item. I had it working but it appears you could just say pick and get an item without achieving the global flag first. For whatever reason the script below doesnt seem to be setting the global to get trigger the pick text.

sub EVENT_SAY {
my %hash = ("Warrior" => [2275, 2277],
"Cleric" => [2376, 2275],
"Paladin" => [2275, 2277],
"Ranger" => [2277, 2379],
"Shadowknight" => [2275, 2277],
"Druid" => [2370, 2372, 2376],
"Monk" => [2277, 2379],
"Bard" => [2277, 2372, 2377],
"Rogue" => [2277, 2379],
"Shaman" => [2298, 2376, 2372],
"Necromancer" => [2278, 2372],
"Wizard" => [2298, 2370, 2378],
"Magician" => [2278, 2370, 2378],
"Enchanter" => [2377..2378],
"Beastlord" => [2277..2278, 2298],
"Berserker" => [2277, 2379]);
my %spells = (2372 => 2385,
2298 => 2380,
2378 => 2381,
2376 => 2383,
2377 => 2393,
2370 => 2381);
if ($text=~/hail/i) {
if ($ulevel > 69) {
plugin::Whisper("Hello $name! A item of great power await all those that are willing to " . quest::saylink("slay", 1) . " their demons.");
} elsif (defined $qglobals{"Epicz"} && $qglobals{"Epicz"} >= 2) {
plugin::Whisper("You are a great adventurer $name.");
} else {
plugin::Whisper("You are not ready fur such an adventure. Find the Slayer's near the temple entrance,perhaps they could use someone of your stature. Return to me when you have gained more strength!");
}
}
elsif($text=~/slay/i) {
plugin::Whisper("An ancient demon known as Azgraeth has chosen to take the form of a powerful master. Azgraeth quickly used his new body to unleash his
images upon a section of norrath. In an last minute effort to destroy Azgraeth once and for all a group of powerful adventurers banished him to a horrid chamber. Though that seemed to be all they could do. Once there Azgraeth mastered his magic and is now preparing to attempt to wreak havoc on Norrath again! Do you think you are strong enough to " . quest::saylink("stop", 1) . " him?");
}
elsif($text=~/stop/i) {
plugin::Whisper("I will send you to the chamber and allow you to face Azgraeth. Please be prepared, you should bring many friends as this fight will test your skills to the limits! If you should happen to win this battle bring me back " . quest::varlink(4332) . " as proof. When you are " . quest::saylink("ready", 1) . " I will send you.");
}
elsif($text=~/stop/i) {
plugin::Whisper("Very well $name!");
quest::zone("chambersa");
}
elsif($text=~/pick/i && !defined $qglobals{"Epicz"} && $qglobals{"Epicz"} == 1) {
plugin::Whisper("Just pick which item you want young $class.");
if (defined $hash{$class}[1]) {
foreach my $item (@{$hash{$class}}) {
$client->Message(315, quest::varlink($item) . " " . quest::saylink($item, 1, "Choose"));
}
} else {
$client->Message(315, quest::varlink($hash{$class}) . " " . quest::saylink($hash{$class}, 1, "Choose"));
}
} elsif($text=~/pick/i && defined $qglobals{"Epicz"} && $qglobals{"Epicz"} >= 2) {
plugin::Whisper("You have already chosen your path!");
} elsif (int($text) > 0 && int($text) < 999999 && !defined $qglobals{"Epicz"}) {
if (defined $hash{$class}[1]) {
foreach my $item (@{$hash{$class}}) {
if ($item == int($text)) {
quest::setglobal("Epicz", $item, 5, "F");
quest::summonitem($item);
if (defined $spells{$item}) {
quest::summonitem($spells{$item});
}
}
}
} else {
if ($hash{$class} == int($text)) {
quest::setglobal("Epicz", $hash{$class}, 5, "F");
quest::summonitem($hash{$class});
}
}
}
}



sub EVENT_ITEM {
if(plugin::check_handin(\%itemcount, 4332 => 1)) {
plugin::Whisper("As promised! Just " . quest::saylink("pick", 1) . " your item.");
quest::setglobal("Epicz", 1, 5, "F");
}
plugin::return_items(\%itemcount);
}
}

Kingly_Krab
04-14-2015, 10:42 PM
Check this line: elsif($text=~/pick/i && !defined $qglobals{"Epicz"} && $qglobals{"Epicz"} == 1) {You're checking if it's not defined then checking its value even though this line sets it to 1: quest::setglobal("Epicz", 1, 5, "F");Also, you're checking for $hash{$class} even though they all have at least 2 elements in their array, here's my re-write (keep in mind it is untested): sub EVENT_SAY {
my %hash = ("Warrior" => [2275, 2277],
"Cleric" => [2376, 2275],
"Paladin" => [2275, 2277],
"Ranger" => [2277, 2379],
"Shadowknight" => [2275, 2277],
"Druid" => [2370, 2372, 2376],
"Monk" => [2277, 2379],
"Bard" => [2277, 2372, 2377],
"Rogue" => [2277, 2379],
"Shaman" => [2298, 2376, 2372],
"Necromancer" => [2278, 2372],
"Wizard" => [2298, 2370, 2378],
"Magician" => [2278, 2370, 2378],
"Enchanter" => [2377..2378],
"Beastlord" => [2277..2278, 2298],
"Berserker" => [2277, 2379]);
my %spells = (2372 => 2385,
2298 => 2380,
2378 => 2381,
2376 => 2383,
2377 => 2393,
2370 => 2381);
if ($text=~/hail/i) {
if ($ulevel > 69) {
plugin::Whisper("Hello $name! A item of great power await all those that are willing to " . quest::saylink("slay", 1) . " their demons.");
} elsif (defined $qglobals{"Epicz"} && $qglobals{"Epicz"} >= 2) {
plugin::Whisper("You are a great adventurer $name.");
} else {
plugin::Whisper("You are not ready fur such an adventure. Find the Slayer's near the temple entrance,perhaps they could use someone of your stature. Return to me when you have gained more strength!");
}
} elsif($text=~/slay/i) {
plugin::Whisper("An ancient demon known as Azgraeth has chosen to take the form of a powerful master. Azgraeth quickly used his new body to unleash his
images upon a section of norrath. In an last minute effort to destroy Azgraeth once and for all a group of powerful adventurers banished him to a horrid chamber. Though that seemed to be all they could do. Once there Azgraeth mastered his magic and is now preparing to attempt to wreak havoc on Norrath again! Do you think you are strong enough to " . quest::saylink("stop", 1) . " him?");
} elsif($text=~/stop/i) {
plugin::Whisper("I will send you to the chamber and allow you to face Azgraeth. Please be prepared, you should bring many friends as this fight will test your skills to the limits! If you should happen to win this battle bring me back " . quest::varlink(4332) . " as proof. When you are " . quest::saylink("ready", 1) . " I will send you.");
} elsif($text=~/stop/i) {
plugin::Whisper("Very well $name!");
quest::zone("chambersa");
} elsif($text=~/pick/i && defined $qglobals{"Epicz"} && $qglobals{"Epicz"} == 1) {
plugin::Whisper("Just pick which item you want young $class.");
$client->Message(315, quest::varlink($_) . " " . quest::saylink($_, 1, "Choose")) for @{$hash{$class}};
} elsif($text=~/pick/i && defined $qglobals{"Epicz"} && $qglobals{"Epicz"} >= 2) {
plugin::Whisper("You have already chosen your path!");
} elsif (int($text) > 0 && int($text) < 999999 && defined $qglobals{"Epicz"} && $qglobals{"Epicz"} == 1) {
if (int($text) ~~ @{$hash{$class}}) {
quest::setglobal("Epicz", int($text), 5, "F");
quest::summonitem(int($text));
if (defined $spells{int($text)}) {
quest::summonitem($spells{int($text)});
}
}
}
}

sub EVENT_ITEM {
if(plugin::check_handin(\%itemcount, 4332 => 1)) {
plugin::Whisper("As promised! Just " . quest::saylink("pick", 1) . " your item.");
quest::setglobal("Epicz", 1, 5, "F");
}
plugin::return_items(\%itemcount);
}

Bandor
04-15-2015, 08:10 AM
Gave it a shot,no go on the rewrite,isnt responsive to anything.

ghanja
04-15-2015, 11:38 AM
Make line 42 read this:


$client->Message(315, quest::varlink($_) . " " . quest::saylink($_, 1, "Choose")) for @{$hash{$class}};

Bandor
04-15-2015, 03:02 PM
Got that working now. However its still not wanting to respond to pick after giving him the item. Not sure if the global isnt setting or if the 'pick' part is acting up

ghanja
04-15-2015, 03:51 PM
Got that working now. However its still not wanting to respond to pick after giving him the item. Not sure if the global isnt setting or if the 'pick' part is acting up

Verify qglobal is set on the NPC. It is perhaps the single most often over looked setting (because normally, most firmly believe they already set it, but, didn't). I still fall victim to this time to time.

Krab said it was untested, and I didn't bother to test it either, it was a missing close brace } that was missing, rather, it popped out at me. I'll give it another look, though I suspect Krab is lurking (he's sneaky like that).

ghanja
04-15-2015, 04:09 PM
Changed formatting a little for my eyes, line 55 I didnt think was supposed to check for another "stop" (or whatever it was). Curious, line 59 is checking to see if Epicz is not defined, yet, also checking to see if it has a value of 1?


%hash = (
"Warrior" => [2275, 2277],
"Cleric" => [2376, 2275],
"Paladin" => [2275, 2277],
"Ranger" => [2277, 2379],
"Shadowknight" => [2275, 2277],
"Druid" => [2370, 2372, 2376],
"Monk" => [2277, 2379],
"Bard" => [2277, 2372, 2377],
"Rogue" => [2277, 2379],
"Shaman" => [2298, 2376, 2372],
"Necromancer" => [2278, 2372],
"Wizard" => [2298, 2370, 2378],
"Magician" => [2278, 2370, 2378],
"Enchanter" => [2377..2378],
"Beastlord" => [2277..2278, 2298],
"Berserker" => [2277, 2379]
);

%spells = (
2372 => 2385,
2298 => 2380,
2378 => 2381,
2376 => 2383,
2377 => 2393,
2370 => 2381
);


sub EVENT_SAY {
if ($text=~/hail/i) {
if ($ulevel > 69) {
plugin::Whisper("Hello $name! A item of great power await all those that are willing to " . quest::saylink("slay", 1) . " their demons.");
}
elsif (defined $qglobals{"Epicz"} && $qglobals{"Epicz"} >= 2) {
plugin::Whisper("You are a great adventurer $name.");
}
else {
plugin::Whisper("You are not ready fur such an adventure. Find the Slayer's near the temple entrance,perhaps they could use someone ".
"of your stature. Return to me when you have gained more strength!");
}
}
elsif($text=~/slay/i) {
plugin::Whisper("An ancient demon known as Azgraeth has chosen to take the form of a powerful master. Azgraeth quickly used his new body ".
"to unleash his images upon a section of norrath. In an last minute effort to destroy Azgraeth once and for all a group of ".
"powerful adventurers banished him to a horrid chamber. Though that seemed to be all they could do. Once there Azgraeth ".
"mastered his magic and is now preparing to attempt to wreak havoc on Norrath again! Do you think you are strong enough ".
"to ".quest::saylink("stop", 1)." him?");
}
elsif($text=~/stop/i) {
plugin::Whisper("I will send you to the chamber and allow you to face Azgraeth. Please be prepared, you should bring many friends as ".
"this fight will test your skills to the limits! If you should happen to win this battle bring me back ".quest::varlink(4332).
" as proof. When you are " . quest::saylink("ready", 1) . " I will send you.");
}
elsif($text=~/ready/i) {
plugin::Whisper("Very well $name!");
quest::zone("chambersa");
}
elsif($text=~/pick/i && !defined $qglobals{"Epicz"} && $qglobals{"Epicz"} == 1) {
plugin::Whisper("Just pick which item you want young $class.");
$client->Message(315, quest::varlink($_)." ".quest::saylink($_, 1, "Choose")) for @{$hash{$class}};
}
elsif($text=~/pick/i && defined $qglobals{"Epicz"} && $qglobals{"Epicz"} >= 2) {
plugin::Whisper("You have already chosen your path!");
}
elsif (int($text) > 0 && int($text) < 999999 && defined $qglobals{"Epicz"} && $qglobals{"Epicz"} == 1) {
if (int($text) ~~ @{$hash{$class}}) {
quest::setglobal("Epicz", int($text), 5, "F");
quest::summonitem(int($text));
if (defined $spells{int($text)}) {
quest::summonitem($spells{int($text)});
}
}
}
}

sub EVENT_ITEM {
if (plugin::check_handin(\%itemcount, 4332 => 1)) {
plugin::Whisper("As promised! Just ".quest::saylink("pick", 1)." your item.");
quest::setglobal("Epicz", 1, 5, "F");
}
plugin::return_items(\%itemcount);
}

ghanja
04-15-2015, 04:26 PM
I'm going to go out on a limb and assume line 59 should read:


elsif($text=~/pick/i && defined $qglobals{"Epicz"} && $qglobals{"Epicz"} == 1) {

Bandor
04-15-2015, 05:08 PM
That did it,working flawlessly now tyvm for the help!