Page 1 of 1

Wandering groups

Posted: Sun Aug 10, 2008 8:17 pm
by John Adams
Sorry, I know I have this posted somewhere else but cannot find it :( so I apologize if it's repetative.
But here's a possible solution to the "wandering hordes" like guards or patrols.
What if we bound an "invisible" object, tiny and pass-through, to the MoveToLocation scripts - then anyone associated with that NPC group simply follows that invisible man in formation?

Code: Select all

   [1]         [2]
        [inv]
   [3]         [4]
or something along those lines...

Posted: Sun Aug 10, 2008 9:42 pm
by paulgh
Is it possible to just select one member as the leader, and have the others follow it? In a quick test on live, I observed the following:
Hailed leader of a Qeynos guard patrol.
He stopped, but the others continued momentarily.
The others stopped after they had moved beyond a certain distance.
When the leader started up again, the others stayed in place momentarily, then headed after the leader.
So here is an idea. The leader follows the path. If the others can move, they attempt to move on the same heading as the leader, adjusting speed to maintain minimum and maximum distances.
What do you think?

Posted: Mon Aug 11, 2008 6:30 am
by John Adams
You are right, you hail the lead NPC and they all seem to stop... but if you hail a follower, the others keep going. I guess the concept is the same, though I was looking for that entity to hold "the balloon strings" to all the others in the group. If you also notice on live, the followers tend to fumble around back and forth sometimes finding their formation position.
However it is done, "formation" is probably the solution. Not so important today, just something to consider for post-Beta or something.

Posted: Fri Sep 12, 2008 6:09 pm
by John Adams
After literally staring at strolling guards in Live, I am concluding that there definitely is a "pilot" NPC, and the rest are merely tethered somehow. Take a 4-some of guards walking along. The lead guy walks along his route normally, while the other three around him bumble around, twist and swagger to find their footing or position or speed up to catch up if they lag behind.
I think we have a good idea how it works on live... now to figure out how to get our strolling groups to behave the same.

Posted: Fri Sep 12, 2008 6:11 pm
by LethalEncounter
I can do this, just not sure what priority this would be in.

Posted: Fri Sep 12, 2008 6:17 pm
by John Adams
Not high, I am just posting new findings.
Although, for the complete immersive feeling... ;)

Posted: Wed Nov 26, 2008 1:45 pm
by John Adams
I may have a solution to the "Follow the leader" business. Based on all the other feedback and hours of observation, tell me what you think of this.
Create a new LUA function called (for instance) MovementLoopAddFollow(NPC, SpawnGroup_ID, offset_x, offset_y, offset_z, speed, delay)
In this, tell the NPC to follow "SpawnGroup_ID" (since the leader *could* be a placeholder spawn) at an offset of x,y,z. Keep the standard speed and delay, in case you want to add more realism to their movements. The follower will pause if hailed, take care of business with whomever hailed it, then it will sprint back into formation behind the leader of the group at it's designated offset.
I think that will emulate the live functionality enough. Any thoughts?
As for priority; none. Just getting ideas on the table for when it's time. Or maybe someone else can pick up and code this LUA function ;)

Re: Wandering groups

Posted: Sat Feb 28, 2009 1:55 pm
by John Adams
I apparently lose track of the thousands of posts asking LE for everything under the sun, so I will attempt to do better at searching before posting again. :) Here is an old topic where we briefly talked about how best to implement "group" spawns following each other.

Since Scatman has gotten his hands dirty with LUA function writing, I thought I would ask him if he had any ideas on how to implement something like this. See LE's notes below.
LethalEncounter wrote:
John Adams wrote: For "packs" of NPCs (as I mentioned above) that move together - guards, enemy patrols, etc - could it be made easier to assign them a single script, and they just walk along together in formation based on their destination coords? Rather than give each and every NPC in formation movement commands...
I can see the need for group movement in the LUA code, but instead of adding a complex table to the database we handle it solely from the LUA scripts? IE instead of MovementLoopAddLocation(NPC, x, y, z, speed, delay), have a function called GroupMovementLoopAddLocation(Group Name, x, y, z, speed, delay). Group Name could be any string you wanted to describe the group and would make it a lot easier to keep track of rather than a group number. Have this function called from 1 script as many times as you would like for the locations. Then call a function called GroupMovementAddNPC(Group Name, NPC, x_offset, z_offset) for each NPC that comprises the group. The offsets would be the values added (or subtracted) from the x and z coords to keep them close to each other without overlapping.
So for the 'head' NPC's script:

