PDA

View Full Version : Level restricting quest variables


Annihilator
12-30-2007, 03:49 AM
I've been doing some modification to the standard buff bot scripts Vicar_Qadar, Illusionist_Nomaad and Dieffer_Wolfhugger that came with Angelox's Classic database. Specifically, I've been modifying them to cast more spells. However, I've noticed a glitch and I'm not quite sure what I can do to resolve this. Maybe one of the more experienced PERL scripters can shed some light for me?

Here is one of the sample scripts

#zone:PoKnowledge
#Angelox

sub EVENT_SAY {
if(($text=~/hail/i)&&($ulevel<= 45)){
$npc->SetAppearance(0);
quest::say("Hello $name, For a donation of 5pp, I'll cast Spirit of the Wolf on you.");
}
elsif(($text=~/hail/i)&&($ulevel=>46)){
$npc->SetAppearance(0);
quest::say("Hello $name, For a donation of 15pp, I'll cast Spirit of Eagle on you.");
}
}

sub EVENT_SPAWN
{
$x = $npc->GetX();
$y = $npc->GetY();
quest::set_proximity($x - 90, $x + 90, $y - 90, $y + 90);
}

sub EVENT_ENTER
{
$npc->SetAppearance(1);
my $random_result = int(rand(100));
if ($random_result<=15){
quest::shout("Casting SoW and SoE for donations behind the main bank!");
}else{
#Do Nothing
}
}

sub EVENT_ITEM{
if (($platinum>=15)&&($ulevel=> 46)){
$npc->SetAppearance(0);
#quest::selfcast(2517);
$npc->CastSpell(2517,$userid);
quest::say("Casting Spirit of Eagle, Good hunting!");

}elsif(($platinum>=5)&&($ulevel<= 45)){
$npc->SetAppearance(0);
#quest::selfcast(278);
$npc->CastSpell(278,$userid);
quest::say("Casting Spirit of the Wolf, Good hunting!");
}else{
quest::say("Thank you for your donation $name, it wasn't enough though ...");
}
}

sub EVENT_SIGNAL {
quest::shout("Casting SoW and SoE for donations behind the main bank!");
}


As you can see, there are level prerequisit strings coded in to allow the variants of spells to be cast for the specific level range for the buffs. However, even though the text is properly displayed when the level range is met, the script will still allow the higher level spell to be cast on the lower level character regardless of the $ulevel statement. Is this a glitch in the PERL processor or EQEmu? The version of PERL I'm using is ActivePerl 5.8.7.813.

Cripp
12-30-2007, 04:20 AM
try this one..


#zone:PoKnowledge
#Angelox

sub EVENT_SAY
{
if(($text=~/hail/i) && ($ulevel <= 45))
{
$npc->SetAppearance(0);
}
elsif(($text=~/hail/i) && ($ulevel >= 46))
{
$npc->SetAppearance(0);
quest::say("Hello $name, For a donation of 15pp, I'll cast Spirit of Eagle on you.");
}
}

sub EVENT_ENTER
{
$npc->SetAppearance(1);
my $random_result = int(rand(100));
if ($random_result <= 15)
{
quest::shout("Casting SoW and SoE for donations behind the main bank!");
}
else
{
#Do Nothing
}
}

sub EVENT_ITEM
{
if (($platinum >= 15) && ($ulevel >= 46))
{
$npc->SetAppearance(0);
$npc->CastSpell(2517,$userid);
quest::say("Casting Spirit of Eagle, Good hunting!");
}
elsif(($platinum >= 5) && ($ulevel <= 45))
{
$npc->SetAppearance(0);
$npc->CastSpell(278,$userid);
quest::say("Casting Spirit of the Wolf, Good hunting!");
}
else
{
quest::say("Thank you for your donation $name, it wasn't enough though ...");
}
}

sub EVENT_SIGNAL
{
quest::shout("Casting SoW and SoE for donations behind the main bank!");
}
some of the =>/=< symbols were backwards.. (if that even matters)
made it look better nyways ;p

sfisque
12-30-2007, 06:57 AM
yah cripp caught it.

remember:

=> is an assignment operator for hashes:

e.g.
%aHash = ( a => value_of_a );

using >= is much safer and removes ambiguity.


== sfisque

Annihilator
12-30-2007, 08:54 AM
Duh.. I didn't even catch that.. Thanks for the heads up -- I did not create this script though. It came out of Angelox's Classic database files. I was just trying to modify it and noticed it wasn't working quite right. Angelox, if you read this you might want to update your source file. :)

Angelox
12-30-2007, 01:53 PM
I don't recall doing any for druid buffs, I guess someone copy/pasted mine, included my name.
My original Qadar and Nomaad NPC scripts worked as they were, probably because of the order the lines were in. Who ever did the druid script shuffled things up so my symbol mistake stands out now.
I guess PEQ must have other buffer NPC's in POK nowadays.
Always good to put your name in there even if its an update I like this;
#zone:PoKnowledge
#Angelox
#Revised Annihilator
This way there's a history of how things went.
You're welcome to fix, and post anything I've done.

Annihilator
12-30-2007, 06:48 PM
My bad Angelox, I posted the wrong script. I meant to post the Illusionist_Nomaad script which is included in ax_classic. The Dieffer_Wolfhugger was an exact copy of it with the text and cast spells changed to suit the druid buff bot in PoKnowledge. My appologies, I hadn't intended to post the cut-and-paste version of the druid script that had your name in it but it was your script. I'm still learning PERL and was up all night trying to get the scripts debugged.

When a PC hails Illusionist_Nomaad and is less than level 45 the text displayed is "Hello $name, I can buff you with Clarity for a fee of 5pp, and my friend over there has cleric buffs.". If the PC is greater than level 46 the text displayed is "Hello $name, I can buff you with KEI for a fee of 15pp..." If a PC less than level 45 gives the NPC 15pp he gets KEI. The script error caught by Cripp fixed it right up. Thanks Cripp!

Annihilator
12-30-2007, 07:07 PM
Is there an easy way to increase the event signal shouts with these scripts?

Cripp
12-31-2007, 03:41 AM
sub EVENT_SAY
{
quest::signalwith("$npc->GetNPCTypeID(), 1, 0);

quest::signalwith("$npc->GetNPCTypeID(), 2, 0);
}

sub EVENT_SIGNAL
{
if ($signal eq "1")
{
quest::shout("Casting SoW and SoE for donations behind the main bank!");
}
if ($signal eq "2")
{
quest::shout("Signal 2!");
}
}

quick example of multiple signals with shouts..