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 adding Question

MrWalsh

Page
loot adding Question

Where would i be able to add my own drops with a percent on it and where am looking please. i know you can add a line into the mob cs but that will make it drop all the time.

Also where can i incrase the loot goods and Gold drop please
 

Hammerhand

Knight
Try adding your drops like this.
Code:
        public override bool OnBeforeDeath()
        {
              switch (Utility.Random(5))  
              {
                  case 0: PackItem(new YourItemHere());
                      break;
              }
              return base.OnBeforeDeath();
               }
This would give about a 1 in 5 or 20% chance of getting item. For more than 1 item, just add cases like so.
Code:
           public override bool OnBeforeDeath()
        {
            switch (Utility.Random(6))
            {
                case 0: PackItem(new YourItem()); break;
                case 1: PackItem(new Your2ndItem()); break;
                case 2: PackItem(new Your3rdItem()); break;
            }

            return base.OnBeforeDeath();
		}
Changing the Utility.Random number changes the precentage. Works for both blessed & non-blessed items and items dont appear in pack until mob dies.
 

MrWalsh

Page
do u heppen to know what line to add this at all sorry i did try it but it was placed in the wrong place..
 
I would think right before his loot packs are generated, but I could be wrong. (I've got a lot to learn about this stuff)


Code:
public override void GenerateLoot()

so above that line.


Also to answer other questions I see at the top you can edit your lootpack.cs for the various loot packs. I think there are something like 6-7 total. You can also edit the number of loot packs for each individual monster, and the types of loot packs they drop in the individual mob files. Do a search on lootpack.cs though and you'll probably find a lot of your answers.
 

Hammerhand

Knight
You can place it in the individual mobs scripts here..
Code:
		public override void GenerateLoot()
		{
            AddLoot(LootPack.SuperBoss, 2);
		}  [COLOR="Red"]<< Place after lootpack entry.[/COLOR]
        public override bool OnBeforeDeath()
        {
 

MrWalsh

Page
i tryed it after the loot pack area and just got a load of mess again could you show me in this dragon.cs please i am sorry about this i was thinking of following your random day and getting a set of armor in there

public override bool OnBeforeDeath()
{
switch (Utility.Random(6))
{
case 0: PackItem(new YourItem()); break;
case 1: PackItem(new Your2ndItem()); break;
case 2: PackItem(new Your3rdItem()); break;
}

return base.OnBeforeDeath();
}

sorry for the trouble
 

Attachments

  • Dragon.cs
    2.3 KB · Views: 12

Hammerhand

Knight
Ok, you'll find it from lines 54 to 64 in the Dragon.cs I'm posting back. What you'll need to do tho is change the sections in red here
Code:
        public override bool OnBeforeDeath()
        {
            switch (Utility.Random(6))
            {
                case 0: PackItem(new [COLOR="Red"]YourItem[/COLOR]()); break;
                case 1: PackItem(new [COLOR="red"]Your2ndItem[/COLOR]()); break;
                case 2: PackItem(new [COLOR="red"]Your3rdItem[/COLOR]()); break;
            }

            return base.OnBeforeDeath();
        }
to whatever you are wanting to drop. The case #'s must always start with 0, but you can have several of them. Just remember to change the # after the Random to reflect it.
Example:
You have 5 items you want the dragon to drop.
Code:
public override bool OnBeforeDeath()
{
switch (Utility.Random([COLOR="Blue"]10[/COLOR]))
{
case 0: PackItem(new [COLOR="Red"]YourItem[/COLOR]()); break;
case 1: PackItem(new [COLOR="red"]Your2ndItem[/COLOR]()); break;
case 2: PackItem(new [COLOR="red"]Your3rdItem[/COLOR]()); break;
case 3: PackItem(new [COLOR="red"]Your4thItem[/COLOR]());break;
case 4: PackItem(new [COLOR="red"]Your5thItem[/COLOR]());break;
}

return base.OnBeforeDeath();
}
The Blue #, combined with the 5 cases should give you about a 50% (or 1 in 2) chance of getting one of the 5 items. Just place the OnBeforeDeath setup after the GenerateLoot section. Just remember to change the ones in red to whatever you're wanting to drop. Best way to see how its done is to look at some of the custom scripts for mobs. Some use this method, others use the OnDeath method. Either one works and both keep the custom loot from appearing in the mobs pack until it dies, preventing the players from just stealing them.
 

Attachments

  • Dragon.cs
    2.7 KB · Views: 17

Hades1089

Traveler
k i tryed to do what u said here and i did everything i think correctly but come reason i am still getting errors here is the script maybe u can see y

PHP:
//////////////////////
//Created by : Hades//
//////////////////////
using System;
using Server;
using Server.Items;

namespace Server.Mobiles
{
	[CorpseName( "madusa's corpse" )]
	public class Madusa : BaseCreature
	{
   
		[Constructable]
		public Madusa() : base( AIType.AI_Mage, FightMode.Closest, 10, 1, 0.2, 0.4 )
		{
                        
			Name = "Madusa";
			Body = 87;
			BaseSoundID = 644;
			SetStr( 5000, 6000 );
			SetDex( 2000, 2500 );
			SetInt( 4000, 5000 );
			SetHits( 500000, 500000 );
			SetDamage( 100, 200 );
			SetDamageType( ResistanceType.Physical, 100 );
			SetResistance( ResistanceType.Physical, 10, 20 );
			SetResistance( ResistanceType.Fire, 80, 90 );
			SetResistance( ResistanceType.Cold, 80, 90 );
			SetResistance( ResistanceType.Poison, 100, 100 );
			SetResistance( ResistanceType.Energy, 80, 90 );
			SetSkill( SkillName.EvalInt, 90.1, 100.0 );
			SetSkill( SkillName.Magery, 90.1, 100.0 );
			SetSkill( SkillName.Meditation, 90.1, 100.0 );
			SetSkill( SkillName.MagicResist, 90.1, 100.0 );
			SetSkill( SkillName.Tactics, 100, 100 );
			SetSkill( SkillName.Wrestling, 100, 100 );

			Fame = 16000;
			Karma = -16000;

			VirtualArmor = 70;
                        
		}

		public override void GenerateLoot()
		{
			AddLoot( LootPack.Rich );
			AddLoot( LootPack.Average, 2 );
			AddLoot( LootPack.MedScrolls, 2 );
		}
                 public override bool OnBeforeDeath()
        {
            switch (Utility.Random(10))
            {
                case 0: PackItem(new wolfchest()); break;
                case 1: PackItem(new wolflegs()); break;
                case 2: PackItem(new wolfarms()); break;
                case 3: PackItem(new wolfhelm()); break;
                case 4: PackItem(new wolfgloves()); break;
                case 5: PackItem(new wolfgorget()); break;
                case 6: PackItem(new peacekeeper()); break;
                case 7: PackItem(new howlingwolfaxe()); break;
            }


            return base.OnBeforeDeath();
		}

		public override Poison PoisonImmune{ get{ return Poison.Greater; } }
		public override int TreasureMapLevel{ get{ return 4; } }
                public override bool AutoDispel{ get{ return true; } }
		public override bool Unprovokable{ get{ return true; } }
		public override OppositionGroup OppositionGroup
		{
			get{ return OppositionGroup.TerathansAndOphidians; }
		}

		public Madusa( Serial serial ) : base( serial )
		{
		}

		public override void Serialize( GenericWriter writer )
		{
			base.Serialize( writer );
			writer.Write( (int) 0 );
		}

		public override void Deserialize( GenericReader reader )
		{
			base.Deserialize( reader );
			int version = reader.ReadInt();
		}
	}
}
 

Hades1089

Traveler
k so i slept on it and figured this out and to give any1 else a heads up on if u have the same problem as me the error was that it couldnt find the items i tried to add to the random drop loot and to fix this u need to make sure u have the spelling exactly done right like for example in my script above i had to change

PHP:
case 0: PackItem(new wolfchest()); break;

to

PHP:
case 0: PackItem(new Wolfchest()); break;

i had to captatilize the word lol because in the script that it how it is done and this goes for the rest of the things on my list
 

Red4Minax

Sorceror
would any of you know a website or a post were it gives you a list of the name of how much money they drop i know a few like average, filthy rich but i need a whole list
 

serenityuo

Sorceror
so if I put a 2 in where the Blue number is, it will give it a 50/50 chance of dropping (one item)?

What if i put a 0? or a 99? would that give it a 99% chance of droppin? lol just curious on how that random number thingy works.
 
Top