Code: Select all

function spawn(NPC)
	GroupMovementLoopAddLocation("Queen Island Guards", 22.19, -6.86, 183.95, 2, 5)
	GroupMovementLoopAddLocation("Queen Island Guards", 30.76, -6.33, 196.28, 2, 5)
	GroupMovementLoopAddLocation("Queen Island Guards", 20.70, -6.85, 206.43, 2, 5)
	GroupMovementLoopAddLocation("Queen Island Guards", -.90, -5.47, 212.14, 2, 5)
	GroupMovementLoopAddLocation("Queen Island Guards", 2.35, -4.73, 196.93, 2, 5)
	GroupMovementAddNPC("Queen Island Guards", NPC, 0, 0)
end
For other NPCs in the same group:

Code: Select all

function spawn(NPC)
	GroupMovementAddNPC("Queen Island Guards", NPC, 2, 2)
end
function spawn(NPC)
	GroupMovementAddNPC("Queen Island Guards", NPC, -2, -2)
end
function spawn(NPC)
	GroupMovementAddNPC("Queen Island Guards", NPC, 2, 0)
end
If someone has a better idea, let me know.
What do you think, Scatman?

Re: Wandering groups

Posted: Sat Feb 28, 2009 2:45 pm
by Scatman
Sure, but we might need a separate function, or parameter, to specify the leader. Because depending on which spawn gets spawned first, the leader may change.

Re: Wandering groups

Posted: Sat Feb 28, 2009 4:00 pm
by Scatman
It's been getting longer and longer since I actively played EQ2, so does anyone remember exactly how groups work? What if the "leader" dies but the others do not? Do they keep moving without the leader? Or do they stop and wait for the leader to spawn? For some reason I remember the spawn party not respawning until every spawn associated with the party is dead. For example, a group of 4 spawns could be slimmed down to 2 (a player kills 2, then dies), and the remaining 2 stay spawned until they are killed.

Re: Wandering groups

Posted: Sat Feb 28, 2009 4:23 pm
by John Adams
Scat, I was not trying to get you to develop the spawn "parties" concept, just the LUA for tying wanderers to a single leader somehow ;), just in case you thought I was going for the other.


Any of my experiences with "grouped" spawns is, you attack one, they all attack you. If you die in the process, the remainder run back to their spawn/wander path. Sara tells me that, since she is an expert at getting her ass handed to her by groups of mobs, that they do not immediately respawn the ones you killed, but the respawn is much faster than other mobs in the area usually. So perhaps if it is a partial kill, the respawn timer is somehow manipulated.

I'm sure someone has a dev post up their sleeve they'll link here and solve the mystery. But that is just one players perspective... cuz rarely do you Revive next to the place you were slain, and the run back can be long enough to not really see what's happening.

Re: Wandering groups

Posted: Sat Feb 28, 2009 4:48 pm
by Scatman
Ya I know you werent. Even if you were, I'd laugh at you, shrug, and point to LE, because I wouldn't even know where to start with that :P But I do think the party movement loops would be closely related to spawn parties, so I was just trying to get a general understanding of how they worked on live.

Re: Wandering groups

Posted: Sat Feb 28, 2009 6:07 pm
by John Adams
When we both have time, we can log into Guk and go get our asses beat down. One of us stay behind to watch what the spawns do. :)

I vote that you die, while I live.

Re: Wandering groups

Posted: Sat Feb 28, 2009 6:52 pm
by Scatman
Fine, but only because I'm not a halfling. If I were a Halfling that'd be impossible since Halflings nevahhh die.