PDA

View Full Version : Paying for pets


merb
01-10-2009, 08:06 PM
I read a post a while ago that was very useful in quest production. Basically, the quest allows a player to obtain a pet by hailing another NPC, but it isn't like a bot, more like a summoned or charmed pet. This is the original code:

sub EVENT_SAY {

if ($text=~/hail/i) {
quest::say ("I will be your pet");
$client->MakePet(null, TestPet, "Light Elemental");
}
}

The original code works fine (of course after I change it to match my pets database). However, this is what I am trying to achieve:

sub EVENT_SAY {

if ($text=~/hail/i) {
quest::say("Halt! It would not be wise to venture further alone. If you would like to hire one of my men to assist you, that could be arranged, for a [price].");
}
if ($text=~/price/i) {
quest::say("A hefty sum of platinum will earn you my finest soldier; one thousand should do just fine."):
}
if ($platinum==1000) {
$client->MakePet(null, elfsoldier, "an elven soldier");
}
}

I have found that adding anything in between the hail and makepet command (such as the platinum command) doesn't work, even if its just responding to more text. I have of course edited the pet database to include the elven soldier's ID and name. Any help would be greatly appreciated!

joligario
01-11-2009, 12:27 AM
Instead of the platinum part being in the EVENT_SAY block, you need it in an EVENT_ITEM one.

trevius
01-11-2009, 05:37 AM
An example of how it should be is this:

sub EVENT_ITEM {
if ($platinum==1000) {
$client->MakePet(null, elfsoldier, "an elven soldier");
}
}

Separate from your EVENT_SAY

merb
01-11-2009, 01:51 PM
Thanks guys, I never even gave that a thought :P

Switched it to look like this:

sub EVENT_SAY {

if ($text=~/hail/i) {
quest::say("Halt! It would not be wise to venture further alone. If you would like to hire one of my men to assist you, that could be arranged, for a [price].");
}
if ($text=~/price/i) {
quest::say("A hefty sum of platinum will earn you my finest soldier; one thousand should do just fine.");
}
}

sub EVENT_ITEM {

if ($platinum==1000) {
$client->MakePet(null, elfsoldier, "an elven soldier");
}
}

Works like a charm!

Kobaz
01-11-2009, 03:44 PM
You also have a colon ':' instead of a semicolon ';' at the end of the 2nd quest::say line. This could easily confuse the parser if you extend that section.