Go Back   EQEmulator Home > EQEmulator Forums > Quests > Quests::Custom

Quests::Custom Custom Quests here

Reply
 
Thread Tools Display Modes
  #1  
Old 10-11-2018, 03:30 AM
greyfox8888
Fire Beetle
 
Join Date: Feb 2009
Location: eq
Posts: 5
Default Need NPC to trigger iff it's in melee range

EDIT: Sorry I meant to post this in Quest: Q&A ...

I am working on an encounter in which the boss picks a random target from its hate list and summons an add which immediately begins to path/attack that target.

Now for the part that I am unsure about. I would like the add to cast an AOE spell and then depop the moment it gets into melee range of its target. You can think of the add acting like a homing missile which detonates on impact. The goal being that the players must kite the adds and never get within melee range or they go boom.

Is there someway to trigger an event only when the mob is in melee range of its target?

EVENT_AGGRO, and EVENT_COMBAT trigger right when the add is assigned a target on the hate list. I have tried using IF ($npc->IsEngaged()), but that triggers the same time EVENT_COMBAT triggers. I have also tried setting up a timer that would update a proximity around the add. That method kind of worked but was really inconsistent. I figure the 1 second delay to check proximity just isn't the best option for checking melee range of 2 moving mobs (add, and target).

Any ideas on how to implement this would be greatly appreciated. I am new to this so it wouldn't surprise me if there is a plugin or something of the likes
that I have totally over looked. Anything that can help me trigger an event once a mob is within melee range, or has dealt X amount of damage to an NPC would be perfect.
Reply With Quote
  #2  
Old 10-11-2018, 03:32 PM
demonstar55
Demi-God
 
Join Date: Apr 2008
Location: MA
Posts: 1,164
Default

on a timer check distance to target they're chasing?
Reply With Quote
  #3  
Old 10-11-2018, 08:21 PM
greyfox8888
Fire Beetle
 
Join Date: Feb 2009
Location: eq
Posts: 5
Default

Thanks so much! That did the trick. I completely missed the plugins:

plugin::CheckDist(entity, distance);
plugin::CheckDistBetween2Ents(entity1, entity2, distance);

The code for the spawned adds now works as intended:

Code:
sub EVENT_AGGRO {
   quest::shout("$name!!!");    #Shouts the name of the player that better start running
   quest::settimer("distance", 1);
}

sub EVENT_TIMER {

   if ($timer eq "distance") {

     my $target = $npc->GetTarget();

     if(plugin::CheckDist($target, 21)) {
          $npc->SpellFinished(732, $target,0); #cast Ice Comet on target if it is within 21 units of distance
          quest::depop();
     } 
   }
}
Reply With Quote
  #4  
Old 10-11-2018, 10:38 PM
demonstar55
Demi-God
 
Join Date: Apr 2008
Location: MA
Posts: 1,164
Default

I would recommend increasing the timer a bit, I think perl is in seconds, but 1 second is pretty often :P
Reply With Quote
  #5  
Old 10-12-2018, 02:17 PM
NatedogEZ's Avatar
NatedogEZ
Developer
 
Join Date: Dec 2012
Posts: 515
Default

Could maybe try EVENT_ENTER .. but make sure to set a proximity first for it to trigger
Reply With Quote
  #6  
Old 10-12-2018, 02:29 PM
demonstar55
Demi-God
 
Join Date: Apr 2008
Location: MA
Posts: 1,164
Default

Quote:
Originally Posted by NatedogEZ View Post
Could maybe try EVENT_ENTER .. but make sure to set a proximity first for it to trigger
The NPC is moving, so they would have to constantly change the proximity ... Probably better to just check distance :P
Reply With Quote
  #7  
Old 10-12-2018, 09:57 PM
ChaosSlayerZ's Avatar
ChaosSlayerZ
Demi-God
 
Join Date: Mar 2009
Location: Umm
Posts: 1,492
Default

Sorry for hijacking a the tread - I have similar question
Suppose I have npc roaming around the zone.
I want NPC to do something when it passes near a player - like emote.
In the case above, npc already have player target, in my case it can be any player anywhere or multiple of them, so I need npc to continuously check around for valid target.

I was thinking - how does exactly aggro works - isn't npc continuously checking if player is in its range? Can't same principle be used?

Thanks!
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:07 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