View Single Post
  #1  
Old 09-12-2003, 01:29 AM
Scorpious2k's Avatar
Scorpious2k
Demi-God
 
Join Date: Mar 2003
Location: USA
Posts: 1,067
Default NPC Grid Pause Bug

There is a bug in 4.4 that will cause roaming NPCs, moving along a grid to stop at a waypoint. Here is the fix we have put in at the Scorpious2k server.

The problem is in MovAI.CPP. In Mob::AI_Process() you find the following performed almost immediately on entry:

Code:
	if (AIwalking_timer->Check())
	{
		timercompleted=true;
		AIwalking_timer->Disable();
	}
the timer is disabled and the LOCAL variable timercompleted is set to true to indicate that the pause time is up and it is time for the mob to move.

The problem is that, because of other considerations, it may not get to the part of the function that gets the new waypoint, resets the timer to the new pause time and starts moving it.

The next time (and subsequent times) it will find the timer disabled and the local variable reset... so the mob will no longer move.

I considered several possible solutions to this problem. The timer does have to be disabled so that can't be removed. Finally I came up with this:

Find the line

Code:
			else if (roamer) 
		              {
and add the line
AIwalking_timer->Enable();

so it looks like this

Code:
	else if (roamer) 
	{
	    AIwalking_timer->Enable();
that will re-enable the timer and let the process continue. So far, this has worked perfectly for us (been testing it for 2 days so it may not be perfect).

I hope this helps.[/i][/b]
__________________
Maybe I should try making one of these servers...
Reply With Quote