PDA

View Full Version : Can anyone provide a random weapon quest template ?


everlastnmn
05-19-2010, 08:54 PM
What I'm kind of thinking would be a specific set of weapons. You complete a quest and receive the quest reward. If you receive a 1hb and rather have a 1hs, you can turn it back in for another random generated weapon until the weapon of your choice has been obtained.

Kinda like the ST key quest - you turn in the ST key and receive either the earring, weapon or whatever else it was and could turn it back in for a different item.

Thanks !

nenelan
06-09-2010, 06:58 AM
I /think/ this should work. See if it works, if so, rip it apart and modify it for your own use.

# Cycle Reward


sub EVENT_SAY {
my $item = quest::saylink("item",1);

@rewardlist = (68875, 68876, 68877, 68878, 68879, 68970, 68971, 68875);


if ($text =~/Hail/i) {
plugin::Whisper("I can give you an [$item], which you can give back to me, and I will cycle through a list of items I will give back to you. Isn't cyclic redundancy fun?");
}
if ($text =~/item/i) {
plugin::Whisper("Here you go.");
quest::summonitem("68879");
}
}

sub EVENT_ITEM {
my $given = 0;
my $togive = 0;
my $count = 0;
foreach $positem (@rewardlist) {

if ($given == 0) {
if (plugin::check_handin(\%itemcount, $positem => 1)) {
$togive = $count+1;
$given = 1;
}
}
else {
quest::summonitem($rewardlist[$togive]);
plugin::Whisper("If you want something else, please return that to me. I will go through my list of items and give you the next one on the list.");
return;
}
$count++;
}

if ($given == 0) {
plugin::return_items(\%itemcount);
}

}