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 05-16-2014, 01:37 AM
Esildor
Hill Giant
 
Join Date: Feb 2010
Posts: 207
Default Proximities and NPCs

I'm wanting to make an event that spawns some adds, the adds will path towards the boss and if they are able to reach him I want them to despawn and cause the boss to heal.

I was originally thinking proximities but it looks like their function is specifically for a client entering the proximity, not an NPC?

I've been looking around on the wiki for the past couple hours without any luck, anyone able to point me in the right direction?
Reply With Quote
  #2  
Old 05-16-2014, 01:42 AM
Esildor
Hill Giant
 
Join Date: Feb 2010
Posts: 207
Default

Just saw this:

Code:
sub EVENT_SAY{
    my $npc1 = $entity_list->GetNPCByNPCTypeID(10001);
    my $npc2 = $entity_list->GetNPCByNPCTypeID(10002);
    #::: Check to See if these NPC's are within distance
    if(plugin::CheckDistBetween2Ents($npc1, $npc2, 50)){
        quest::say("NPC's are in distance of 50");
        quest::say("NPC 1 is " . $npc1->GetCleanName());
        quest::say("NPC 2 is " . $npc2->GetCleanName());
    } else{
        quest::say("These NPC's are not in distance at all");
    }
}
Thinking this will work for me. Should be able to spawn the adds on a grid and have them despawn when they get too close to a dumby npc strictly there for this.
Reply With Quote
  #3  
Old 05-16-2014, 01:43 AM
Akkadius's Avatar
Akkadius
Administrator
 
Join Date: Feb 2009
Location: MN
Posts: 2,071
Default

Quote:
Originally Posted by Esildor View Post
I'm wanting to make an event that spawns some adds, the adds will path towards the boss and if they are able to reach him I want them to despawn and cause the boss to heal.

I was originally thinking proximities but it looks like their function is specifically for a client entering the proximity, not an NPC?

I've been looking around on the wiki for the past couple hours without any luck, anyone able to point me in the right direction?
What you want is to use a function that will check the distance between the trash and the boss. You can achieve that with:

plugin::CheckDistBetween2Ents(entity1, entity2, distance);
http://wiki.eqemulator.org/p?Perl_Pl...ntity-distance

You will also want to use something simple like quest::follow, which will follow the entity that you specify:

quest::follow(EntityID, [Distance]) # Mob starts to follow "EntityID". The second field, Distance, is optional and can be used to set the distance the Mob will follow it's target at.

Setting the runspeed or walkspeed of the mob if you will, will give players a longer reaction time before the adds get to the main boss.

Hopefully that helps.
Reply With Quote
  #4  
Old 05-16-2014, 01:45 AM
Esildor
Hill Giant
 
Join Date: Feb 2010
Posts: 207
Default

Quote:
Originally Posted by Akkadius View Post
What you want is to use a function that will check the distance between the trash and the boss. You can achieve that with:

plugin::CheckDistBetween2Ents(entity1, entity2, distance);
http://wiki.eqemulator.org/p?Perl_Pl...ntity-distance

You will also want to use something simple like quest::follow, which will follow the entity that you specify:

quest::follow(EntityID, [Distance]) # Mob starts to follow "EntityID". The second field, Distance, is optional and can be used to set the distance the Mob will follow it's target at.

Setting the runspeed or walkspeed of the mob if you will, will give players a longer reaction time before the adds get to the main boss.

Hopefully that helps.
Ha,

Thanks Akkadius.

Don't know why I would want a dumby npc when I can use the boss :l silly me.

The quest::follow you're referring to having the adds I spawn follow my boss, correct? I'm assuming they don't follow any intelligent grid if I do that, in which case I'm fairly certain they would run through walls.
Reply With Quote
  #5  
Old 05-16-2014, 02:25 AM
Esildor
Hill Giant
 
Join Date: Feb 2010
Posts: 207
Default

Akkadius,

Quote:
Originally Posted by Akkadius
quest::follow(EntityID, [Distance]) # Mob starts to follow "EntityID". The second field, Distance, is optional and can be used to set the distance the Mob will follow it's target at.
The 'EntityID' in the quest::follow code, would that be the same ID I'm using to check distances? for example I'm using this right now to check the distance:

Code:
sub EVENT_SPAWN {
	quest::settimer("add_boss_dist", 3);
	quest::shout("I work");
	}
	
