PDA

View Full Version : Quest help


knight-mare
08-22-2014, 04:34 PM
ok so here i have a quest it works without any issues however i want to make it so it will cast on players below level 10 if anyone above level 10 hails it wont work for them.... can someone please help.... thanks in advance


sub EVENT_SAY {
if ($text =~/Hail/i)
{ quest::say("Greetings $name. If you want me to cast a spell on you, please say so and I will give you my [pricelist]. If you want me to [heal] you, please say so and I will do it for free."); }
if($text=~/pricelist/i)
{quest::say("I can cast the following spells : Spirit of Wolf = 1 pp // Dead Man Floating = 3 pp // Clarity = 4 pp // Clarity II = 5 pp // Spiritual Light = 8 pp // Spiritual Radiance = 15 pp // Temperance = 1 peridot // Virtue = 4 peridots // KEI = 50 pp");}
if ($text=~/heal/i) { quest::selfcast(13); }
}
sub EVENT_ITEM
{
if($platinum == 1)
{
quest::selfcast(278);
}
if($platinum == 3)
{
quest::selfcast(457);
}
if($platinum == 4)
{
quest::selfcast(174);
}
if($platinum == 5)
{
quest::selfcast(1693);
}
if($platinum == 8)
{
quest::selfcast(2176);
}
if($platinum == 15)
{
quest::selfcast(2177);
}
if($item1== 10028)
{
quest::selfcast(3692);
}
if($itemcount{10028} == 4)
{
quest::selfcast(3467);
}
if($platinum == 50)
{
quest::selfcast(2570);
}
}

lerxst2112
08-22-2014, 04:36 PM
You should post code in a code block so it is readable and doesn't have a bunch of smilies in it.

Uleat
08-22-2014, 06:58 PM
I added code blocks..but, he'll have to add indentions... I don't want to change to change the context of what he's trying to do.

nilbog
08-23-2014, 10:20 AM
You can do this rather simply by requesting a $ulevel check with an if. Like:

if ($text=~/heal/i)
{
if ($ulevel <= 10)
{
quest::selfcast(13);
}
}

and at the beginning of sub EVENT_ITEM:

sub EVENT_ITEM
{
if ($ulevel <= 10)
{

Note that will make the npc not accept any item unless the user is <= level 10. If you wanted them to take other items, you can add that if check in each platinum/item check.

For example, here is your script with the additions.

sub EVENT_SAY {
if ($text =~/Hail/i)
{
quest::say("Greetings $name. If you want me to cast a spell on you, please say so and I will give you my [pricelist]. If you want me to [heal] you, please say so and I will do it for free.");
}
if($text=~/pricelist/i)
{
quest::say("I can cast the following spells : Spirit of Wolf = 1 pp // Dead Man Floating = 3 pp // Clarity = 4 pp // Clarity II = 5 pp // Spiritual Light = 8 pp // Spiritual Radiance = 15 pp // Temperance = 1 peridot // Virtue = 4 peridots // KEI = 50 pp");
}
if ($text=~/heal/i)
{
if ($ulevel <= 10)
{
quest::selfcast(13);
}
}
}

sub EVENT_ITEM
{
if ($ulevel <= 10)
{
if($platinum == 1)
{
quest::selfcast(278);
}
if($platinum == 3)
{
quest::selfcast(457);
}
if($platinum == 4)
{
quest::selfcast(174);
}
if($platinum == 5)
{
quest::selfcast(1693);
}
if($platinum == 8)
{
quest::selfcast(2176);
}
if($platinum == 15)
{
quest::selfcast(2177);
}
if($item1== 10028)
{
quest::selfcast(3692);
}
if($itemcount{10028} == 4)
{
quest::selfcast(3467);
}
if($platinum == 50)
{
quest::selfcast(2570);
}
}
}


Hope that helps. Good luck.

knight-mare
08-23-2014, 12:18 PM
tried that and didnt work ..... but what i wanna do is give free spells to people under say level 10.... so in all honesty that script would not work anyways

so i changed it to

sub EVENT_SAY
{
my $buffs = quest::saylink("buffs");
if($text=~/Hail/i)
{
quest::say("Greetings $name. Would you like some [$buffs]?");
}

if($text=~/buffs/i)
{
quest::selfcast(174);
quest::selfcast(3692);
quest::selfcast(2525);
quest::selfcast(144);
quest::selfcast(970);
quest::selfcast(356);
quest::selfcast(998);
quest::selfcast(278);
}
}

but if i add u level it becomes unusable

nilbog
08-23-2014, 12:44 PM
Quest worked fine for me. I tried it, but maybe something is different. The perl wiki still references:

$ulevel # Returns the level of the user that triggered the Event.

So I'm not sure about that.

but what i wanna do is give free spells to people under say level 10

In your previous example, it seemed you explicitly wanted to charge for them.

I just tried this, and it worked fine, with a level check, as well as an else telling them why it wouldn't work.

sub EVENT_SAY {
if ($text=~/buffs/i)
{
if ($ulevel <= 10)
{
quest::selfcast(174);
quest::selfcast(3692);
quest::selfcast(2525);
quest::selfcast(144);
quest::selfcast(970);
quest::selfcast(356);
}
else
{
quest::say("I was going to give you buffs, but you're above level 10!");
}
}
}

knight-mare
08-23-2014, 01:25 PM
Thanks you a ton :)