Log in

View Full Version : Multiple Quest Rewards


Kilralpine
07-14-2009, 02:15 AM
I was wondering if anyone knew any nifty ways to have an npc offer multiple reward choices when turning in quest items via PERL... not the task system... I would use the task system but im not quite finished learning it yet and it is a whole lot more time consuming.

Would I have to use quest globals after the turn in to signal the npc to offer the different rewards??? Or is there a better and easier way to go about doing this?

trevius
07-14-2009, 03:20 AM
Yes, if you don't want to use the task system, then qglobals is probably your only other good option. You could do a point system if you wanted, or simply use a qglobal for the exchange. I have some examples of quests posted in the custom quest section using qglobals for a point system to choose item rewards like you are wanting.

Maybe some of the examples here and script comments will be of help:
http://www.eqemulator.net/forums/showthread.php?t=26123

MNWatchdog
07-14-2009, 04:57 AM
You could have the NPC accept a quest reward in enchange for a different item in a round robin manner.

Turn in item 1 get ya 2, 2 for 3, 3 for 4, 4 for 1.

trevius
07-14-2009, 06:33 AM
Or, you could even do a hasitem check and not have them do a turn in at all. Just check if they have the item before allowing them the options to get a reward. Then, list the possible rewards and once they chose one, just nuke the item that they need to have to get the reward.

Kilralpine
07-14-2009, 11:04 AM
Thanks guys, ill probably use Qglobals on the turn in and then have the npc offer the different items after that.

Trev are you using the task system on SH yet?

ChaosSlayerZ
07-14-2009, 11:41 AM
here is a little sample for you where npc takes 1 quest item and then gives you a random reward. he will also accept back any of the reward items and again randomly choose a reward item. Of course you may spent some time giving items back to him till you get exactly what you want.

item 1060 is the quest item, items 1189-1193 are rewards


sub EVENT_ITEM
{


if(plugin::check_handin(\%itemcount, 1060 => 1) ||
plugin::check_handin(\%itemcount, 1189 => 1) ||
plugin::check_handin(\%itemcount, 1190 => 1) ||
plugin::check_handin(\%itemcount, 1191 => 1) ||
plugin::check_handin(\%itemcount, 1192 => 1) ||
plugin::check_handin(\%itemcount, 1193 => 1) )
{
quest::say("I award you this! If this is not something you like, give it back to me and I will find something
else for you");

my $a = quest::ChooseRandom(1189, 1190, 1191, 1192, 1193);
quest::summonitem($a);
}




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

}




alternativly this can be set up that he trades reward items one for one (give 1 get 2, give 2 get 3. give 3 get 4 and so on)

Kilralpine
07-14-2009, 02:02 PM
Yea In the Past Ive Used The Trade Item In Deal - But I Wanted a Much More Cleaner Setup... Heres What I Came Up With (And Thx Trevius I Used Parts and Pieces of your Kill Credit Script)

###Zone - Guildhall###
###NPC - A lost coldain###
###Quest - Claiming Revenge###

sub EVENT_SAY {

my $hand = quest::saylink("hand");
my $claw = quest::saylink("claw");
my $Ready = quest::saylink("ready");
my $Hammer_of_the_Fallen = quest::saylink("Hammer of the Fallen");
my $Dwarvenbound_Mask = quest::saylink("Dwarvenbound Mask");
my $Choose_Hammer_of_the_Fallen = quest::saylink("Choose Hammer of the Fallen");
my $Choose_Dwarvenbound_Mask = quest::saylink("Choose Dwarvenbound Mask");
my $Time_Lost_Coldain_Wand = quest::saylink("Time-Lost Coldain Wand");
my $Choose_Time_Lost_Coldain_Wand = quest::saylink("Choose Time-Lost Coldain Wand");

if($text=~/hail/i) {
$client->Message(2, "Hello stranger, would you like to lend an old man a [$hand]?");
}

if($text=~/^hand$/i) {
$client->Message(2, "A dragon by the name Hsagra has slain an ole' friend of mine, retrieve her [$claw] by any means possible and I will reward you");
}

if ($text =~/^claw$/i) {
quest::itemlink(2431);
}

if($text=~/^Hammer of the Fallen$/i) {
quest::itemlink(2685);
}

if($text=~/^Dwarvenbound Mask$/i) {
quest::itemlink(2686);
}

if($text=~/^Time-Lost Coldain Wand$/i) {
quest::itemlink(2687);
}

if($text =~ /^ready$/i && defined($qglobals{htalisman_have})) {
$client->Message(13, "Choose Your Quest Reward - BE CAREFULL");
$client->Message(2, "--------------------------------------");
$client->Message(15, "[$Choose_Hammer_of_the_Fallen]");
$client->Message(15, "[$Choose_Dwarvenbound_Mask]");
$client->Message(15, "[$Choose_Time_Lost_Coldain_Wand]");
}

if($text =~ /^Choose Hammer of the Fallen$/i && defined($qglobals{htalisman_have})) {
$client->Message(15, "You Have Recieved [$Hammer_of_the_Fallen]!");
quest::summonitem(2685);
quest::delglobal("htalisman_have"); undef($qglobals{htalisman_have});
}

if($text =~ /^Choose Dwarvenbound Mask$/i && defined($qglobals{htalisman_have})) {
$client->Message(15, "You Have Recieved [$Dwarvenbound_Mask]!");
quest::summonitem(2686);
quest::delglobal("htalisman_have"); undef($qglobals{htalisman_have});
}

if($text =~ /^Choose Time-Lost Coldain Wand$/i && defined($qglobals{htalisman_have})) {
$client->Message(15, "You Have Recieved [$Time_Lost_Coldain_Wand]!");
quest::summonitem(2687);
quest::delglobal("htalisman_have"); undef($qglobals{htalisman_have});
}

}

sub EVENT_ITEM {

my $Ready = quest::saylink("Ready");
my $Hammer_of_the_Fallen = quest::saylink("Hammer of the Fallen");
my $Dwarvenbound_Mask = quest::saylink("Dwarvenbound Mask");
my $Time_Lost_Coldain_Wand = quest::saylink("Time-Lost Coldain Wand");

if (($itemcount{2431} == 1)) {
$client->Message(2, "You have found it! The same claw that took my friend in one fell swoop! Here are some items to choose from to compensate for your efforts!");
$client->Message(13, "Let Me Know When You Are [$Ready] To Choose!!!");
quest::setglobal("htalisman_have", 0, 1, "F");
$client->Message(15, "Quest Reward Links");
$client->Message(4, "------------------------");
$client->Message(5, "[$Hammer_of_the_Fallen]");
$client->Message(5, "[$Dwarvenbound_Mask]");
$client->Message(5, "[$Time_Lost_Coldain_Wand]");
}

}


Btw on the new Icelance 2.0 Server im deving - I use a combination of client-> message and saylinks to keep my quests good looking, easy to manuver, and spam-free :)