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 08-01-2008, 03:47 AM
trevius's Avatar
trevius
Developer
 
Join Date: Aug 2006
Location: USA
Posts: 5,946
Default Adding Hate to Spawned Adds is not Working

I can't seem to figure out how to get this quest working properly. It seems pretty simple, since basically all it is supposed to do is spawn some adds and then add hate to the new spawns. The quest works fine accept for the section I highlighted in RED. The adds spawn, but they never agro. And, when the script runs, it breaks at the point where they are supposed to agro and doesn't even continue to cycle through and repeat the timers as it should. I don't get the "Testing Rat Agro Section!" message that I added to check if it was making that far.

This same section works just fine in another encounter I have, but on that encounter, the adds that come aren't spawned by the quest, they are just normal zone spawns. I suspect that "$entity_list->GetMobByNpcTypeID();" is what causes the problem. I think that since these are spawned adds and not static spawns in the zone, it can't find them in the entity list.

Does anyone know a way to get it working for spawned adds?

Code:
#Nightwhisker Fight

sub EVENT_ATTACK {


  quest::stoptimer("rat_adds");
  quest::shout("Rats of Dreadsire, I call upon you! Come to my aid!");
  quest::settimer("rat_adds",10);

}

sub EVENT_TIMER {

  if ($timer eq "rat_adds") {
    quest::stoptimer("rat_adds");

    quest::spawn2(quest::ChooseRandom(2700659,2700660,2700661),0,0, 17.7, 3209.0, 0.8,12);
    quest::spawn2(quest::ChooseRandom(2700659,2700660,2700661),0,0, 33.4, 3208.6, 1.8,6);
    quest::spawn2(quest::ChooseRandom(2700659,2700660,2700661),0,0, 29.9, 3223.7, 5.5,7);
    quest::spawn2(quest::ChooseRandom(2700659,2700660,2700661),0,0, 41.6, 3238.8, 10.3,253);
    quest::spawn2(quest::ChooseRandom(2700659,2700660,2700661),0,0, 24.9, 3245.3, 12.4,5);
    
    quest::spawn2(quest::ChooseRandom(2700659,2700660,2700661),0,0, 55.4, 3450.6, 24.1,61);
    quest::spawn2(quest::ChooseRandom(2700659,2700660,2700661),0,0, 67.4, 3440.7, 24.1,64);
    quest::spawn2(quest::ChooseRandom(2700659,2700660,2700661),0,0, 80.4, 3456.6, 24.1,61);
    quest::spawn2(quest::ChooseRandom(2700659,2700660,2700661),0,0, 101.3, 3439.0, 24.1,64);
    quest::spawn2(quest::ChooseRandom(2700659,2700660,2700661),0,0, 107.9, 3454.8, 24.1,66);

    quest::say("Come! Come! Rid these halls of the humaniods!");
    quest::settimer("rat_agro",2); }

  if ($timer eq "rat_agro") {

my $tiny_rats = $entity_list->GetMobByNpcTypeID(2700659);
my $albino_rats = $entity_list->GetMobByNpcTypeID(2700660);
my $black_rats = $entity_list->GetMobByNpcTypeID(2700661);

    if ($tiny_rats) {
my $hate_tiny_rats = $tiny_rats->CastToNPC();
$hate_tiny_rats->AddToHateList($client, 1); }

    if ($albino_rats) {
my $hate_albino_rats = $albino_rats->CastToNPC();
$hate_albino_rats->AddToHateList($client, 1); }

    if ($black_rats) {
my $hate_black_rats = $black_rats->CastToNPC();
$hate_black_rats->AddToHateList($client, 1); }

    quest::stoptimer("rat_agro");
    quest::say("Testing Rat Agro Section!");
    quest::settimer("rat_adds",10); }
    
}

sub EVENT_COMBAT {

  if ($combat_state == 0) {
    quest::depopall(2700659);
    quest::depopall(2700660);
    quest::depopall(2700661);
    quest::stoptimer("rat_adds");
    quest::stoptimer("rat_agro");
  }

}

