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!

Custom Monster Dropping Customer Arti at a %

peepeetree

Sorceror
Hey everyone,
I have spent about 4 hours doing searches through the forum here looking for a thread on explaining how to set up a custom created monster to drop an artifact at a %. So for example say I created a dragon that dropped a dragon dagger but only 1 out of 100 times. Can anyone point me to a thread that explains this or provide some guidance? Thanks a lot for any help I really appreciate it!
 

KISOR

Sorceror
Theres acouple ways you can do this one way is to add this under the taming min skill part not really sure what the % would be for 1 out of 100

if ( Utility.RandomDouble() < 0.01 )
PackItem( new DragonDagger() );

that code would probably make it where it could be stolen from the dragon heres another that would be on death add it under the public override void GenerateLoot() part


public override void OnDeath(Container c)
{
base.OnDeath(c);

if (Utility.RandomDouble() < 0.01)
{
switch (Utility.Random(1))
{
case 0: c.DropItem(new DragonDagger()); break;

}
}
}

the first code i got from CuSidhe.cs from how it drops its parrotitem
the second one was from a part of a sa monster i got from the old orb site

Theres also another way which is alot like the 2th way i posted if you have efreet.cs look at how it drops the daemonbone armor and copy the part and change random to 1 and // 1 to 4 and change the 0 one to the dragondagger
 

peepeetree

Sorceror
Thank you very much! I will work on this tomorrow and see if I can get it working, seriously this helps me out a TON!!
 

KISOR

