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-30-2012, 09:37 AM
rixcraven
Sarnak
 
Join Date: Nov 2008
Location: UK
Posts: 57
Default Need a little help with this quest

Thanks to the help I got yesterday, I progressed this well!.
I just need some help with this problem,

I want Cobra to NOT taunt if the players faction is below 6 with him..I've tried putting the if ($faction <= 6) { line in various places within the script,
but STILL he begins the taunts???
Any help would be greatly 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 <= 6) {
quest::shout2("Be Ready, $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.");
quest::sfollow;
}
}

# When Cobra Is offered 200pp he shows mercy

sub EVENT_ITEM
{

}


# When the timer Is up Cobra says random things about the target
sub EVENT_TIMER
{
if ($faction <= 6) {
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 just maim 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"); }
else {
my $timerinterval=int(rand(40)+10); #10-50 sec
quest::settimer("tmr",$timerinterval);
quest::say("timer set to: $timerinterval");
quest::say("$name Faction is: $faction");
}
}

}

sub EVENT_SAY
{
if ($text=~/Hail/i)
{ quest::say("My Name is Cobra, remember that, $name, and think twice before upsetting My [patrons]!");}

if ($text=~/patrons/i)
{ quest::say("Lord Elgnub of Blackburrow is a personal friend. I would take any attacks on their people as a personal offence");}

if ($text=~/hammer/i)
{ quest::say("I just want a chat you know like the old time - listen to your stories of danger and adventure");}
}
}
Reply With Quote
  #2  
Old 10-30-2012, 09:58 AM
c0ncrete's Avatar
c0ncrete
Dragon
 
Join Date: Dec 2009
Posts: 719
Default

<= is less than or equal to. if you want it just below a value, use < alone.

it is possible that the $faction value is not directly exposed in EVENT_TIMER. if that is the case, it's probably always evaluating to 0 (undef). you can verify this by having the value printed out from within the event.
Reply With Quote
  #3  
Old 10-30-2012, 10:19 AM
trevius's Avatar
trevius
Developer
 
Join Date: Aug 2006
Location: USA
Posts: 5,946
Default

Yeah, EVENT_TIMER does not pass the client information, because it doesn't know which client it should be passing to the timer. You would probably just want to get the NPC's target, check if it is a client, and if so, get the faction value for that client with the faction ID that the NPC uses. The script below should work for what you are wanting to do. You will need to put the NPC's faction ID where it says "faction_id" so it knows which faction it is looking up the value for against the client.

Code:
my $target_faction = 999999; # Random high number that is > 6
my $target = $npc->GetTarget();
if ($target && $target->IsClient())
{
	$target_faction = $target->GetCharacterFactionLevel(faction_id);	# Set "faction_id" to the NPC's faction id
}
I haven't tested that script, but it should work for getting the faction in the timer as you are trying to do. You would then check if $target_faction is <= 6 or whatever.
__________________
Trevazar/Trevius Owner of: Storm Haven
Everquest Emulator FAQ (Frequently Asked Questions) - Read It!
Reply With Quote
  #4  
Old 10-30-2012, 12:49 PM
rixcraven
Sarnak
 
Join Date: Nov 2008
Location: UK
Posts: 57
Default Saved Again

Thanks Both!..
another script saved!
Brilliant.
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 04:51 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