sub EVENT_DEATH {

$timestamp = localtime(time);

  quest::depopall(2700659);
  quest::depopall(2700660);
  quest::depopall(2700661);
  quest::stoptimer("rat_adds");
  quest::stoptimer("rat_agro");
  quest::shout2("SQUEEEEEEEK!");
  quest::write("bossdeaths.txt","[$timestamp]:Nightwhisker was killed by $name the $class.");

}
My Perl knowledge sucks heh.
__________________
Trevazar/Trevius Owner of: Storm Haven
Everquest Emulator FAQ (Frequently Asked Questions) - Read It!
Reply With Quote
  #2  
Old 08-01-2008, 06:52 AM
trevius's Avatar
trevius
Developer
 
Join Date: Aug 2006
Location: USA
Posts: 5,946
Default

Well, I tried quite a bit more experimenting, but still haven't found a good solution. So far, I tried moving the section highlighted in red in the post above to the EVENT_ATTACK section and then it was working. But, even there I have another issue with it. I am spawning 10 NPCs at a time, so I would like for it to send hate to all 10 of them, but it is only sending it to the nearest NPC for each of the 3 types.

I still can't figure out why it won't work in the timer section like I posted it. I even made static spawned versions of the NPCs and commented out the spawning part and it still does nothing and breaks the script at that point.

It seems like the section in question is actually just doing this below, but I dunno why I can't just put it in the way it is here:
$EntityList->GetMobByNpcTypeID(2700659)->CastToNPC()->AddToHateList($client, 1);
$EntityList->GetMobByNpcTypeID(2700660)->CastToNPC()->AddToHateList($client, 1);
$EntityList->GetMobByNpcTypeID(2700661)->CastToNPC()->AddToHateList($client, 1);

So, I need a way for it to send hate to ALL npcs with that same ID. Otherwise, I will have to make 30 (10 spawns with random chance to spawn 1 of 3 different types) different NPC IDs and make them all individuals, which I would prefer to avoid. And the only other thing I need is to figure out why it won't work in the section with the timer as I posted originally.

If someone knows a better way to send hate and do what I need, I am open to suggestions
__________________
Trevazar/Trevius Owner of: Storm Haven
Everquest Emulator FAQ (Frequently Asked Questions) - Read It!
Reply With Quote
  #3  
Old 08-01-2008, 07:15 AM
joligario's Avatar
joligario
Developer
 
Join Date: Mar 2003
Posts: 1,497
Default

Edit: Missread the script
Reply With Quote
  #4  
Old 08-01-2008, 07:16 AM
joligario's Avatar
joligario
Developer
 
Join Date: Mar 2003
Posts: 1,497
Default

Bah, won't stop adding posts..

Sorry.
Reply With Quote
  #5  
Old 08-01-2008, 07:22 AM
joligario's Avatar
joligario
Developer
 
Join Date: Mar 2003
Posts: 1,497
Default

Maybe using a signalwith to the NPCs with the name or id of the person attacking?
Reply With Quote
  #6  
Old 08-01-2008, 08:32 AM
So_1337
Dragon
 
Join Date: May 2006
Location: Cincinnati, OH
Posts: 689
Default

If it's only adding hate to one NPC of each type, is it possible that that's the problem and that it's actually coded that way? It can only signal one NPC of each type when it fires? I know Cazic only sends hate to his three golems, which each have unique NPC IDs, so it wouldn't be an issue that shows up there. And all of the linked mobs in ToV that I can think of have seperate names and NPC IDs (like Aaryonar and his guards, for example).

The only one I can think of that's comparable is Tunare. She has a whole slew of NPCs she adds hate to, but does it affect all of them, or just one? Can't say I've ever tested it fully. And I'd imagine that since mobs gain proximity aggro and assist one another, that it's never really mattered in that instance.

I would suggest that if it's working for one NPC of each type, to make sure you have them set to the same primary faction and that they're set to assist. It might be a little sloppier, but it will still get the same desired affect, I would reason. And maybe check Tunare's functionality to see if she's getting it to work where yours won't, for some reason.

