Naviehs

Member
I am aware of the

ArrayList toEat = new ArrayList();
IPooledEnumerable eable = GetMobilesInRange(3);

foreach (Mobile m in eable)
{
[…]


But what if I wanted the mobile to pick a random target instead of "each of the mobile in range"?
I considered looking at tracking since its a similar system but I was wondering if someone had a better idea

Thank you!
 
Try something like this instead of foreach:

C#:
Mobile randomTarget = eable.RandomElementUsing<Mobile>(new Random())

This is untested, but the theory is sound.
 

Active Shards

  • Insane UO
    Endless Journey
    • Players
    • 96 Online
    • 128 Peak
  • UO Eventine
    Custom (Classic)
    • Players
    • 94 Online
    • 137 Peak
  • Unchained
    Custom (Classic)
    • Players
    • 83 Online
    • 273 Peak
  • The Crossroads
    Mondain's Legacy
    • Players
    • 41 Online
    • 190 Peak
  • Arth
    Custom (Modern)
    • Players
    • 41 Online
    • 48 Peak
  • UO Phoenix
    Custom (Classic)
    • Players
    • 28 Online
    • 48 Peak
  • UO Enigma
    Custom (Modern)
    • Players
    • 25 Online
    • 172 Peak
  • UO: Felucca
    Renaissance
    • Players
    • 18 Online
    • 87 Peak
  • Pandora
    Custom (Modern)
    • Players
    • 16 Online
    • 32 Peak
  • Heritage
    New Legacy
    • Players
    • 13 Online
    • 41 Peak

Donations

Total amount
$0.00
Goal
$500.00
Back