EQEmulator Forums

EQEmulator Forums (https://www.eqemulator.org/forums/index.php)
-   Quests::Q&A (https://www.eqemulator.org/forums/forumdisplay.php?f=599)
-   -   Class Specific Items (https://www.eqemulator.org/forums/showthread.php?t=43561)

Jorin 02-02-2022 03:42 PM

Class Specific Items
 
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));
}


NatedogEZ 02-02-2022 08:39 PM

$rewards{$class}

if you want to find simple mistakes like this just open a command prompt in the folder that has the perl script and just type...

perl -cw scriptname.pl


This will show any errors as well as give warns like... how you are using a variable that is undefined because of a typo

Jorin 02-07-2022 05:49 PM

Thanks Nate. Couldnt remember how to do that so I appreciate the tip as well! Cant believe I completely missed that lol


All times are GMT -4. The time now is 03:15 PM.

Powered by vBulletin®, Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.