Sorceror
I scripted a working dragon script up for you to look at to get better idea to where to add the things,
this is a PlatinumDragon its bigger then a normal dragon & is part of the Tokuno monsters so you should have the bodyvalue,
also if you have XmlSpawner you can add rare drops to anything without adding it to the script but i think adding it to script is little nicer,
If you have them you can type [add xmlspawner Dragon/ADD,0.01/DragonsDagger/ you can also change its Hue Bodyvalue add WeaponAbility & alot of other stuff with xmlspawner too, but anyway here is a code for an example platinumdragon hope its some help to give ideas to make yours with.

Code:
using System;
using Server;
using Server.Items;
 
namespace Server.Mobiles
{
    [CorpseName( "a platinum dragon corpse" )]
    public class PlatinumDragon : BaseCreature
    {
//        public override bool StatLossAfterTame { get { return true; } }
 
        [Constructable]
        public PlatinumDragon () : base( AIType.AI_Mage, FightMode.Closest, 10, 1, 0.3, 0.5 )
        {
            Name = "a platinum dragon";
            Body = 198;    // big dragon type from tokuno event on osi shards think
            Hue = 0;         // normal color
            BaseSoundID = 362;  // dragons sound
 
            SetStr( 1100, 1425 );
            SetDex( 100, 148 );
            SetInt( 500, 675 );
 
            SetHits( 1100, 2100 );
            SetMana( 150, 180 );
            SetStam( 120, 135 );
 
            SetDamage( 26, 33 );
 
            SetDamageType( ResistanceType.Physical, 80 );
            SetDamageType( ResistanceType.Fire, 20 );
 
            SetResistance( ResistanceType.Physical, 70, 85 );
            SetResistance( ResistanceType.Fire, 75, 90 );
            SetResistance( ResistanceType.Cold, 70, 85 );
            SetResistance( ResistanceType.Poison, 70, 80 );
            SetResistance( ResistanceType.Energy, 70, 85 );
 
            SetSkill( SkillName.Meditation, 80 );
            SetSkill( SkillName.EvalInt, 130.0, 140.0 );
            SetSkill( SkillName.Magery, 130.0, 140.0 );
            SetSkill( SkillName.Poisoning, 80 );
            SetSkill( SkillName.Anatomy, 80 );
            SetSkill( SkillName.MagicResist, 130.0, 145.0 );
            SetSkill( SkillName.Tactics, 130.0, 140.0 );
            SetSkill( SkillName.Wrestling, 130.0, 145.0 );
 
            Fame = 15000;
            Karma = -15000;
           
            VirtualArmor = 70;
 
            // ControlSlots = 5;
            // MinTameSkill = 120.0;
            Tamable = false;   // this is not tamable
 
        }
 
        public override void GenerateLoot()
        {
            AddLoot( LootPack.FilthyRich, 4 );
            AddLoot( LootPack.Gems, 8 );
 
//  THESE LINES Randomly ADD 1 or 2 DecoDragonsBlood in Its PACK when it spawns,
// if you don't have them change them to Dagger or ButcherKnife ,probably do have them,
            if ( Utility.RandomDouble() < 0.50 )
            PackItem( new DecoDragonsBlood2() );
 
                        if ( 0.50 > Utility.RandomDouble() )
                        PackItem( new DecoDragonsBlood() );
       
        }
 
//    ON DEATH DragonsDagger LINES START HERE
// your have to test the 0.01 i had it set to 0.10 when i tested
        public override void OnDeath(Container c)
        {
            base.OnDeath(c);
 
            if (Utility.RandomDouble() < 0.01)
            {
                switch (Utility.Random(1))
                {
                    case 0: c.DropItem(new DragonsDagger()); break;
 
                }
            }
        }       
//    ON DEATH DragonsDagger  LINES END HERE 
       
        public override bool ReacquireOnMovement{ get{ return !Controlled; } }
        public override bool HasBreath{ get{ return true; } }
// fire breath enabled THIS MIGHT HIT FOR ALOT OF DAMAGE
        public override bool AutoDispel{ get{ return !Controlled; } }
        public override int TreasureMapLevel{ get{ return 6; } }
        public override int Meat{ get{ return 19; } }
        public override int Hides{ get{ return 30; } }
        public override HideType HideType{ get{ return HideType.Barbed; } }
        public override int Scales{ get{ return 10; } }
        public override ScaleType ScaleType{ get{ return ( Body == 198 ? ScaleType.White : ScaleType.White ); } }
        public override FoodType FavoriteFood{ get{ return FoodType.Meat; } }
//        public override bool CanAngerOnTame { get { return true; } }
 
        public override WeaponAbility GetWeaponAbility()
        {
// THIS adds weapoabilitys set for bleed if ya want a different one // it & remove the other ones //
            return WeaponAbility.BleedAttack;
            // return WeaponAbility.ArmorIgnore;
            // return WeaponAbility.ConcussionBlow;
            // return WeaponAbility.CrushingBlow;
            // return WeaponAbility.Disarm;
            // return WeaponAbility.Dismount;
            // return WeaponAbility.DoubleStrike;
            // return WeaponAbility.MortalStrike;
            // return WeaponAbility.ParalyzingBlow;
            // return WeaponAbility.WhirlwindAttack;
        }
 
        public PlatinumDragon( 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();
        }
    }
}
 

peepeetree

Sorceror
That is WAY above and beyond, I can't thank you enough! This will help a ton in redoing all the dungeons and adding bosses to each floor.
 

peepeetree

Sorceror
So here is what I ended up coming up with, mind you I did borrow script code from other monsters created by other users for my first attempt. Not sure if the two are related but since I got the random drop code plugged in I notice that if I kill the dragon I can't move around well. It is almost like I am moving but the game has a massive delay, so after walking in place for 10 seconds I will suddenly seem like I warp across the screen.

Code:
using System;
using Server;
using Server.Items;
 
namespace Server.Mobiles
{
[CorpseName( "a acrid dragon corpse" )]
public class AcridDragon : BaseCreature
{
  [Constructable]
  public AcridDragon () : base( AIType.AI_Mage, FightMode.Closest, 10, 1, 0.2, 0.4 )
  {
  Name = "a Acrid dragon";
  Body = Utility.RandomList( 12, 59 );
  BaseSoundID = 362;
  Hue = 1426;
  SetStr( 900, 1000 );
  SetDex( 86, 105 );
  SetInt( 700, 850 );
  SetHits( 1750, 2000 );
  SetDamage( 40, 70 );
  SetDamageType( ResistanceType.Physical, 100 );
  SetResistance( ResistanceType.Physical, 75, 95 );
  SetResistance( ResistanceType.Fire, 100, 160 );
  SetResistance( ResistanceType.Cold, 75, 90 );
  SetResistance( ResistanceType.Poison, 200, 210 );
  SetResistance( ResistanceType.Energy, 35, 45 );
  SetSkill( SkillName.EvalInt, 30.1, 40.0 );
  SetSkill( SkillName.Magery, 35.1, 50.0 );
  SetSkill( SkillName.MagicResist, 99.1, 100.0 );
  SetSkill( SkillName.Tactics, 97.6, 100.0 );
  SetSkill( SkillName.Wrestling, 110.1, 120.5 );
 
  PackGold(45000, 60000);
 
  Fame = 55000;
  Karma = -55000;
  VirtualArmor = 90;
  Tamable = false;
  }
      public override void GenerateLoot()
        {
            AddLoot( LootPack.FilthyRich, 2 );
        }
 
//    ON DEATH DragonsDagger LINES START HERE
// your have to test the 0.01 i had it set to 0.01 when i tested
        public override void OnDeath(Container c)
        {
            base.OnDeath(c);
 
            if (Utility.RandomDouble() < 0.90)
            {
                switch (Utility.Random(1))
                {
                    case 0: c.DropItem(new AcridDagger()); break;
 
                }
            }
        }     
       
  public override bool ReacquireOnMovement{ get{ return !Controlled; } }
  public override bool HasBreath{ get{ return true; } } // fire breath enabled
  public override int BreathPoisonDamage{ get{ return 100; } }
  public override int BreathEffectHue{ get{ return 70; } }
  public override Poison HitPoison{ get{ return Poison.Deadly; } }
  public override Poison PoisonImmune{ get{ return Poison.Lethal; } }
  public override bool Unprovokable{ get{ return true; } }
  public override bool AutoDispel{ get{ return !Controlled; } }
  public override int TreasureMapLevel{ get{ return 4; } }
  public override int Meat{ get{ return 19; } }
  public override int Hides{ get{ return 20; } }
  public override HideType HideType{ get{ return HideType.Barbed; } }
  public override int Scales{ get{ return 7; } }
  public override ScaleType ScaleType{ get{ return ( Body == 12 ? ScaleType.Green : ScaleType.Green ); } }
  public override FoodType FavoriteFood{ get{ return FoodType.Meat; } }
  public override bool CanAngerOnTame { get { return true; } }
  public AcridDragon( 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();
        }
    }
}
 

peepeetree

Sorceror
I checked into this a bit more, it seems to be a bug with the client, I reinstalled my UO client and it worked fine for a couple of hours. I just added a second dragon, threw him into the game and I am having the same program again. Not sure what is causing this, but again I wanted to thank you for your help on putting this together!
 

KISOR

Sorceror
i just tested the acriddragon i didnt have the AcridDagger so i changed it to Dagger and it worked fine didn't have no lag after death maybe its the acriddagger does it lag you up if you type [add AcridDagger if it lags maybe post it too,
did you try to change in dragon to drop a Dagger just to see if it does the same thing when it dies?
also are you using runuo , orb2 or the new forkuo ? i am using orb2 if your using the runuo i don't know if the base.OnDeath(c); code i used will work right for it, might have to use this instead taken from the efreet.cs

public override void GenerateLoot()
{
AddLoot( LootPack.FilthyRich, 2 );

if ( 0.90 > Utility.RandomDouble() )
{
switch ( Utility.Random( 1 ) )
{
case 0: PackItem( new AcridDagger() ); break;

}
}
}

also the IceSerpent.cs has a ice blue staff as a rare you can try the way it drops it if this the one above lags too for you.
* JUST SEEN YOU REPLYED*
i am using the ml client patched to 7.0.23.1 i dont have any movable lag with monsters dieing which are you patched at?
 

peepeetree

Sorceror
Hey Kisor, yeah it seems to be some kind of bug with the client, if I replace the ultima.dll and cliloc file in my server it seems to run perfect for me again. Not sure what the problem is nor how to fix it but your script works great, I will try the new script just in case, I am using RunUO 2.2 along with client version 7.0.15.1 as I was told that 2.2 won't run with newer client versions. Thanks again!!
 
Top