PDA

View Full Version : Help with NPC script


sgaske24
09-07-2004, 05:21 AM
Greetings all,

I have searched the threads for quite a while and haven't found any help with what I'm trying to do. Basically my goal is to have an NPC set up so that if you are below level 65 he tells you to go fly a kite when you hail him, but if you are level 65 or higher he'll give you the quest. It seems simple enough but it doesn't work. If anyone could toss me a few pointers I would appreciate it, thanks. Here is the code for the part where he tells you go fly a kite if you're under 65:

sub EVENT_SAY

{
if($ulevel < 65) && ($text=~/hail/i){quest::say("You appear to be a hearty adventurer, $name, but I'm afraid you aren't of use to me just yet. Come back when you've reached your 65th level of training and we'll talk.");}
}

sgaske24
09-07-2004, 05:25 AM
Nevermind I figured it out. Too many parenthesis.

RangerDown
09-07-2004, 05:27 AM
You need a full set of parentheses enclosing the entire conditional.

Like so:


if(($ulevel < 65) && ($text=~/hail/i))

sgaske24
09-07-2004, 06:17 AM
Actually what I did was this:

{
if($text=~/hail/i && $ulevel<65){quest::say("turned away");}
if($text=~/hail/i && $ulevel>=65){quest::say("quest text");}
}

It worked out, I tested it under 65 and over 65. I tried it your way and it didn't work. Maybe I missed a parenthesis somewhere ;) Anyways thanks for the quick reply I appreciate any help I can get. :)

Thrax the Tormentor
Guts and Glory

killspree
09-07-2004, 12:14 PM
Try this:
if($text=~/hail/i){
if($ulevel >= 65){
quest::say("quest text");
}
else{
quest::say("turned away");
}
}

Should be much cleaner and there's really no reason to check if the text is hail multiple times since you can nest the other conditions within that if().

Or if you want to use quite a few responses with hail, you can use an array.