PDA

View Full Version : having mobs give back multiple items?


jimbox114
08-10-2004, 05:59 AM
I have looked over this code several times, and I can't figure out what the problem is. What kills me is this mob worked fine before I added a 2nd quest to him. The 2nd quest involves the text [problem], [fine], [interested]. Thing is the first quest you do with him you get two items from. So when I added the 2nd quest I put the quest::summon commands both in the same line as you can see below. I know that works fine with 1 item being summoned, I imagine it should work with two shouldn't it?


sub EVENT_SAY
{
if ($text=~ /Hail/i){quest::say("Yes, what do you want from me $name? I am much to upset to speak to a stranger, unless of course you wish to hear my long painful [story]?");}
if ($text=~ /story/i){quest::say("Well sit down my friend and pull up a chair. It all started back when I was a young lad, much like yourself. I met a wonderful lady named Gargella. We was the best of friends forever, however as we got older we drifted far apart. You see she wanted to make something of her life and she choose the path of a Enchanter. I just wasn't willing to try and study the art of magic, so instead I became a warrior. Now she is the Dean of the Great Freeport University, while I am a out of work Warrior. Just seems Warriors these days are a silver piece a dozen now, so many of us are out of work and barely able to feed ourselves. But there is [more] to this story.");}
if ($text=~ /more/i){quest::say("Aye, you see I have not spoken to Gargella in several years, heck I don't know if she would even remember me. However I wrote her a note, wanting to see if maybe she would like to see me sometime. However the same night I wrote it I passed out around the docks and can't seem to find it. Maybe if you could look around the docks you could find it for me? I may have even dropped it into the water. Remember return it to ME and nobody else, got it? I also have to attend to a small [problem] that I have with the Freeport Militia later on.");}
if ($text=~ /problem/i){quest::say("Yesterday I was burning my garbage outside of the city gates. I can no longer afford to pay the outrageous Freeport taxes for garbage service, so I was left with no other choice. At first I was just going to dump it into the ocean, but those pesky guards keep a close eye on it. Anyways I was caught by a Freeport guard and was given a [fine] for burning within city limits.");}
if ($text=~ /fine/i){quest::say("Yes I was fined five hundred pieces of platinum, and there is no way I can afford this. I need to speak to my old bud Cenamar who lives in Freeport North at the Office of the People. Of course perhaps you would be [interested] in taking care of this for me?");}
if ($text=~ /interested/i){quest::say("Excellent, I can't thank you enough $name. Here is the papers the guard gave me. Just show these to Cenamar and hopefully he will get this straightened up for me."); quest::summonitem (69020);}
}
sub EVENT_ITEM
{
if (#itemcount{69022} == 1){quest::say("Thanks lad, now thats one less thing for me to worry about. Here take my old bow as a reward, I never was much of a archer anyways."); quest::summonitem(69021);}
if ($itemcount{69297} == 1){quest::say("Great, so you found it $name? Oh really, it was in the belly of a giant snake? Its no wonder I didn't ever find it, no way I would have messed with that giant snake. Anyways I guess Im off to West Freeport to give this to Gargella.....Oh who am I kidding. Im so drunk right now I couldn't possibly meet up with her. Hey I know, I will let you do this one final favor for me. Here take this note to Gargella in West Freeport. Oh, also I would like to give you my cloak as a gift for all your troubles. Gargella actually made this for me several years ago. It was once a mighty cloak, I am truely ashame of myself for letting it go like this. Who knows, Maybe she can repair this cloak for you? Well off you go then, happy hour is almost over you know!"); quest::summonitem(69297); quest::summonitem(69299);}
}

Another problem I got is trying to get the next mob to talk. I think my problem with him involves the use of the $platinum amount. I tried search and see where somebody suggested to another person to add the $myplatinum = $platinum; in there, so I have tried it with and without it. Either way this npc does nothing. I have also tried the if $platinum >= 100 in there as well, and still nothing. I imagine it will turn out to be some stupid syntax error, but I have looked over ths code till my eyes bleed and don't see it.

sub EVENT_SAY
{
if ($text=~ /Hail/i){quest::say("Hello, I am Cenamar Circlelight. I am sort of busy at the moment, please come back later unless you have something for me.");}
if ($text=~ /story/i){quest::say("Back in the day Penfrost, Gargella, and Penfrost was three of a kind. However as we got older I decided I wanted to be somebody, so I went to felwithe to study to be a cleric. Me and Gargella both urged Penfrost to go train to be a shaman, but he was just too lazy. Now I am a rich High Elf who can get work anytime, and Penfrost is just one of the many out of work Warriors out there.");}
}
sub EVENT_ITEM
{
$myplatinum = $platinum;
if ($itemcount{69020} == 1){quest::say("I see my old friend Penfrost is at it again. Yes me and Penfrost was good friends, but that is a long [story]. For 100pp I can take care of this for Penfrost. I assume you will have to pay me the 100pp, as I would be surprised if Penfrost has two copper pieces to rub together.");}
if ($platinum == 100 {quest::say("Very well, you have my word this will be taken care of. Please give this signed paperwork back to Penfrost as proof. Also, for the love of Tunare tell him to stop burning his trash. Its no wonder the east side of Freeport stinks so bad anymore."); quest::summonitem(69022);}
}

sotonin
08-10-2004, 06:08 AM
As far as the item issue, are you sure it's not working? It puts it on the cursor. so you'd have to drop the item in a bag and then itll put the second item on cursor.

if ($platinum == 100 {quest::say("Very well, you have my word this will be taken care of. Please give this signed paperwork back to Penfrost as proof. Also, for the love of Tunare tell him to stop burning his trash. Its no wonder the east side of Freeport stinks so bad anymore."); quest::summonitem(69022);}


You missed a closing parenthesis. change it to

if ($platinum == 100) {
quest::say("Very well, you have my word this will be taken care of. Please give this signed paperwork back to Penfrost as proof. Also, for the love of Tunare tell him to stop burning his trash. Its no wonder the east side of Freeport stinks so bad anymore.");
quest::summonitem(69022);
}

Also in this code, you used # instead of $

if (#itemcount{69022} == 1){quest::say("Thanks lad, now thats one less thing for me to worry about. Here take my old bow as a reward, I never was much of a archer anyways."); quest::summonitem(69021);}


change to

if ($itemcount{69022} == 1){
quest::say("Thanks lad, now thats one less thing for me to worry about. Here take my old bow as a reward, I never was much of a archer anyways.");
quest::summonitem(69021);
}

killspree
08-10-2004, 06:11 AM
Yeah, what sotonin said is right, it should be working. It creates a queue of sorts on the cursor(not sure if there's a limit, but I'd assume so)...you have to place each item into your inventory before the next item becomes available on the cursor.

The $myplatinum var shouldn't be needed at all, $platinum is already a var in the perl format.

jimbox114
08-10-2004, 06:20 AM
Before I added the 2nd quest to penfrost (involveing only 1 item as a reward) It did work. Before I changed the quest it was like this:


sub EVENT_SAY
{
if ($text=~ /Hail/i){quest::say("Yes, what do you want from me $name? I am much to upset to speak to a stranger, unless of course you wish to hear my long painful [story]?");}
if ($text=~ /story/i){quest::say("Well sit down my friend and pull up a chair. It all started back when I was a young lad, much like yourself. I met a wonderful lady named Gargella. We was the best of friends forever, however as we got older we drifted far apart. You see she wanted to make something of her life and she choose the path of a Enchanter. I just wasn't willing to try and study the art of magic, so instead I became a warrior. Now she is the Dean of the Great Freeport University, while I am a out of work Warrior. Just seems Warriors these days are a silver piece a dozen now, so many of us are out of work and barely able to feed ourselves. But there is [more] to this story.");}
if ($text=~ /more/i){quest::say("Aye, you see I have not spoken to Gargella in several years, heck I don't know if she would even remember me. However I wrote her a note, wanting to see if maybe she would like to see me sometime. However the same night I wrote it I passed out around the docks and can't seem to find it. Maybe if you could look around the docks you could find it for me and maybe return it to me. Remember if you find it return it to ME and nobody else, got it?");}
}
sub EVENT_ITEM
{
if ($itemcount{69297} == 1){quest::say("Great, so you found it $name? Oh really, it was in the belly of a Giant snake? Its no wonder I didn't ever find it, no way I would have messed with that giant snake. Anyways I guess Im off to West Freeport to give this to Gargella.....Oh who am I kidding. Im so drunk right now I couldn't possibly meet up with her. Hey I know, I will let you do this one final favor for me. Here take this note to Gargella in West Freeport. Oh, also I would like to give you my cloak as a gift for all your troubles. Gargella actually made this for me several years ago. It was once a Mighty Cloak, I am truely ashame of myself for letting it go like this. Who knows, Maybe she can repair this cloak for you? Well off you go then, Happy hour is almost over you know!");
quest::exp(4025);
quest::summonitem(69297);
quest::summonitem(69299);}
}


The above code works fine, but of course it don't have the 2nd quest yet, this is what penfrost's quest was at first. But where I have a new item turn in I put the summonitem commands in the same line as the turn in. I was afraid if I left them hanging at the bottom you would end up getting those two items every time you do any quest with him.

Do you think maybe I just got too much crap for a single npc to handle? I could always change it to where you have to go speak to Penfrosts son or something and he can do the fine quest?

sotonin
08-10-2004, 06:27 AM
naw it's not too much.

try this.

sub EVENT_ITEM {
if ($itemcount{69022} == 1){
quest::say("Thanks lad, now thats one less thing for me to worry about. Here take my old bow as a reward, I never was much of a archer anyways.");
quest::summonitem(69021);
}
if ($itemcount{69297} == 1){
quest::say("Great, so you found it $name? Oh really, it was in the belly of a giant snake? Its no wonder I didn't ever find it, no way I would have messed with that giant snake. Anyways I guess Im off to West Freeport to give this to Gargella.....Oh who am I kidding. Im so drunk right now I couldn't possibly meet up with her. Hey I know, I will let you do this one final favor for me. Here take this note to Gargella in West Freeport. Oh, also I would like to give you my cloak as a gift for all your troubles. Gargella actually made this for me several years ago. It was once a mighty cloak, I am truely ashame of myself for letting it go like this. Who knows, Maybe she can repair this cloak for you? Well off you go then, happy hour is almost over you know!");
quest::exp(4025);
quest::summonitem(69297);
quest::summonitem(69299);
}
}

jimbox114
08-10-2004, 07:20 AM
That takes care of both of those. I will use that format from now on when I have a npc that has 2 different turn in quests.

sotonin
08-10-2004, 07:27 AM
cool, glad to hear it. )

it's just easier to read and keep track of what is where when you space it out and use tabs to indent. Personal pet peeve of mine is run-on code.

animepimp
08-10-2004, 05:20 PM
The only thing that matters for what lines are grouped together in one if are the {}s. Anything between them gets grouped together and all spaces and blank lines can be as many or few as you feel like putting in. The standard coding type is each block is tabbed over once more than the block its inside of like sontonin did. This way you can easily see what is in each if and each event also. But its only for readablities sake, the computer takes all the extra spaces and line returns out before it does anything with it.

sotonin
08-10-2004, 05:51 PM
most of the time.

Perl is picky about spaces sometimes though. Probably why his previous code was screwing up. Only explanation i can come up with )