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-06-2012, 06:21 PM
chrismed0
Sarnak
 
Join Date: Aug 2010
Location: USA
Posts: 75
Default NPC Spawning another NPC

You will have to forgive me if I ask about some of these quest scripts. I can do basic quests but I have to ask about the more complex ones.

I was wanting to make an NPC spawn when another NPC comes in proximity of it.
Basicly like this:

NPC - "A" - stationary.
NPC - "B" - moves toward NPC "A"
When NPC "B" comes within "X" distance of NPC "A" it will spawn NPC "C" at desired location.

I see how it is done with PCs... that looks easy. But not sure what to use or how to write with NPCs.
Reply With Quote
  #2  
Old 10-06-2012, 08:36 PM
ChaosSlayerZ's Avatar
ChaosSlayerZ
Demi-God
 
Join Date: Mar 2009
Location: Umm
Posts: 1,492
Default

well I don't know how to track distance between 2 npcs, but you can go around that and track them from their path grid
In other words the B will be moving on pre-assigned grid path and when he hits the spot X the event will trigger.
This of course assuming that A is always in the same spot, or at least limited variation of A positions and corresponding B paths

spawning C is easy. it just:

quest::spawn2(int npc_type, int grid, int unused, float x, float y, float z, float heading);
Reply With Quote
  #3  
Old 10-06-2012, 08:43 PM
Akkadius's Avatar
Akkadius
Administrator
 
Join Date: Feb 2009
Location: MN
Posts: 2,072
Default

I'm being lazy with this by pasting a few year old example from one of my archives:

Reference the yellow text below pertaining to grabbing an entity based on it's NPC Type ID. You could do this from NPC B and check the distance between it and NPC A inside of a timer loop. Right now it is checking for x and y being within 50 units of each other, you can manipulate this example to your liking.

You may have to do this a bit different if you have several NPC's in the zone with the same type ID, you would have to iterate through an array to do the checking, I don't know your exact scenario.

Code:
sub EVENT_SAY{
	if($text=~/hail/i){
		plugin::UpdateTaskActivity("group", 157, 6, 1);
		my $Akkazia = $entity_list->GetNPCByNPCTypeID(3034686);
		my $AkkaziaX = $Akkazia->GetX();
		my $AkkaziaY = $Akkazia->GetY();
		my $AkkaziaZ = $Akkazia->GetZ();
		my $myX = $npc->GetX();
		my $myY = $npc->GetY();
		my $myZ = $npc->GetZ();
		if (abs($AkkaziaX - $myX) < 50 && abs($AkkaziaY - $myY) < 50 && !$Found) {
			plugin::ClientSay("You found my darling Akkazia! Thank you $name, you have made me so happy!");
			plugin::UpdateTaskActivity("group", 157, 7, 1);
			plugin::DoAnim("plead");
			quest::signalwith(3034686, 1);
			$Found = 1;
		}
		elsif($Found == 1){
			plugin::ClientSay("You found my darling Akkazia! Thank you $name, you have made me so happy!");
			plugin::DoAnim("plead");
		}
		else{
			plugin::ClientSay("Please find my baby! I haven't been able to find her!");
			plugin::DoAnim("plead");
		}
	}
}
Reply With Quote
  #4  
Old 10-07-2012, 04:00 AM
chrismed0
Sarnak
 
Join Date: Aug 2010
Location: USA
Posts: 75
Default

I so wish I knew more about more complex perl script. took me a few months to figure out how all the elements of MQ2 script writting worked but I got to where I could write really complex macros. This looks simular but there are different elements. The basic stuff is easy. cordanaites, timers and proximities looks a lot more complex so I may end up having alot more posts before I get it.

Having the NPC trigger a spawn at a waypoint sounds good. that may work out better then trying to set up stationary NPC.

The object of this is I have an npc_type on a grid that does nothing but a big circle. When hits one end of this circle it will trigger a spawn. When it hits the other side of the circle, eventualy, it will spawn a different NPC (both triggered spawn NPCs will be in the adjacent zone closest to the triggered location.)

I see the "EVENT_WAYPOINT_ARRIVE" event just don't know how to use it. I need more example of this stuff before I can figure out how it works and walk throughs if possible.
Reply With Quote
  #5  
Old 10-07-2012, 06:01 AM
lerxst2112
Demi-God
 
Join Date: Aug 2010
Posts: 1,743
Default

There are plenty of examples of how to use EVENT_WAYPOINT_ARRIVE in the existing quests, 139 of them to be exact. Several of them even spawn a mob at a particular waypoint.
Reply With Quote
  #6  
Old 10-07-2012, 10:03 AM
chrismed0
Sarnak
 
Join Date: Aug 2010
Location: USA
Posts: 75
Default

cool I will start combing through them and see what I find. I just hope I understand what I'm looking at LOL
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 08:41 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