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 04-28-2013, 06:08 PM
Drakiyth's Avatar
Drakiyth
Dragon
 
Join Date: Apr 2012
Posts: 545
Default sub EVENT_SPAWN - Check for clients around npc. Need some help please.

I have an idea on how to buff temporary (swarm) pets based on the user's charisma but it requires that npc to check for the player with a certain item in their inventory && their charisma value.


Just an example below. This quest goes in the folder where that npc resides either templates or the zone folder with its name.pl

sub EVENT_SPAWN
{
my $x;
my $y;
my $z;
my $h;

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


quest::set_proximity( $x-6,$x+6,$y-6,$y+6,$z-6,$z+6);
}

sub EVENT_???? (ENTER/EXIT WORK BUT ARE INCONVENIENT)
{

$cha = $client->GetCHA();
my $npcid = $npc->GetID();

if ($cha >= 50 && $cha <= 99 && $hasitem{1384})
{
quest::say("Test");
$npc->CastSpell(777,$npcid);
}


The example above works on proximity tests (EVENT_ENTER/EXIT) but it's annoying as hell since you have to move towards and away from the mob. So, my question to anybody reading this: How would you make an NPC check for the client and these conditions as soon as it's spawned only using sub EVENT_SPAWN?
Reply With Quote
  #2  
Old 04-28-2013, 06:22 PM
nenelan
Hill Giant
 
Join Date: Feb 2008
Posts: 116
Default

I'm pretty sure you can take a look at how steadfast servant works to detect an owner on spawn and see how that goes. Best of luck!
Reply With Quote
  #3  
Old 04-28-2013, 06:38 PM
Drakiyth's Avatar
Drakiyth
Dragon
 
Join Date: Apr 2012
Posts: 545
Default

Thank you very much! This helped a great deal!
Reply With Quote
  #4  
Old 04-28-2013, 08:49 PM
NatedogEZ's Avatar
NatedogEZ
Developer
 
Join Date: Dec 2012
Posts: 515
Default

Doesn't work with Offensive Swarm Pets.

They always spawn with an owner ID of 0


And their Follow ID is not the client that spawned them
Reply With Quote
  #5  
Old 04-28-2013, 09:41 PM
NatedogEZ's Avatar
NatedogEZ
Developer
 
Join Date: Dec 2012
Posts: 515
Default

Figured out a work around... not sure how efficient this is yet. But it works!

Checks for an Item on the player ... So if they are holding X item the swarm pet will buff itself with a nice buff!

So I guess you could make multiple different ranks of an item that make swarm pets more and more powerful.. heh

Code:
sub EVENT_SPAWN {
        quest::settimer("Buffs", 1);
}

sub EVENT_TIMER {
		my $petitem = 1733;
		my $petbuff = 27424;
		#Hostile Target of the Swarm PET!
        $KillTarg = $npc->GetTarget();
		
        if($KillTarg <= 0)
        {
			#Return if we have no target
                return;
        }
		#Grabbing all clients
		my @clientlist = $entity_list->GetClientList();
		foreach $ent (@clientlist)
		{
		my $ClientName = $ent->GetName();
		my $PlayerENT = $ent;
		my @hatelist = $KillTarg->GetHateList();    #Compare clients to those on the Hatelist of the Target
			foreach $ent (@hatelist)
			{
				my $h_ent = $ent->GetEnt();
				my $h_ent_name = $h_ent->GetName();
				if ($ClientName eq $h_ent_name)
				{
					if(plugin::check_hasitem($PlayerENT, $petitem))  #Check the clients on the hatelist for Worn Pet Buff item
					{
					my $myid = $npc->GetID();
					$npc->CastSpell($petbuff, $myid);
					quest::stoptimer("Buffs");
					return;  #Turn this on if you want it to stop after it finds ONE client with the item
					}
				}
			}
		}
}
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 01:48 AM.


 

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