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 02-19-2015, 08:04 PM
Greyhelm's Avatar
Greyhelm
Sarnak
 
Join Date: Jul 2009
Location: East Coast
Posts: 35
Default More efficient way to do this routine?

I was wondering if there was a more efficient way to do this.
Also I want to add a class check so that I particular class needs to be in the party or proximity of the trigger. I setup an invisible man trigger at a location and setup his proximity. I couldn't only get one mob to spawn while in the proximity so I opt'd to use depop. Though the spawned npc was set to unique it still kept spawning the NPC if I moved in and out of the proximity.

Code:
sub EVENT_SPAWN{
   quest::set_proximity($x-5,$x+5,$y-5,$y+5,$z-5,$z+5);
   }
sub EVENT_ENTER{
   if($class eq 'Ranger'){
   quest::spawn2(303091,0,0,1309,652,388,130);
   $npc->Depop();
   }
}
Any suggestions? I am reading over $class checks and tried if($class eq 'Ranger') but that didn't work under EVENT_ENTER. Thanks in advance for the help.

EDIT - I missed the squiggley's, class check works.. When you use the right syntax...

Last edited by Greyhelm; 02-19-2015 at 10:04 PM.. Reason: add right syntax for class check spawn condition
Reply With Quote
  #2  
Old 02-19-2015, 10:00 PM
Maceblade
Hill Giant
 
Join Date: Jun 2010
Posts: 231
Default

this is what I used
Code:
$ProxDist = 40;

sub EVENT_SPAWN {

	$x = $npc->GetX();
	$y = $npc->GetY();
	$z = $npc->GetZ();
	quest::set_proximity($x - $ProxDist, $x + $ProxDist, $y - $ProxDist, $y + $ProxDist, $z - $ProxDist, $z + $ProxDist);
	quest::settimer("setprox", 2);
	
}

sub EVENT_TIMER {

	if ($timer eq "setprox") {
		my $x = $npc->GetX();
		my $y = $npc->GetY();
		my $z = $npc->GetZ();
		quest::clear_proximity();
		quest::set_proximity($x - $ProxDist, $x + $ProxDist, $y - $ProxDist, $y + $ProxDist, $z - $ProxDist, $z + $ProxDist);
	}

}

sub EVENT_ENTER {
	$client->Message(14,"You hear a voice as something emerges from the crystalline walls.");
	quest::spawn2(999341,0,0,2312,1120,459,187);

}

sub EVENT_EXIT {
$client->Message(14,"The image shimmers and fades into the shadows...");
	quest::depopall(999341);

}
Doesn't check for class, but im pretty sure you can add a class check in and it should work fine... ill dig around in a second and see if I can get it to work.
Reply With Quote
  #3  
Old 02-19-2015, 10:15 PM
Greyhelm's Avatar
Greyhelm
Sarnak
 
Join Date: Jul 2009
Location: East Coast
Posts: 35
Default

edited my post.. found it for class check.. I just didn't use the right syntax for class check. I didn't put the curly brackets. I am still learning things.. In your code once the timer is reached it clears the proximity you used to trigger the event, then resets it, then will depop once exiting the proximity?
Reply With Quote
  #4  
Old 02-19-2015, 10:48 PM
ghanja's Avatar
ghanja
Dragon
 
Join Date: Aug 2012
Location: Hershey, PA
Posts: 499
Default

Code:
sub EVENT_SPAWN {
	plugin::SetProx(40,40);
	quest::settimer("setprox", 2);
}

sub EVENT_TIMER {
	quest::clear_proximity();
	plugin::SetProx(40,40);
}

sub EVENT_ENTER {
	$client->Message(14,"You hear a voice as something emerges from the crystalline walls.");
	quest::spawn2(999341,0,0,2312,1120,459,187);
}

sub EVENT_EXIT {
	$client->Message(14,"The image shimmers and fades into the shadows...");
	quest::depopall(999341);
}
NPC spawns set proximity with 40 z y z axes range, clears after 2 seconds, then another proximity is set (every two seconds). Upon entering the proximity it will spawn npctype 999341 with no grid assigned, no guildwarset assigned, at coordinates 2312, 1120, 459 with a heading of 187. When the entity (that entered the proximity triggering that npc spawn) leaves the proximity it will depop all npc types of 999341. Made it as "efficient" as I would know how I think or atleast, less lines of code to be concerned with.
Reply With Quote
  #5  
Old 02-19-2015, 11:19 PM
Maceblade
Hill Giant
 
Join Date: Jun 2010
Posts: 231
Default

Yes my timer is set for 2 seconds once proximity is left to depop the npc and Ghanja's code is way more cleaner than mine lol
Reply With Quote
  #6  
Old 02-19-2015, 11:36 PM
ghanja's Avatar
ghanja
Dragon
 
Join Date: Aug 2012
Location: Hershey, PA
Posts: 499
Default

Quote:
Originally Posted by Maceblade View Post
Yes my timer is set for 2 seconds once proximity is left to depop the npc and Ghanja's code is way more cleaner than mine lol
Meh, it all works the same is what I say, so.. heh

Greyhelm, I see you were looking into timers.

The reason there is a lack of conditional, i.e.:
Code:
if ($timer eq "setprox") {
}
Is that that particular code of Mace's only has one timer being dealt with, which will call the EVENT_TIMER subroutine every "2 seconds", so there is no need to check what the timers name is.

In case you were wondering why it may have looked a little screwy.
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 12:45 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