Best of luck, wish I had more solid answers.
Reply With Quote
  #7  
Old 08-01-2008, 08:20 PM
Striat
Sarnak
 
Join Date: Aug 2006
Posts: 60
Default

You were calling for the npc to attack a client, but a client is not returned in a timer (does not check for client interaction!). So, you would have needed to add a $client = $npc->GetHateTop(); or something.

That still doesn't account for the other issue. Try this:

Code:
#Nightwhisker Fight

my $adds = undef;

sub EVENT_SPAWN {	#Not really needed.  Was for testing.
	quest::stoptimer("rat_adds");
	my $adds = 0;
	}

sub EVENT_COMBAT {

  if ($combat_state == 0) {
    quest::depopall(2700659);
    quest::depopall(2700660);
    quest::depopall(2700661);
    quest::stoptimer("rat_adds");
    quest::stoptimer("rat_agro");
  }

#Replaced event attack with:
  if ($combat_state == 1) {
  quest::stoptimer("rat_adds");
  quest::shout("Rats of Dreadsire, I call upon you! Come to my aid!");
  quest::settimer("rat_adds",10);
  }

}


sub EVENT_TIMER {

  if ($timer eq "rat_adds") {
    quest::stoptimer("rat_adds");

#the big chunk of change
for($adds = 0; $adds < 10; $adds++) {
   	quest::spawn2(quest::ChooseRandom(2700659,2700660,2700661),0,0, $x, $y, $z, 0);
	sethate();
	}
    	quest::say("Come! Come! Rid these halls of the humaniods!");
	$adds = 0;
    	quest::settimer("rat_adds",10); }
    
}


sub EVENT_DEATH {

$timestamp = localtime(time);

  quest::depopall(2700659);
  quest::depopall(2700660);
  quest::depopall(2700661);
  quest::stoptimer("rat_adds");
  quest::shout2("SQUEEEEEEEK!");
  quest::write("bossdeaths.txt","[$timestamp]:Nightwhisker was killed by $name the $class.");

}		

#added routine to process ALL npcs.
sub sethate {
	my $client = $npc->GetHateTop();

my $tiny_rats = $entity_list->GetMobByNpcTypeID(2700659);
my $albino_rats = $entity_list->GetMobByNpcTypeID(2700660);
my $black_rats = $entity_list->GetMobByNpcTypeID(2700661);

    if ($tiny_rats) {
my $hate_tiny_rats = $tiny_rats->CastToNPC();
$hate_tiny_rats->AddToHateList($client, 1); }

    if ($albino_rats) {
my $hate_albino_rats = $albino_rats->CastToNPC();
$hate_albino_rats->AddToHateList($client, 1); }

    if ($black_rats) {
my $hate_black_rats = $black_rats->CastToNPC();
$hate_black_rats->AddToHateList($client, 1); }

}
Technically, it could still have a problem or two so you could consider using an array and processing a loop for each npcspawn. While it is *technically* possible to run into a problem, you won't run into the potential problem with this script. Let me know if it works for you!
Reply With Quote
  #8  
Old 08-02-2008, 05:09 AM
trevius's Avatar
trevius
Developer
 
Join Date: Aug 2006
Location: USA
Posts: 5,946
Default

I wound up just going a simpler route. I couldn't get any other way to do it exactly the way I wanted it to. Basically I was wanting rats to come pouring into the room from 2 halls near the named. Which I think would look a bit cooler than just having them spawn right in the room.

No matter what I did, I couldn't get more than 3 of them to take the hate and come running. And even when they did, they were running through the walls instead of pathing like they are supposed to. So, the effect was lost.

Finally, I just decided to spawn them and then have each spawn use a quest to quest::moveto(); and head to the named. Once they are there, they will agro on the players instead of pathing back like they normally would using the command. Though, I wish quest::pathto() was actually working, cause then I could have them do exactly what I have been wanting. With the moveto, I wound up making it similar, but they pop closer by so they have a straight shot to the named and don't go through walls.

