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. |
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); |
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{ |
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. |
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.
|
cool I will start combing through them and see what I find. I just hope I understand what I'm looking at LOL
|
All times are GMT -4. The time now is 12:56 AM. |
Powered by vBulletin®, Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.