EQEmulator Forums

EQEmulator Forums (https://www.eqemulator.org/forums/index.php)
-   Archive::Quests (https://www.eqemulator.org/forums/forumdisplay.php?f=624)
-   -   Nice quest npcs? (https://www.eqemulator.org/forums/showthread.php?t=15160)

sotonin 08-04-2004 04:50 PM

Nice quest npcs?
 
Has anybody discovered a way to make questgivers more like live. As in if you hand in an item that is not in any way a quest item, it says no thanks i dont need that and hands it back to you?

Because i've noticed that you have to hand in ALL items for a quest at once, else the questgivers just keep your stuff. So it would be very cool to somehow stop them from eating items.

killspree 08-04-2004 05:26 PM

try
Code:

sub EVENT_ITEM{
if($itemcount{itemid} == 0 && $item1 > 0) {quest::say("I'm sorry, I don't need that item, $name. Here, you can have it back."); quest::summonitem("$item1");}
}

You'll need to expand it if you require multiple items for a turnin so that it returns all items in the turnin, obviously, but I've tested it and that does indeed work.

killspree 08-04-2004 05:35 PM

expanded for convenience sake, enjoy:

Code:

sub EVENT_ITEM{
if($itemcount{itemid} == 0){
quest::say("I'm sorry, I don't need that item, $name. Here, you can have it back.");
if($item1 > 0){quest::summonitem("$item1");}
if($item2 > 0){quest::summonitem("$item2");}
if($item3 > 0){quest::summonitem("$item3");}
if($item4 > 0){quest::summonitem("$item4");}}
}

Just add as many $itemcount checks as you have items for the quest.

Charmy 08-04-2004 11:02 PM

In all my quests i add similar code like that to a seperate sub, that way if the mob is involved in quests, you can use the effect several times without having to retype it.

e.g
Code:

sub EVENT_ITEM
 {
  if($itemcount {xx} && $itemcount {xxxx} == 1)
    {
      quest::say("Thanks for the stuff i needed $name.");
      }
      else
      {
        NoNeed();
        }
      if($itemcount {xx} && $itemcount {xxxx} == 1)
      {
        quest::say('thanks for this name);
        }
        else
        {
          NoNeed();
          }
        }

sub NoNeed
 {
  if($item1 != "")
    {
      quest::summonitem($item1,0);
    }
  if($item2 != "")
    {
      quest::summonitem($item2,0);
    }
  if($item3 != "")
    {
      quest::summonitem($item3,0);
    }
  if($item4 != "")
    {
      quest::summonitem($item4,0);
    }
  if($platnium != 0 || $gold != 0 || $silver != 0 || $copper != 0)
    {
      quest::givecash($platnium, $gold,$silver,$copper);
    }

You Could also just make the second if an elsif, that way you only need one call of the NoNeed. but this was just a simple example.

killspree 08-04-2004 11:25 PM

Hmm, charges set to 0 still summons an item? Or did you just put 0 there as an example?

cofruben 08-05-2004 02:24 AM

sub EVENT_ITEM
{
if($item1==30){ quest::say("thanks"); }
else if($item1==23){ quest::say("thanks"); }
else if($item1==55){ quest::say("thanks"); }
else { quest::say("sorry i dont need this"); quest::summonitem($itemid); }
}
for example :wink:

sotonin 08-05-2004 02:33 AM

hmmm interesting.

here's the problem though. I want the npc to
A) return item to player if they only hand in a single item from a multi-item turn in.
B) return any non-quest related item handed to him

here's what i have going so far, lemme know if i screwed anything up. I was thinking if there was some way to make a temporary variable. i could set a variable to true or 1 or whatever if any of the successful item turn in's are used. (item1 2 and 3 for quest are turned in, so set variable to true.) then below all the checks, do a if variable != true say "i dont need this, blah blah" and return all items in all 4 slots to the player.

Code:

sub EVENT_ITEM {
        if($item1 > 0 || $item2 > 0 || $item3 > 0 || $item4 > 0){
                if($itemcount{19001} == 1 && $itemcount{19002} == 1 && $itemcount{16507} == 1){
                        quest::say("Wear this with pride!");
                        quest::summonitem("4921");
                }
                if($itemcount{19003} == 1 && $itemcount{19004} == 1 && $itemcount{19047} == 1){
                        quest::say("Wear this with pride!");
                        quest::summonitem("4922");
                }
                if($itemcount{19005} == 1 && $itemcount{19006} == 1 && $itemcount{19048} == 1){
                        quest::say("Wear this with pride!");
                        quest::summonitem("4923");
                }
                if($itemcount{19007} == 1 && $itemcount{19008} == 1 && $itemcount{19049} == 1){
                        quest::say("Wear this with pride!");
                        quest::summonitem("4924");
                }
        }
}

i don't know exact perl syntax for this but here's my best complete guess

Code:

sub EVENT_ITEM {
        if($item1 > 0 || $item2 > 0 || $item3 > 0 || $item4 > 0){
                if($itemcount{19001} == 1 && $itemcount{19002} == 1 && $itemcount{16507} == 1){
                        quest::say("Wear this with pride!");
                        quest::summonitem("4921");
                        $var1=true;
                }
                if($itemcount{19003} == 1 && $itemcount{19004} == 1 && $itemcount{19047} == 1){
                        quest::say("Wear this with pride!");
                        quest::summonitem("4922");
                        $var1=true;
                }
                if($itemcount{19005} == 1 && $itemcount{19006} == 1 && $itemcount{19048} == 1){
                        quest::say("Wear this with pride!");
                        quest::summonitem("4923");
                        $var1=true;
                }
                if($itemcount{19007} == 1 && $itemcount{19008} == 1 && $itemcount{19049} == 1){
                        quest::say("Wear this with pride!");
                        quest::summonitem("4924");
                        $var1=true;
                }
                if ($var1!='true'){
                        if($item1 > 0){
                                quest::say("I don't need this.");
                                quest::summonitem("$item1");
                        }
                        if($item2 > 0){
                                quest::say("I don't need this.");
                                quest::summonitem("$item2");
                        }
                        if($item3 > 0){
                                quest::say("I don't need this.");
                                quest::summonitem("$item3");
                        }
                        if($item4 > 0){
                                quest::say("I don't need this.");
                                quest::summonitem("$item4");
                        }
                }
        }
}


sotonin 08-05-2004 02:48 AM

ya, i think i'm stupid.

i shortened it i think. )

Any glaring problems with this?

Code:

sub EVENT_ITEM {
        if($itemcount{19001} == 1 && $itemcount{19002} == 1 && $itemcount{16507} == 1){
                quest::say("Wear this with pride!");
                quest::summonitem("4921");
        } else
        if($itemcount{19003} == 1 && $itemcount{19004} == 1 && $itemcount{19047} == 1){
                quest::say("Wear this with pride!");
                quest::summonitem("4922");
        } else
        if($itemcount{19005} == 1 && $itemcount{19006} == 1 && $itemcount{19048} == 1){
                quest::say("Wear this with pride!");
                quest::summonitem("4923");
        } else
        if($itemcount{19007} == 1 && $itemcount{19008} == 1 && $itemcount{19049} == 1){
                quest::say("Wear this with pride!");
                quest::summonitem("4924");
        } else {
                quest::say("I don't need this...");
                if($item1 > 0){quest::summonitem("$item1");}
                if($item2 > 0){quest::summonitem("$item2");}
                if($item3 > 0){quest::summonitem("$item3");}
                if($item4 > 0){quest::summonitem("$item4");}
        }
}


sotonin 08-05-2004 12:43 PM

Welp. i found a biggy wrong with it. Seems cofruben's little example wasnt proper perl syntax. i changed it and it started working )

Code:

sub EVENT_ITEM {
        if($itemcount{19001} == 1 && $itemcount{19002} == 1 && $itemcount{16507} == 1){
                quest::say("Wear this with pride!");
                quest::summonitem("4921");
        } elsif($itemcount{19003} == 1 && $itemcount{19004} == 1 && $itemcount{19047} == 1){
                quest::say("Wear this with pride!");
                quest::summonitem("4922");
        } elsif($itemcount{19005} == 1 && $itemcount{19006} == 1 && $itemcount{19048} == 1){
                quest::say("Wear this with pride!");
                quest::summonitem("4923");
        } elsif($itemcount{19007} == 1 && $itemcount{19008} == 1 && $itemcount{19049} == 1){
                quest::say("Wear this with pride!");
                quest::summonitem("4924");
        } else {
                quest::say("I don't need this.");
                if($item1 > 0){quest::summonitem("$item1");}
                if($item2 > 0){quest::summonitem("$item2");}
                if($item3 > 0){quest::summonitem("$item3");}
                if($item4 > 0){quest::summonitem("$item4");}
        }
}

The } elseif portion is what was screwing up before when it was }else if {

Charmy 08-05-2004 12:45 PM

elseif isn't part of perl, its elsif, you will get complie errors if you use elseif.

sotonin 08-05-2004 12:46 PM

oops sorry didnt read close enough.

yep typo on last part for me. code has it right though elsif

animepimp 08-05-2004 04:18 PM

Code:

if($item1 > 0){quest::summonitem("$item1");}
if($item2 > 0){quest::summonitem("$item2");}
if($item3 > 0){quest::summonitem("$item3");}
if($item4 > 0){quest::summonitem("$item4");}

This part is wrong. You need to remove the quotes in the method calls, like quest::summonitem($item4); Or it will try to find "$item4" in a Db instead of the number stored in item4.

sotonin 08-05-2004 05:25 PM

well it seems to work fine.... i use ""'s on all of my summonitems and they put the item on your cursor.

isn't that how summonitem is supposed to work? I tested all the quests and they all use quotes.

Cisyouc 08-06-2004 03:23 AM

Quote:

Originally Posted by sotonin
well it seems to work fine.... i use ""'s on all of my summonitems and they put the item on your cursor.

isn't that how summonitem is supposed to work? I tested all the quests and they all use quotes.

I always do quest::summonitem(0000); and it puts it on the cursor fine. If it doesnt there's a problem with the code above it.

sotonin 08-06-2004 03:40 AM

aye. i use quest::summonitem("00000");

it puts the item on my cursor as well. So i guess animepimp is wrong about this syntax being wrong. =)


All times are GMT -4. The time now is 02:16 PM.

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