Thread: Target & Effect
View Single Post
Old 05-13-2008, 04:27 AM   #7 (permalink)
Peoharen
Account Terminated
 
Peoharen's Avatar
 
Join Date: Dec 2004
Location: USA
Age: 24
Posts: 911
Send a message via Yahoo to Peoharen
Default

1. No.

2.
Code:
		protected override void OnTarget( Mobile from, object o )
		{
			IPoint3D p = (IPoint3D)o;

			if ( p == null && from == null && from.Map == null )
				return;

			List<Mobile> targets = new List<Mobile>();

			foreach ( Mobile m in from.Map.GetMobilesInRange( new Point3D( p ), 1 ) )
				if ( m != null && m.AccessLevel == AccessLevel.Player )
					targets.Add( m );

			if ( targets.Count <= 0 )
				return;

			Mobile target = targets[Utility.Random( targets.Count )];

			if ( target == null )
				return;

			/* Your effects here */
		}
Change as needed for your range.

This randomly selects one mobile found within the range.
Peoharen is offline   Reply With Quote