Go Back   RunUO - Ultima Online Emulation > RunUO > Modification Suggestions

Modification Suggestions This is where you can suggest a modifcation to RunUO!

Reply
 
Thread Tools Display Modes
Old 08-23-2007, 05:31 PM   #1 (permalink)
Forum Expert
 
pacolaco2's Avatar
 
Join Date: Mar 2005
Age: 17
Posts: 1,115
Send a message via AIM to pacolaco2 Send a message via MSN to pacolaco2 Send a message via Yahoo to pacolaco2
Default Mobile Waypoint Pathing..

A small thing I noticed when I was creating a script involving waypoints. If a monster is set on a waypoint, it will follow the exact path of the waypoints. Good good, all good, however, when the monster is attacked by an outside source (pet, player, other monster) it will continue to follow the path, and will not approach the player in order to melee.

This is the original code located in baseAI.cs which controls the waypoint pathing, line unknown since I've added above it.
Code:
			else if( m_Mobile.CurrentWayPoint != null )
			{
				WayPoint point = m_Mobile.CurrentWayPoint;
				if( (point.X != m_Mobile.Location.X || point.Y != m_Mobile.Location.Y) && point.Map == m_Mobile.Map && point.Parent == null && !point.Deleted )
				{
					m_Mobile.DebugSay( "I will move towards my waypoint." );
					DoMove( m_Mobile.GetDirectionTo( m_Mobile.CurrentWayPoint ) );
				}
				else if( OnAtWayPoint() )
				{
					m_Mobile.DebugSay( "I will go to the next waypoint" );
					m_Mobile.CurrentWayPoint = point.NextPoint;
					if( point.NextPoint != null && point.NextPoint.Deleted )
					m_Mobile.CurrentWayPoint = point.NextPoint = point.NextPoint.NextPoint;
				}
			}
I managed to 'fix' the script in my eyes, the monster will now respond to attacks correctly, and if the monster successfully wins the battle, will return to pathing on the waypoints at where it left off.

This is my 'fix':

Code:
			else if( m_Mobile.CurrentWayPoint != null )  //Addition
			{
				if( m_Mobile.Combatant == null )
				{
					WayPoint point = m_Mobile.CurrentWayPoint;
					if( (point.X != m_Mobile.Location.X || point.Y != m_Mobile.Location.Y) && point.Map == m_Mobile.Map && point.Parent == null && !point.Deleted )
					{
						m_Mobile.DebugSay( "I will move towards my waypoint." );
						DoMove( m_Mobile.GetDirectionTo( m_Mobile.CurrentWayPoint) );
					}
					else if( OnAtWayPoint() )
					{
						m_Mobile.DebugSay( "I will go to the next waypoint" );
						m_Mobile.CurrentWayPoint = point.NextPoint;
						if( point.NextPoint != null && point.NextPoint.Deleted )
						m_Mobile.CurrentWayPoint = point.NextPoint = point.NextPoint.NextPoint;
					}
				}
				else if( m_Mobile.Combatant != null )
					{
						Mobile c = m_Mobile.Combatant;

						if( c == null || c.Deleted || c.Map != m_Mobile.Map || !c.Alive || c.IsDeadBondedPet )
						{
							Action = ActionType.Wander;
						}
						else
						{
							m_Mobile.Direction = m_Mobile.GetDirectionTo( c );
							Action = ActionType.Combat;
						}
					}
			}
__________________
Vaughn Peterson,
Kate Maclellan,
Drew Cook,
William Soverino,
rest in peace.
pacolaco2 is offline   Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off



Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0 RC5