PDA

View Full Version : Odd Problem and a Question


Bandor
04-12-2015, 08:27 PM
So for whatever reason the npc this quest is attached to will not accept any items. Even before I put in the line for returns he would still return everything. Never ran into this before any ideas?

sub EVENT_SAY {
if($text=~/hail/i) {
if($qglobals{"Ruko"} == 1) {
plugin::Whisper("Hello $name. You are currently ready for task number 1, are you " . quest::saylink("prepared", 1) . " ?");
} elsif($qglobals{"Ruko"} == 2) {
plugin::Whisper("Hello $name. You are currently ready for task number 2, are you " . quest::saylink("prepared", 1) . " ?");
} elsif($qglobals{"Ruko"} == 3) {
plugin::Whisper("Hello $name. You are currently ready for task number 3, are you " . quest::saylink("prepared", 1) . " ?");
} elsif($qglobals{"Ruko"} == 4) {
plugin::Whisper("Hello $name. You are currently ready for task number 4, are you " . quest::saylink("prepared", 1) . " ?");
} elsif($qglobals{"Ruko"} == 5) {
plugin::Whisper("Hello $name. You are currently ready for the final task, are you " . quest::saylink("prepared", 1) . " ?");
} elsif($qglobals{"Epicz"} == 1) {
plugin::Whisper("Speak with Commander Tazen,I feel your skills will be of great use to him!");
} else {
plugin::Whisper("Hello $name are you a " . quest::saylink("ranger", 1) . " ?");
}
}
if($text=~/prepared/i) {
if($qglobals{"Ruko"} == 1) {
plugin::Whisper("Very Well!");
quest::assigntask(5);
quest::zone(brellsarena);
} elsif($qglobals{"Ruko"} == 2) {
plugin::Whisper("Very Well!");
quest::assigntask(6);
quest::zone(brellsarena);
} elsif($qglobals{"Ruko"} == 3) {
plugin::Whisper("Very Well!");
quest::assigntask(7);
quest::zone(brellsarena);
} elsif($qglobals{"Ruko"} == 4) {
plugin::Whisper("Very Well");
quest::assigntask(8);
quest::zone(brellsarena);
} elsif($qglobals{"Ruko"} == 5) {
plugin::Whisper("Very Well");
quest::assigntask(9);
quest::zone(brellsarena);
} else {
plugin::Whisper("I Can do nothing for you!");
}
}
elsif(($text=~/archery/i) && ($class eq "Ranger")) {
plugin::Whisper("Wonderful! While out on your adventures you may find many various items that can be used to fashion new arrows or bows! This is doable with the skill " . quest::saylink("fletching", 1) . " . I also have a series of tasks you can do to receive various useful items! What do ya say will you " . quest::saylink("help", 1) . " me?");
quest::setglobal("Ruko", 1, 5, "F");
}
elsif(($text=~/fletching/i) && ($class eq "Ranger")) {
plugin::Whisper("To get started with fletching first take this....Now look over the recipes and look out for items throughout your travels. When you have the items required to create a item simply combine them in your fletching kit. Deep within the Basement you can also find my supplier he should have everything you need!");
quest::summonitem(17910);
}
elsif($text=~/help/i) {
plugin::Whisper("Wonderful I offer a series of Five tasks.Each one getting progressively more difficult. The risk is great but the reward is worth it! So tell me, are you " . quest::saylink("prepared", 1) . " ?");
}
elsif(($text=~/ranger/i) && ($class eq "Ranger")) {
plugin::Whisper("Hello young Ranger! Allow me to outfit you with your first bow!");
quest::summonitem(4066); #Material Pack
plugin::Whisper("Would you be interested in further improving your " . quest::saylink("archery", 1) . " ?");
}
}
}


sub EVENT_ITEM {
if(plugin::check_handin(\%itemcount, 4089 => 1)) { #
quest::summonitem(4142);
quest::summonitem(4150); # Tonfa
} elsif (plugin::check_handin(\%itemcount, 4090 => 1)) { #
quest::summonitem(4143);
quest::summonitem(4151); # 1hs
} elsif (plugin::check_handin(\%itemcount, 4092 => 1)) { #
quest::summonitem(4144);
quest::summonitem(4160); # Anger
} elsif (plugin::check_handin(\%itemcount, 4117 => 1)) { #
quest::summonitem(4145);
quest::summonitem(4197);# 1hb
} elsif (plugin::check_handin(\%itemcount, 4140 => 1)) { #
quest::summonitem(4149);
quest::summonitem(4198);# 2hb
}
plugin::return_items(\%itemcount);
}



My other question is,is there a way of making a line for random race? Im trying to make the quest choose set your race to any playable race completely at random. Here is my current set up just not sure what to attach to $rnd lol.


sub EVENT_SAY {
# Links
my $rnd = random IDs?;
# End

if($text=~/hail/i) {
plugin::Whisper("Hello $name. Do you seek to change your " . quest::saylink("race", 1) . " ? Or Perhaps you would like a " . quest::saylink("redo", 1) . " ?");
quest::setglobal("Race", 1, 5, "F");
}
elsif($text=~/sure/i) {
if($qglobals{"Race"} == 1) {
plugin::Whisper("Very Well");
quest::permarace($rnd);
quest::setglobal("Race", 2, 5, "F");
} elsif($qglobals{"Race"} == 2) {
plugin::Whisper("Very Well");
quest::permarace($rnd);
quest::setglobal("Race", 3, 5, "F");
} elsif($qglobals{"Race"} == 3) {
plugin::Whisper("Very Well");
quest::permarace($rnd);
quest::setglobal("Race", 4, 5, "F");
} elsif($qglobals{"Race"} == 4) {
plugin::Whisper("Very Well");
quest::permarace($rnd);
quest::setglobal("Race", 5, 5, "F");
} else {
plugin::Whisper("I can do nothing for you at this time.");
}
}
elsif($text=~/race/i) {
plugin::Whisper("I can change your race for you if you bring me a " . quest::varlink(3856) . " . I believe Relkor was said to have them in his possesion. Please note that this change is permanent and completely random!");
}
elsif($text=~/redo/i) {
plugin::Whisper("Please note I can only ever do this for you 4 times. Are you " . quest::saylink("sure", 1) . " you want a redo?");
}
}



