Go Back   EQEmulator Home > EQEmulator Forums > Quests > Quests::Q&A

Quests::Q&A This is the quest support section

Reply
 
Thread Tools Display Modes
  #1  
Old 10-28-2012, 07:48 AM
rixcraven
Sarnak
 
Join Date: Nov 2008
Location: UK
Posts: 57
Default Checking player faction Needing guidance please

I've got this code, and it waits til a Player enters the zone..
what I want it to do, is check the players faction against its own, and then either attack, or not, if the players faction is ok.
But I got a bit stuck on getting the faction of the player.. any help would be appreciated!!..

sub EVENT_SPAWN
{
my $x;
my $y;
my $z;
my $h;
my $timerinterval=int(rand(10)+1);

$x = $npc->GetX();
$y = $npc->GetY();
$z = $npc->GetZ();
$h = $npc->GetHeading();

quest::settimer("tmr",$timerinterval);
quest::shout("timer set to: $timerinterval");
quest::set_proximity( $x-280,$x+280,$y-280,$y+280,$z-280,$z+280);
}

sub EVENT_ENTER
{
$npc->SetFollowID($client->GetID());
if $faction ($client) >= 6)) ;
quest::shout2("Hey $name, Going to hunt you down..make you pay, There is a Bounty on your head");
elsif
quest::shout2("$name, I 'aint looking fer you today.. move along");
}

# WhenCobra Is Given 200pp he depops

sub EVENT_ITEM
{




}


# When the timer Is up Cobra taunts the target


sub EVENT_TIMER
{

my $say1 = "My clients are paying good money to have you dead, $name";
my $say2 = "Is that the best you can do, $class???";
my $say3 = "Go ahead, RUN... make my Day.";
my $say4 = "DIE FOR ME";
my $say5 = "When you die, I am going to take your head back to my clients.";
my $say6 = "A poor excuse for a $class.. ";
my $say7 = "I have slain greater than you, $class.. you are just one more to me";
my $say8 = "For 100pp, I might just let you go";
my $say9 = "This will teach others not to fool with MY clients";
my $say10 = "RUN, $class, like the scum you are!";
my $say11 = "Drop your weapon, and I'll make it quick for you";
my $say12 = "For 200pp I could perhaps not kill you";

if ($timer eq "tmr")
{
quest::stoptimer("tmr");
$talk=int(rand(12)+1);
if ($talk eq 1) { quest::say("$say1"); }
if ($talk eq 2) { quest::say("$say2"); }
if ($talk eq 3) { quest::say("$say3"); }
if ($talk eq 4) { quest::say("$say4"); }
if ($talk eq 5) { quest::say("$say5"); }
if ($talk eq 6) { quest::say("$say6"); }
if ($talk eq 7) { quest::say("$say7"); }
if ($talk eq { quest::say("$say8"); }
if ($talk eq 9) { quest::say("$say9"); }
if ($talk eq 10) { quest::say("$say10"); }
if ($talk eq 11) { quest::say("$say11"); }
if ($talk eq 12) { quest::say("$say11"); }

my $timerinterval=int(rand(40)+10); #10-50 sec
quest::settimer("tmr",$timerinterval);
#quest::say("timer set to: $timerinterval");

}

}

sub EVENT_SAY
{

}
Reply With Quote
  #2  
Old 10-28-2012, 08:10 AM
wolfwalkereci
Discordant
 
Join Date: Dec 2005
Posts: 435
Default

Using a event say this works for me.
Code:
sub EVENT_SAY {
    if($text=~/hail/i) {
        if ($faction ==7) {
            quest::say("blah blah");
        }
    }
}
In your example I see you have the following:
Quote:
if $faction ($client) >= 6)) ;
Missing a "(" in there. Not sure what else might be an issue.
Reply With Quote
  #3  
Old 10-28-2012, 08:46 AM
c0ncrete's Avatar
c0ncrete
Dragon
 
Join Date: Dec 2009
Posts: 719
Default

besides missing the opening parenthesis and having an extra closing one your 'if' statement, you don't have anything for the script to do if it evaluates to true (nothing in curly braces, just ends with a semicolon). additionally, the following 'elsif' statement doesn't have anything to evaluate at all (should likely just be an 'else'), and the code to execute following isn't enclosed in curly braces.

you're probably looking for something like this:

Code:
if ($faction >= 6) {
    quest::shout2("Hey, $name. I'm going to hunt you down... make you pay. There is a bounty on your head.");
}
else {
    quest::shout2("$name, I ain't looking fer you today... move along.");
}
EVENT_ENTER only works when the client enters a set proximity to the npc, not when they enter the zone.

if you're wanting to check when a player enters the zone, you'll need to use EVENT_ENTERZONE in that zone's player.pl script. you should be able to check faction using $client->GetCharacterFactionLevel(), $client->GetFactionLevel(), or $client->GetModCharacterFactionLevel().
Reply With Quote
  #4  
Old 10-28-2012, 09:18 AM
rixcraven
Sarnak
 
Join Date: Nov 2008
Location: UK
Posts: 57
Smile Woo, thanks for this!!

Quote:
Originally Posted by c0ncrete View Post
besides missing the opening parenthesis and having an extra closing one your 'if' statement, you don't have anything for the script to do if it evaluates to true (nothing in curly braces, just ends with a semicolon). additionally, the following 'elsif' statement doesn't have anything to evaluate at all (should likely just be an 'else'), and the code to execute following isn't enclosed in curly braces.

you're probably looking for something like this:

Code:
if ($faction >= 6) {
    quest::shout2("Hey, $name. I'm going to hunt you down... make you pay. There is a bounty on your head.");
}
else {
    quest::shout2("$name, I ain't looking fer you today... move along.");
}
EVENT_ENTER only works when the client enters a set proximity to the npc, not when they enter the zone.

if you're wanting to check when a player enters the zone, you'll need to use EVENT_ENTERZONE in that zone's player.pl script. you should be able to check faction using $client->GetCharacterFactionLevel(), $client->GetFactionLevel(), or $client->GetModCharacterFactionLevel().
Yep!.. great, thanks a lot!, I know I'm not brilliant with perl.. (still a bit of a noob actually)!
So I value any hints! its nice to have a great support from this forum, my players and I salute you all
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

   

All times are GMT -4. The time now is 10:41 PM.


 

Everquest is a registered trademark of Daybreak Game Company LLC.
EQEmulator is not associated or affiliated in any way with Daybreak Game Company LLC.
Except where otherwise noted, this site is licensed under a Creative Commons License.
       
Powered by vBulletin®, Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Template by Bluepearl Design and vBulletin Templates - Ver3.3