View Single Post
  #1  
Old 09-21-2003, 12:59 PM
Scorpious2k's Avatar
Scorpious2k
Demi-God
 
Join Date: Mar 2003
Location: USA
Posts: 1,067
Default New NPC Wander Type

I have found the need in my work with the Scorpious2k Server for a different NPC wander type.

The type I have come up with I call single run. In this type, the NPC starts at waypoint 1 and travels in sequence to the last waypoint. When he reaches it, he depops and respawns (after the specified respawn time) to start again at waypoint 1.

In order to implement this wandertype, you MUST have installed the fixes I describe in http://www.eqemulator.net/forums/viewtopic.php?t=10204

Here are the changes. In mobAI.cpp Mob::CalculateNewWaypoint() after
Code:
	switch (wandertype)
	{
	case 0: //Circular
		if (reached_end)
			cur_wp = 0;
		else
			cur_wp = cur_wp + 1;
		break;
	case 1: //Random 5
		if (ranmax > 5)
			ranmax = 5;
		if (ranmax2 > 5)
			ranmax2 = 5;
		cur_wp = cur_wp + rand()%(ranmax+1) - rand()%(ranmax2+1);
		break;
	case 2: //Random
			cur_wp = (rand()%max_wp) + (rand()%2);
		break;
	case 3: //Patrol
		if (reached_end)
			patrol = 1;
		else if (reached_beginning)
			patrol = 0;
		if (patrol == 1)
			cur_wp = cur_wp - 1;
		else
			cur_wp = cur_wp + 1;
		break;
add
Code:
	case 4:	// single run
		cur_wp = cur_wp + 1;
		break;
in Mob::AI_Process() change the line (this is in the fix I gave for wandering bug fix)
Code:
								if (gridno < 50 && cur_wp == max_wp)
to read
Code:
							if (wandertype == 4 && cur_wp == max_wp)
That's it. You will now have wander type 4 - single run.

If I can find somewhere to host it, I will make the final version of this available for download.
__________________
Maybe I should try making one of these servers...
Reply With Quote