sub EVENT_TIMER {	
	my $npc1 = $entity_list->GetNPCByNPCTypeID(4770003);
	my $npc2 = $entity_list->GetNPCByNPCTypeID(4770004);
	if ($timer eq "add_boss_dist"){
		if(plugin::CheckDistBetween2Ents($npc1, $npc2, 10)){
			quest::shout("I'm in distance.");
			}
			else{
			quest::shout("I'm not in distance.");
			}
		}
	}
}
I had added this to the sub EVENT_SPAWN as well

Code:
quest::settimer(1, 1);
and then plugged in the following to try to make the npc follow and it isn't working.

Code:
if($timer == 1){
		quest::shout("timer works");
		quest::follow($npc1, 10);
		quest::stopttimer(1);
		}
Reply With Quote
  #6  
Old 05-16-2014, 02:28 AM
Splose
Banned
 
Join Date: Apr 2014
Posts: 279
Default

Quote:
Originally Posted by Esildor View Post
Akkadius,



The 'EntityID' in the quest::follow code, would that be the same ID I'm using to check distances? for example I'm using this right now to check the distance:

Code:
sub EVENT_SPAWN {
	quest::settimer("add_boss_dist", 3);
	quest::shout("I work");
	}
	
sub EVENT_TIMER {	
	my $npc1 = $entity_list->GetNPCByNPCTypeID(4770003);
	my $npc2 = $entity_list->GetNPCByNPCTypeID(4770004);
	if ($timer eq "add_boss_dist"){
		if(plugin::CheckDistBetween2Ents($npc1, $npc2, 10)){
			quest::shout("I'm in distance.");
			}
			else{
			quest::shout("I'm not in distance.");
			}
		}
	}
}
I had added this to the sub EVENT_SPAWN as well

Code:
quest::settimer(1, 1);
and then plugged in the following to try to make the npc follow and it isn't working.

Code:
if($timer == 1){
		quest::shout("timer works");
		quest::follow($npc1, 10);
		quest::stopttimer(1);
		}
You have an extra t in there. Take that out an see what's going on after =)
Reply With Quote
  #7  
Old 05-16-2014, 02:31 AM
Esildor
Hill Giant
 
Join Date: Feb 2010
Posts: 207
Default

Good catch Splose.

It stopped him from repeating 'timer works' every second, but, still no follow.

This is exactly what it looks like right now:

Code:
sub EVENT_SPAWN {
	quest::settimer("add_boss_dist", 3);
	quest::shout("I work");
	quest::settimer(1, 1);
	}
	
sub EVENT_TIMER {	
	my $npc1 = $entity_list->GetNPCByNPCTypeID(4770003);
	my $npc2 = $entity_list->GetNPCByNPCTypeID(4770004);
	if($timer == 1){
		quest::shout("timer works");
		quest::follow($npc1);
		quest::stoptimer(1);
		}
	if ($timer eq "add_boss_dist"){
		if(plugin::CheckDistBetween2Ents($npc1, $npc2, 10)){
			quest::shout("I'm in distance.");
			}
			else{
			quest::shout("I'm not in distance.");
			}
		}
	}
}

Last edited by Esildor; 05-16-2014 at 02:33 AM.. Reason: added exact code
Reply With Quote
  #8  
Old 05-16-2014, 02:59 AM
Splose
Banned
 
Join Date: Apr 2014
Posts: 279
Default

If the boss is stationary try this. I made a script really fast trying to use the quest::follow and it didn't work for me either.

What this is going to do is the mob is going to walk/run whatever to the boss, and then you need to make sure you intercept it. If it gets to the boss it's going to walk back to its original spawnpoint.. Another way (and this is my suggestion) is to use a grid and then use the waypoint arrive event to script it.

Code:
sub EVENT_SPAWN {
	quest::settimer("add_boss_dist", 3);
	quest::shout("I work");
	quest::settimer(1, 1);
}
	
sub EVENT_TIMER {	
	my $npc1 = $entity_list->GetNPCByNPCTypeID(4770003);
	my $npc2 = $entity_list->GetNPCByNPCTypeID(4770004);
	if($timer == 1){
		quest::shout("timer works");
		quest::moveto($npc1->GetX(),$npc1->GetY(),$npc1->GetZ());
		quest::stoptimer(1);
	}
	if ($timer eq "add_boss_dist"){
		if(plugin::CheckDistBetween2Ents($npc1, $npc2, 10)){
				quest::shout("I'm in distance.");
		}
			else{
				quest::shout("I'm not in distance.");
		}
	}
}
This is what i tried to use in my nexus/default.pl

