PDA

View Full Version : One way of getting waypoints with minimal fuss


Malevolent
04-15-2002, 01:42 AM
in glorious pseudo code for NPC::Process()

Setup a timer called something along the lines of "MoveMe".

if MoveMe->Check() then

1. find a mob that I would consider "friendly"
2. swap my origin coordinates to that of my friend, with a slight offset (rand()%5 on x,y)
3. set ismovinghome to true

--MV

theCoder
04-15-2002, 02:07 AM
I'm probably missing something, but doesn't that assume that the other mob is already at or near the home point? I guess that would get the mobs to clump together, but any mob that's supposed to be in a certain area (such as a guard) may get pulled away from its duties.

Malevolent
04-15-2002, 02:19 AM
I haven't really seen /much/ of a problem with mob clumping, it really depends on the rules that you use to verify who is considered a friend. 'course, I have code in there that has a continual struggle in the zone, so that too reduces this problem.

I have a few extra checks in there, some of which ask whether or not the level is high enough for the particular instance to move in the first place. If it isn't, then she ain't movin'.

It does assume that there are already mobs in the zone (which there are). It doesn't really matter if the other mob is at or near their home point, since I just call up their origin vector and tell mob A to move towards it (with a slight offset to reduce clump).

Is it dirty? Hell yes, but it works (for me).

As far as mob duties goes, that is a problem I have been fighting against for some of the 'tweaks' I've put in. I'm starting to think that NPC roles are (almost absolutely) necessary. Roles of Guard, Merchant, etc. that each have a set of predefined behaviors.

Guards, maybe, would rotate between their origins to create a "shift rotation" for their guard duty. Perhaps put even a few guards in the barracks, or in the tavern, to have the guards rotate in there.