So am trying to write a basic little quest that gives an item based on the players class. Havent been able to find much info regarding it but this is what Im currently using. It doesnt summon anything it just says item 0 doesnt exist for some reason.
Code:
sub EVENT_SAY {
my %rewards = (
"Warrior" => 135015,
"Cleric" => 135015,
"Paladin" => 135015,
"Ranger" => 135008,
"Shadowknight" => 135015,
"Druid" => 135022,
"Monk" => 135029,
"Bard" => 135015,
"Rogue" => 135008,
"Shaman" => 135008,
"Necromancer" => 135001,
"Wizard" => 135001,
"Magician" => 135001,
"Enchanter" => 135001,
"Beastlord" => 147496..147502,
"Berserker" => 135008
);
my $help = quest::saylink("help", 1);
if ($text=~/hail/i) {
if (defined $qglobals{"New"} && $qglobals{"New"} == 4) {
plugin::Whisper("Hello again $name. Come to browse my wares?");
} else {
plugin::Whisper("Hello $name! I see you are new here, allow me to $help you out!");
}
} elsif ($text=~/help/i) {
if (defined $qglobals{"New"} && $qglobals{"New"} >= 4 && $qglobals{"New"} >= 4) {
plugin::Whisper("I already helped you $name!");
} else {
plugin::Whisper("Please take these items as a show of good faith!");
quest::summonitem($Reward{$class});
quest::summonitem(147495);
quest::setglobal("New", 4, 5, "F");
}
}
}
sub EVENT_SPAWN {
plugin::SetMobColor(quest::ChooseRandom(0..255), quest::ChooseRandom(0..255), quest::ChooseRandom(0..255));
}