Code:
sub EVENT_SPAWN {
$nn = $npc->GetCleanName();
	if($nn eq "a") {
		quest::follow($entity_list->GetNPCByNPCTypeID(999334), 1); #::
		quest::say("following " . $entity_list->GetNPCByNPCTypeID(999334)->GetCleanName() . " ");
	}
}
Reply With Quote
  #9  
Old 05-16-2014, 03:04 AM
Esildor
Hill Giant
 
Join Date: Feb 2010
Posts: 207
Default

Did that work for you Splose?

I tried the:

Code:
quest::follow(" " . $entity_list->GetNPCByNPCTypeID(999334) . ""); 
quest::say("following " . $entity_list->GetNPCByNPCTypeID(999334)->GetCleanName() . "");
He told me he was following him but didnt :P
Reply With Quote
  #10  
Old 05-16-2014, 03:05 AM
Splose
Banned
 
Join Date: Apr 2014
Posts: 279
Default

Quote:
Originally Posted by Esildor View Post
Did that work for you Splose?

I tried the:

Code:
quest::follow(" " . $entity_list->GetNPCByNPCTypeID(999334) . ""); 
quest::say("following " . $entity_list->GetNPCByNPCTypeID(999334)->GetCleanName() . "");
He told me he was following him but didnt :P
Nah.. that's the one that wasn't working for me either.. Try the script above that. Also wasn't paying attention and put quotes in the follow too.. fixed that and edited my original post but still not working properly.
Reply With Quote
  #11  
Old 05-16-2014, 03:13 AM
Esildor
Hill Giant
 
Join Date: Feb 2010
Posts: 207
Default

Splose,

Thanks!

I removed the stoptimer so it's constantly updating the location, works perfect. It wanting to 'return' to it's spawn point after it reaches isn't an issue because if it does reach the boss it's being 'absorbed' and healing the boss.
Reply With Quote
  #12  
Old 05-16-2014, 03:15 AM
Splose
Banned
 
Join Date: Apr 2014
Posts: 279
Default

Quote:
Originally Posted by Esildor View Post
Splose,

Thanks!

I removed the stoptimer so it's constantly updating the location, works perfect. It wanting to 'return' to it's spawn point after it reaches isn't an issue because if it does reach the boss it's being 'absorbed' and healing the boss.
No problem bud.. just be aware that if the boss moves around the NPC is going to move to where the boss is at the time of it spawning. So if that NPC spawns and a player moves the boss to the other side of the room it's easily exploitable.
Reply With Quote
  #13  
Old 05-16-2014, 03:18 AM
Esildor
Hill Giant
 
Join Date: Feb 2010
Posts: 207
Default

Quote:
Originally Posted by Splose View Post
No problem bud.. just be aware that if the boss moves around the NPC is going to move to where the boss is at the time of it spawning. So if that NPC spawns and a player moves the boss to the other side of the room it's easily exploitable.
Nope.

I don't have the stoptimer in, so, it's constantly updating the bosses loc, have tested it and the mobs reroute themselves if the boss moves.

Biggest issue is a b-line puts the mobs through walls, I think I'm going to have to spawn them on a grid, and then once they reach the end of the grid have them grab the npc to move to it.

Using the 'waypoint arrive event' you mentioned I should be able to have the mobs move to the npc once they arrive at that waypoint, correct?
Reply With Quote
  #14  
Old 05-16-2014, 04:24 AM
Splose
Banned
 
Join Date: Apr 2014
Posts: 279
Default

Quote:
Originally Posted by Esildor View Post
Nope.

I don't have the stoptimer in, so, it's constantly updating the bosses loc, have tested it and the mobs reroute themselves if the boss moves.

Biggest issue is a b-line puts the mobs through walls, I think I'm going to have to spawn them on a grid, and then once they reach the end of the grid have them grab the npc to move to it.

Using the 'waypoint arrive event' you mentioned I should be able to have the mobs move to the npc once they arrive at that waypoint, correct?
That's correct man
Reply With Quote
  #15  
Old 05-16-2014, 01:43 PM
Esildor
Hill Giant
 
Join Date: Feb 2010
Posts: 207
Default

Playing with the sub EVENT_WAYPOINT_ARRIVE {

This is what I have currently:

Code:
sub EVENT_SPAWN {
	$npc->AssignWaypoints(546703);
	}
}

sub EVENT_WAYPOINT_ARRIVE {
	if ($wp == 3) {
		quest::shout("hi");
		}
}
Do I need some kind of definition of which grid the waypoint is on before the if statement? like my $wp = ($npc->GetGrid()) ? Found what looked like some examples on older threads but they were just using ($wp == 3) or saw another like ($wp eq 3)
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:42 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