sub EVENT_ITEM {
if( plugin::check_handin(\%itemcount, 3856 => 1)) {
plugin::Whisper("As promised!");
quest::permarace($rnd);
quest::setglobal("Race", 1, 5, "F");
}
}

Kingly_Krab
04-12-2015, 09:30 PM
Script One: sub EVENT_SAY {
if ($text=~/hail/i) {
if (defined $qglobals{"Ruko"} && $qglobals{"Ruko"} >= 1 && $qglobals{"Ruko"} <= 5) {
plugin::Whisper("Hello $name. You are currently ready for your next task, are you " . quest::saylink("prepared", 1) . "?");
} elsif (defined $qglobals{"Epicz"} && $qglobals{"Epicz"} == 1) {
plugin::Whisper("Speak with Commander Tazen, I feel your skills will be of great use to him!");
} else {
plugin::Whisper("Hello $name, are you a " . quest::saylink("ranger", 1) . "?");
}
} elsif ($text=~/prepared/i) {
if (defined $qglobals{"Ruko"} && $qglobals{"Ruko"} >= 1 && $qglobals{"Ruko"} <= 5) {
plugin::Whisper("Very Well!");
quest::assigntask(($qglobals{"Ruko"} + 4));
quest::zone("brellsarena");
} else {
plugin::Whisper("I can do nothing for you.");
}
} elsif ($text=~/archery/i && $class eq "Ranger") {
plugin::Whisper("Wonderful! While out on your adventures you may find many various items that can be used to fashion new arrows or bows! This is doable with the skill " . quest::saylink("fletching", 1) . " . I also have a series of tasks you can do to receive various useful items! What do ya say, will you " . quest::saylink("help", 1) . " me?");
quest::setglobal("Ruko", 1, 5, "F");
} elsif ($text=~/fletching/i && $class eq "Ranger") {
plugin::Whisper("To get started with fletching first take this.... Now look over the recipes and look out for items throughout your travels. When you have the items required to create a item simply combine them in your fletching kit. Deep within the Basement you can also find my supplier he should have everything you need!");
quest::summonitem(17910);
} elsif ($text=~/help/i) {
plugin::Whisper("Wonderful I offer a series of Five tasks. Each one getting progressively more difficult. The risk is great but the reward is worth it! So tell me, are you " . quest::saylink("prepared", 1) . " ?");
} elsif ($text=~/ranger/i && $class eq "Ranger") {
plugin::Whisper("Hello young Ranger! Allow me to outfit you with your first bow!");
quest::summonitem(4066);
plugin::Whisper("Would you be interested in further improving your " . quest::saylink("archery", 1) . "?");
}
}

sub EVENT_ITEM {
if (plugin::check_handin(\%itemcount, 4089 => 1)) {
quest::summonitem($_) for (4142, 4150);
} elsif (plugin::check_handin(\%itemcount, 4090 => 1)) {
quest::summonitem($_) for (4143, 4151);
} elsif (plugin::check_handin(\%itemcount, 4092 => 1)) {
quest::summonitem($_) for (4144, 4160);
} elsif (plugin::check_handin(\%itemcount, 4117 => 1)) {
quest::summonitem($_) for (4145, 4197);
} elsif (plugin::check_handin(\%itemcount, 4140 => 1)) {
quest::summonitem($_) for (4149, 4198);
}
plugin::return_items(\%itemcount);
}Script Two: $rnd = quest::ChooseRandom(1..12, 128, 130, 330, 522);
sub EVENT_SAY {
if($text=~/hail/i) {
plugin::Whisper("Hello $name. Do you seek to change your " . quest::saylink("race", 1) . "? Or Perhaps you would like a " . quest::saylink("redo", 1) . "?");
quest::setglobal("Race", 1, 5, "F");
} elsif($text=~/sure/i) {
if(defined $qglobals{"Race"} && $qglobals{"Race"} >= 1 && $qglobals{"Race"} <= 4) {
plugin::Whisper("Very Well");
quest::permarace($rnd);
quest::setglobal("Race", ($qglobals{"Race"} + 1), 5, "F");
} else {
plugin::Whisper("I can do nothing for you at this time.");
}
} elsif($text=~/race/i) {
plugin::Whisper("I can change your race for you if you bring me a " . quest::varlink(3856) . " . I believe Relkor was said to have them in his possesion. Please note that this change is permanent and completely random!");
} elsif($text=~/redo/i) {
plugin::Whisper("Please note I can only ever do this for you 4 times. Are you " . quest::saylink("sure", 1) . " you want a redo?");
}
}

sub EVENT_ITEM {
if(plugin::check_handin(\%itemcount, 3856 => 1)) {
plugin::Whisper("As promised!");
quest::permarace($rnd);
quest::setglobal("Race", 1, 5, "F");
}
}Make sure to enable quest globals on these NPCs if you haven't already.

Also, make sure to always check if the quest global is defined, that way if it isn't it just defaults out.

Bandor
04-13-2015, 08:00 AM
Awesome thank you KK,they are working perfect now... Looking over the first script to see what you changed,the oonly real difference I see is the way items are summoned via the turn in. Is that what was keeping him from accepting items,or what exactly was causing that? Just asking for future refrence if I run into something like that again.