RunUO Community

This is a sample guest message. Register a free account today to become a member! Once signed in, you'll be able to participate on this site by adding your own topics and posts, as well as connect with other members through your own private inbox!

Loot Generation for EFreet wrong

~Adam Ant

Wanderer
Loot Generation for EFreet wrong

Code:
public override void GenerateLoot()
		{
			AddLoot( LootPack.Rich );
			AddLoot( LootPack.Average );
			AddLoot( LootPack.Gems );

			if ( 0.02 > Utility.RandomDouble() )
			{
				switch ( Utility.Random( 5 ) )
				{
					case 0:	PackItem( new DaemonArms() );	break;
					case 1:	PackItem( new DaemonChest() );	break;
					case 2:	PackItem( new DaemonGloves() );	break;
					case 3:	PackItem( new DaemonLegs() );	break;
					case 4:	PackItem( new DaemonHelm() );	break;
				}
			}
		}


The problem here is that GenerateLoot() is called twice; once at creature spawn time and again at death.
The LootPack calls are designed to handle this correctly, but the PackItem() calls aren't.

The end result is that the chance (0.02) to get Daemon armor happens twice, once at spawn time and once at death.

The way RunUO usually handled this is to put the lootPack calls in GenerateLoot() as shown here, but to add 'at spawn time drops' to the constructor.

Anywho, just a heads up.

PS. sorry if this isn't the correct forum..
 

Mark

Knight
You can check the m_Spawning variable inside GenerateLoot().

For example: if ( !m_Spawning && .02 > Utility.RandomDouble() )
 
Top