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-05-2012, 06:35 AM
chrismed0
Sarnak
 
Join Date: Aug 2010
Location: USA
Posts: 75
Default MOB Proximity

Hello,

Writting a quest for an ENTER / EXIT event that has a proximity. Seems pritty strait forward but I'm having a little problem and have searched and haven't been able to find the answer yet.

What I'm trying to do is turn "FlyMode" on when entering the proximity of the NPC and turn it off when leaving the proximity. The catch, the NPC moves.
I need the proximity to stay with the NPC and not where the NPC spawns.

This is a boat. So I want FlyMode to stay on while on the boat and when you exit it turns off.

I have tried:
Code:
sub EVENT_SPAWN
{
    quest::set_proximity( $x -100, $x +100, $y -50, $y +50, $z -150, $z +150);
}
sub EVENT_ENTER
{
   quest::FlyMode(2);
}


sub EVENT_EXIT
{
  quest::FlyMode(0)
}
and this:

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


sub EVENT_ENTER
{
 	quest::FlyMode(2)
}

sub EVENT_EXIT
{
	quest::FlyMode(0)
}
Both work great but the proximity doesn't follow the NPC it stays where the NPC spawns.
Not sure how to make it follow the NPC and can't find a refrence.
thanks


~edit~
I was thinking, If you can't make the proximity follow the NPC could you make the proximity follow the PC.
With maybe a player.pl for that zone. When ever the PC gets close to "x" npc then "this" happens. And when ever the PC leaves the proximity of "x" NPC then "this" happens?
Reply With Quote
  #2  
Old 10-05-2012, 08:54 AM
trevius's Avatar
trevius
Developer
 
Join Date: Aug 2006
Location: USA
Posts: 5,946
Default

Either way, you will need to use a timer to update the proximity or check the player location. Here is a simple script that does basically what you are wanting:

Code:
$ProxDist = 100;

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 {

	quest::FlyMode(2);

}

sub EVENT_EXIT {

	quest::FlyMode(0);

}
The only problem with this is that if the player stands in place while the NPC moves out of range and creates a new proximity, it won't remove their flymode because they won't actually be exiting the old or new proximity. Probably the best work-around for this is to do a loop through the client list to do a distance check and remove flymode if they are outside a specified range. You could do that in the same timer as the proximity move so they line up time-wise with each other.
__________________
Trevazar/Trevius Owner of: Storm Haven
Everquest Emulator FAQ (Frequently Asked Questions) - Read It!
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 05:18 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