Code:
#Nightwhisker Fight

sub EVENT_SPAWN {

quest::stoptimer("rat_adds");

}

sub EVENT_TIMER {

  if ($timer eq "rat_adds") {
    quest::stoptimer("rat_adds");

    quest::spawn2(quest::ChooseRandom(2700659,2700660,2700661),0,0, 16.2, 3287.8, 18.1,62);
    quest::spawn2(quest::ChooseRandom(2700659,2700660,2700661),0,0, 15.7, 3301.6, 18.1,64);
    quest::spawn2(quest::ChooseRandom(2700659,2700660,2700661),0,0, 40.4, 3287.9, 18.1,62);
    quest::spawn2(quest::ChooseRandom(2700659,2700660,2700661),0,0, 38.4, 3301.8, 18.1,63);
    quest::spawn2(quest::ChooseRandom(2700659,2700660,2700661),0,0, 51.0, 3295.6, 18.1,64);
    
    quest::spawn2(quest::ChooseRandom(2700659,2700660,2700661),0,0, 166.1, 3428.4, 24.1,128);
    quest::spawn2(quest::ChooseRandom(2700659,2700660,2700661),0,0, 149.7, 3428.4, 24.1,124);
    quest::spawn2(quest::ChooseRandom(2700659,2700660,2700661),0,0, 151.5, 3398.2, 24.1,125);
    quest::spawn2(quest::ChooseRandom(2700659,2700660,2700661),0,0, 166.0, 3395.6, 24.1,128);
    quest::spawn2(quest::ChooseRandom(2700659,2700660,2700661),0,0, 159.3, 3371.6, 24.1,129);

    quest::say("Come! Come! Rid these halls of the humaniods!");
    quest::settimer("rat_adds",10); }
    
}

sub EVENT_COMBAT {

  if ($combat_state == 0) {
    quest::depopall(2700659);
    quest::depopall(2700660);
    quest::depopall(2700661);
    quest::stoptimer("rat_adds"); }
  
  if ($combat_state == 1) {
  quest::stoptimer("rat_adds");
  quest::shout("Rats of Dreadsire, I call upon you! Come to my aid!");
  quest::settimer("rat_adds",10); }
  
}

sub EVENT_DEATH {

$timestamp = localtime(time);

  quest::depopall(2700659);
  quest::depopall(2700660);
  quest::depopall(2700661);
  quest::stoptimer("rat_adds");
  quest::shout2("SQUEEEEEEEK!");
  quest::write("bossdeaths.txt","[$timestamp]:Nightwhisker was killed by $name the $class.");

}

Code:
#Nightwhisker Rat Adds

sub EVENT_SPAWN {
  
quest::moveto(158.7,3294.2,19.2)

}
__________________
Trevazar/Trevius Owner of: Storm Haven
Everquest Emulator FAQ (Frequently Asked Questions) - Read It!
Reply With Quote
  #9  
Old 08-09-2008, 07:49 PM
Neiv
Hill Giant
 
Join Date: May 2008
Location: Colorado
Posts: 238
Default

My opinion on this is worth less than nothing, but for the little it's worth:
Quote:
if ($timer eq "rat_agro")
Interestingly, when I tried "eq" in one of my $timer functions, it broke. But when I use "==" it works fine. Not saying this was the problem in your script; just that my script does not work when using "eq."
Reply With Quote
  #10  
Old 08-09-2008, 08:47 PM
trevius's Avatar
trevius
Developer
 
Join Date: Aug 2006
Location: USA
Posts: 5,946
Default

== is for numerical values and eq is for everything else.
__________________
Trevazar/Trevius Owner of: Storm Haven
Everquest Emulator FAQ (Frequently Asked Questions) - Read It!
Reply With Quote
  #11  
Old 08-09-2008, 09:36 PM
Neiv
Hill Giant
 
Join Date: May 2008
Location: Colorado
Posts: 238
Default

This is what I have on my player.pl
Quote:
if($timername == "aggro")
I tried eq and it does not work on this.
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 04:42 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