|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Quests::Q&A This is the quest support section |
05-16-2014, 01:37 AM
|
Hill Giant
|
|
Join Date: Feb 2010
Posts: 207
|
|
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?
|
05-16-2014, 01:42 AM
|
Hill Giant
|
|
Join Date: Feb 2010
Posts: 207
|
|
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.
|
|
|
|
05-16-2014, 01:43 AM
|
|
Administrator
|
|
Join Date: Feb 2009
Location: MN
Posts: 2,071
|
|
Quote:
Originally Posted by Esildor
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.
|
|
|
|
|
|
|
05-16-2014, 01:45 AM
|
Hill Giant
|
|
Join Date: Feb 2010
Posts: 207
|
|
Quote:
Originally Posted by Akkadius
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.
|
|
|
|
|
|
|
05-16-2014, 02:25 AM
|
Hill Giant
|
|
Join Date: Feb 2010
Posts: 207
|
|
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);
}
|
|
|
|
05-16-2014, 02:28 AM
|
|
Discordant
|
|
Join Date: Apr 2014
Posts: 279
|
|
Quote:
Originally Posted by Esildor
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 =)
|
05-16-2014, 02:31 AM
|
Hill Giant
|
|
Join Date: Feb 2010
Posts: 207
|
|
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
|
|
|
|
05-16-2014, 02:59 AM
|
|
Discordant
|
|
Join Date: Apr 2014
Posts: 279
|
|
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() . " ");
}
}
|
|
|
|
05-16-2014, 03:04 AM
|
Hill Giant
|
|
Join Date: Feb 2010
Posts: 207
|
|
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
|
05-16-2014, 03:05 AM
|
|
Discordant
|
|
Join Date: Apr 2014
Posts: 279
|
|
Quote:
Originally Posted by Esildor
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.
|
05-16-2014, 03:13 AM
|
Hill Giant
|
|
Join Date: Feb 2010
Posts: 207
|
|
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.
|
05-16-2014, 03:15 AM
|
|
Discordant
|
|
Join Date: Apr 2014
Posts: 279
|
|
Quote:
Originally Posted by Esildor
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.
|
05-16-2014, 03:18 AM
|
Hill Giant
|
|
Join Date: Feb 2010
Posts: 207
|
|
Quote:
Originally Posted by Splose
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?
|
05-16-2014, 04:24 AM
|
|
Discordant
|
|
Join Date: Apr 2014
Posts: 279
|
|
Quote:
Originally Posted by Esildor
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
|
05-16-2014, 01:43 PM
|
Hill Giant
|
|
Join Date: Feb 2010
Posts: 207
|
|
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)
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -4. The time now is 01:32 AM.
|
|
|
|
|
|
|
|
|
|
|
|
|