Packet
04-25-2011, 10:46 PM
So I know there is a much easier way to do this however I haven't discovered a method of using an array for $hasitem to check for a list of items in a players inventory. Anyways, with that being said I have an issue which I just don't seem to see where the problem is...
sub EVENT_SPAWN {
$x = $npc->GetX();
$y = $npc->GetY();
$range = 70;
quest::set_proximity($x - $range, $x + $range, $y - $range, $y + $range);
}
sub EVENT_ENTER
{
if($ulevel == 1) {
$n = $client->GetName();
quest::movepc(152, -200, 36, -55, -125);
$client->Message(15, "You have not become attuned yet. Speak with Gharj at the top of the platform.");
}
elsif($hasitem{1079} && $ulevel <= 10) {
$npc->SendAppearanceEffect(180);
quest::doanim(66);
quest::say("Hey, you! $name! Come over here... You cannot use the portal without a [shard]! Come over here!");
}
}
sub EVENT_SAY
{
my $fitem = 9991;
my $qsitem = 9992;
my $hitem = 9993;
my $eitem = 9994;
my $gitem = 1079;
my $feitem = 9996;
my $nitem = 9997;
my $kitem = 9998;
my $gritem = 9999;
my $oitem = 10000;
my $ritem = 10001;
my $aitem = 10002;
my $fvar = quest::saylink(Freeport);
my $qvar = quest::saylink(Qeynos);
my $hvar = quest::saylink(Halas);
my $evar = quest::saylink(Erudin);
my $gvar = quest::saylink(GreaterFaydark);
my $fevar = quest::saylink(Felwithe);
my $nvar = quest::saylink(Neriak);
my $kvar = quest::saylink(Kaladim);
my $grvar = quest::saylink(Grobb);
my $ovar = quest::saylink(Oggok);
my $rvar = quest::saylink(Rivervale);
my $akvar = quest::saylink(Akanon);
if($text=~/hail/i && $hasitem{$fitem} || $hasitem{$qsitem} || $hasitem{$hitem} || $hasitem{$eitem} || $hasitem{$gitem} || $hasitem{$feitem} || $hasitem{$nitem} || $hasitem{$kitem} || $hasitem{$gritem} || $hasitem{$oitem} || $hasitem{$ritem} || $hasitem{$aitem})
{
quest::say("You already have a shard. Hand it back to me if you would like to change your destination.");
}
else
{
if($text=~/hail/i && $ulevel == 2)
{
quest::say("Greetings, $name! I am Thiddian and I have the [shards] necessary for you to travel back home. There are rifts throughout Norrath that only those whom have been attuned can see. Simply walk into one and you can return here.");
}
if($text=~/shard/i) {
quest::doanim(55);
quest::say("Ehhh.. ehm... The shards are what allow us to travel through these soul portals. The thing is, you can only have one. No one has ever stepped into the rift with two shards and I dont think we should try. Anyways, thats enough babbling from me... Please choose your land.");
$client->Message(15, "Select only ONE of the following:");
$client->Message(15, "[$fvar]-[$qvar]-[$hvar]-[$evar]-[$gvar]-[$fevar]-[$nvar]-[$kvar]-[$grvar]-[$ovar]-[$rvar]-[$akvar]");
}
if($text=~/Freeport/i) {
##quest::say($hresp);
quest::doanim(67);
$npc->SendAppearanceEffect(180);
quest::summonitem($fitem);
{
if($text=~/Qeynos/i) {
##quest::say($hresp);
quest::doanim(67);
$npc->SendAppearanceEffect(180);
quest::summonitem($qsitem);
}
if($text=~/Halas/i) {
##quest::say($hresp);
quest::doanim(67);
$npc->SendAppearanceEffect(180);
quest::summonitem($hitem);
}
if($text=~/Erudin/i) {
##quest::say($hresp);
quest::doanim(67);
$npc->SendAppearanceEffect(180);
quest::summonitem($eitem);
}
if($text=~/Greater/i) {
##quest::say($hresp);
quest::doanim(67);
$npc->SendAppearanceEffect(180);
quest::summonitem($gitem);
}
if($text=~/Felwithe/i) {
##quest::say($hresp);
quest::doanim(67);
$npc->SendAppearanceEffect(180);
quest::summonitem($feitem);
}
if($text=~/Neriak/i) {
##quest::say($hresp);
quest::doanim(67);
$npc->SendAppearanceEffect(180);
quest::summonitem($nitem);
}
if($text=~/Kaladim/i) {
##quest::say($hresp);
quest::doanim(67);
$npc->SendAppearanceEffect(180);
quest::summonitem($kitem);
}
if($text=~/Grobb/i) {
##quest::say($hresp);
quest::doanim(67);
$npc->SendAppearanceEffect(180);
quest::summonitem($gritem);
}
if($text=~/Oggok/i) {
##quest::say($hresp);
quest::doanim(67);
$npc->SendAppearanceEffect(180);
quest::summonitem($oitem);
}
if($text=~/Rivervale/i) {
##quest::say($hresp);
quest::doanim(67);
$npc->SendAppearanceEffect(180);
quest::summonitem($ritem);
}
if($text=~/anon/i) {
##quest::say($hresp);
quest::doanim(67);
$npc->SendAppearanceEffect(180);
quest::summonitem($aitem);
}
}
}
This quest is "still a work in progress" however it worked until I added the following sniplet:
if($text=~/hail/i && $hasitem{$fitem} || $hasitem{$qsitem} || $hasitem{$hitem} || $hasitem{$eitem} || $hasitem{$gitem} || $hasitem{$feitem} || $hasitem{$nitem} || $hasitem{$kitem} || $hasitem{$gritem} || $hasitem{$oitem} || $hasitem{$ritem} || $hasitem{$aitem})
{
quest::say("You already have a shard. Hand it back to me if you would like to change your destination.");
}
else
{
I am going to assume that the problem probably does lye in my ridiculous $hasitem if statement... I am not necessarily looking for the answer but a nudge in the right direction. What I want to happen here is when a player hails the npc, I want it to check for an array of items. If it detects any of the items, it will spit out "quest::say("You already have a shard. Hand it back to me if you would like to change your destination.");" otherwise it will continue on with the rest of the script. I get absolutely 0 errors and the npc simply doesn't respond. The proximity works fine on enter so the problem isn't before my SAY event.
sub EVENT_SPAWN {
$x = $npc->GetX();
$y = $npc->GetY();
$range = 70;
quest::set_proximity($x - $range, $x + $range, $y - $range, $y + $range);
}
sub EVENT_ENTER
{
if($ulevel == 1) {
$n = $client->GetName();
quest::movepc(152, -200, 36, -55, -125);
$client->Message(15, "You have not become attuned yet. Speak with Gharj at the top of the platform.");
}
elsif($hasitem{1079} && $ulevel <= 10) {
$npc->SendAppearanceEffect(180);
quest::doanim(66);
quest::say("Hey, you! $name! Come over here... You cannot use the portal without a [shard]! Come over here!");
}
}
sub EVENT_SAY
{
my $fitem = 9991;
my $qsitem = 9992;
my $hitem = 9993;
my $eitem = 9994;
my $gitem = 1079;
my $feitem = 9996;
my $nitem = 9997;
my $kitem = 9998;
my $gritem = 9999;
my $oitem = 10000;
my $ritem = 10001;
my $aitem = 10002;
my $fvar = quest::saylink(Freeport);
my $qvar = quest::saylink(Qeynos);
my $hvar = quest::saylink(Halas);
my $evar = quest::saylink(Erudin);
my $gvar = quest::saylink(GreaterFaydark);
my $fevar = quest::saylink(Felwithe);
my $nvar = quest::saylink(Neriak);
my $kvar = quest::saylink(Kaladim);
my $grvar = quest::saylink(Grobb);
my $ovar = quest::saylink(Oggok);
my $rvar = quest::saylink(Rivervale);
my $akvar = quest::saylink(Akanon);
if($text=~/hail/i && $hasitem{$fitem} || $hasitem{$qsitem} || $hasitem{$hitem} || $hasitem{$eitem} || $hasitem{$gitem} || $hasitem{$feitem} || $hasitem{$nitem} || $hasitem{$kitem} || $hasitem{$gritem} || $hasitem{$oitem} || $hasitem{$ritem} || $hasitem{$aitem})
{
quest::say("You already have a shard. Hand it back to me if you would like to change your destination.");
}
else
{
if($text=~/hail/i && $ulevel == 2)
{
quest::say("Greetings, $name! I am Thiddian and I have the [shards] necessary for you to travel back home. There are rifts throughout Norrath that only those whom have been attuned can see. Simply walk into one and you can return here.");
}
if($text=~/shard/i) {
quest::doanim(55);
quest::say("Ehhh.. ehm... The shards are what allow us to travel through these soul portals. The thing is, you can only have one. No one has ever stepped into the rift with two shards and I dont think we should try. Anyways, thats enough babbling from me... Please choose your land.");
$client->Message(15, "Select only ONE of the following:");
$client->Message(15, "[$fvar]-[$qvar]-[$hvar]-[$evar]-[$gvar]-[$fevar]-[$nvar]-[$kvar]-[$grvar]-[$ovar]-[$rvar]-[$akvar]");
}
if($text=~/Freeport/i) {
##quest::say($hresp);
quest::doanim(67);
$npc->SendAppearanceEffect(180);
quest::summonitem($fitem);
{
if($text=~/Qeynos/i) {
##quest::say($hresp);
quest::doanim(67);
$npc->SendAppearanceEffect(180);
quest::summonitem($qsitem);
}
if($text=~/Halas/i) {
##quest::say($hresp);
quest::doanim(67);
$npc->SendAppearanceEffect(180);
quest::summonitem($hitem);
}
if($text=~/Erudin/i) {
##quest::say($hresp);
quest::doanim(67);
$npc->SendAppearanceEffect(180);
quest::summonitem($eitem);
}
if($text=~/Greater/i) {
##quest::say($hresp);
quest::doanim(67);
$npc->SendAppearanceEffect(180);
quest::summonitem($gitem);
}
if($text=~/Felwithe/i) {
##quest::say($hresp);
quest::doanim(67);
$npc->SendAppearanceEffect(180);
quest::summonitem($feitem);
}
if($text=~/Neriak/i) {
##quest::say($hresp);
quest::doanim(67);
$npc->SendAppearanceEffect(180);
quest::summonitem($nitem);
}
if($text=~/Kaladim/i) {
##quest::say($hresp);
quest::doanim(67);
$npc->SendAppearanceEffect(180);
quest::summonitem($kitem);
}
if($text=~/Grobb/i) {
##quest::say($hresp);
quest::doanim(67);
$npc->SendAppearanceEffect(180);
quest::summonitem($gritem);
}
if($text=~/Oggok/i) {
##quest::say($hresp);
quest::doanim(67);
$npc->SendAppearanceEffect(180);
quest::summonitem($oitem);
}
if($text=~/Rivervale/i) {
##quest::say($hresp);
quest::doanim(67);
$npc->SendAppearanceEffect(180);
quest::summonitem($ritem);
}
if($text=~/anon/i) {
##quest::say($hresp);
quest::doanim(67);
$npc->SendAppearanceEffect(180);
quest::summonitem($aitem);
}
}
}
This quest is "still a work in progress" however it worked until I added the following sniplet:
if($text=~/hail/i && $hasitem{$fitem} || $hasitem{$qsitem} || $hasitem{$hitem} || $hasitem{$eitem} || $hasitem{$gitem} || $hasitem{$feitem} || $hasitem{$nitem} || $hasitem{$kitem} || $hasitem{$gritem} || $hasitem{$oitem} || $hasitem{$ritem} || $hasitem{$aitem})
{
quest::say("You already have a shard. Hand it back to me if you would like to change your destination.");
}
else
{
I am going to assume that the problem probably does lye in my ridiculous $hasitem if statement... I am not necessarily looking for the answer but a nudge in the right direction. What I want to happen here is when a player hails the npc, I want it to check for an array of items. If it detects any of the items, it will spit out "quest::say("You already have a shard. Hand it back to me if you would like to change your destination.");" otherwise it will continue on with the rest of the script. I get absolutely 0 errors and the npc simply doesn't respond. The proximity works fine on enter so the problem isn't before my SAY event.