Full Version : Modification for Ore Elementals
xmlspawner >>Scripts >>Modification for Ore Elementals


<< Prev | Next >>

Greystar- 03-26-2008
Well it's easier then one might think to get more from your Ore Elementals.

Keep in mind code references come from RunUO 2.0 RC2, but the theory should work for any version of RunUO.

First we need to make a slight change to OnCarve in BaseCreature

The following is an RC2 OnCarve
The red section is where we make changes to this script
CODE

 public virtual void OnCarve( Mobile from, Corpse corpse )
 {
  int feathers = Feathers;
  int wool = Wool;
  int meat = Meat;
  int hides = Hides;
  int scales = Scales;

  if ( (feathers == 0 && wool == 0 && meat == 0 && hides == 0 && scales == 0) || Summoned || IsBonded )
  {
[COLOR=red]    from.SendLocalizedMessage( 500485 ); // You see nothing useful to carve from the corpse.[/COLOR]   }
  else
  {
   if( Core.ML && from.Race == Race.Human )
   {
    hides = (int)Math.Ceiling( hides * 1.1 ); //10% Bonus Only applies to Hides, Ore & Logs
   }

   if ( corpse.Map == Map.Felucca )
   {
    feathers *= 2;
    wool *= 2;
    hides *= 2;
   }

   new Blood( 0x122D ).MoveToWorld( corpse.Location, corpse.Map );

   if ( feathers != 0 )
   {
    corpse.DropItem( new Feather( feathers ) );
    from.SendLocalizedMessage( 500479 ); // You pluck the bird. The feathers are now on the corpse.
   }

   if ( wool != 0 )
   {
    corpse.DropItem( new Wool( wool ) );
    from.SendLocalizedMessage( 500483 ); // You shear it, and the wool is now on the corpse.
   }

   if ( meat != 0 )
   {
    if ( MeatType == MeatType.Ribs )
     corpse.DropItem( new RawRibs( meat ) );
    else if ( MeatType == MeatType.Bird )
     corpse.DropItem( new RawBird( meat ) );
    else if ( MeatType == MeatType.LambLeg )
     corpse.DropItem( new RawLambLeg( meat ) );

    from.SendLocalizedMessage( 500467 ); // You carve some meat, which remains on the corpse.
   }

   if ( hides != 0 )
   {
    if ( HideType == HideType.Regular )
     corpse.DropItem( new Hides( hides ) );
    else if ( HideType == HideType.Spined )
     corpse.DropItem( new SpinedHides( hides ) );
    else if ( HideType == HideType.Horned )
     corpse.DropItem( new HornedHides( hides ) );
    else if ( HideType == HideType.Barbed )
     corpse.DropItem( new BarbedHides( hides ) );

    from.SendLocalizedMessage( 500471 ); // You skin it, and the hides are now in the corpse.
   }

   if ( scales != 0 )
   {
    ScaleType sc = this.ScaleType;

    switch ( sc )
    {
     case ScaleType.Red:  corpse.DropItem( new RedScales( scales ) ); break;
     case ScaleType.Yellow: corpse.DropItem( new YellowScales( scales ) ); break;
     case ScaleType.Black: corpse.DropItem( new BlackScales( scales ) ); break;
     case ScaleType.Green: corpse.DropItem( new GreenScales( scales ) ); break;
     case ScaleType.White: corpse.DropItem( new WhiteScales( scales ) ); break;
     case ScaleType.Blue: corpse.DropItem( new BlueScales( scales ) ); break;
     case ScaleType.All:
     {
      corpse.DropItem( new RedScales( scales ) );
      corpse.DropItem( new YellowScales( scales ) );
      corpse.DropItem( new BlackScales( scales ) );
      corpse.DropItem( new GreenScales( scales ) );
      corpse.DropItem( new WhiteScales( scales ) );
      corpse.DropItem( new BlueScales( scales ) );
      break;
     }
    }

    from.SendMessage( "You cut away some scales, but they remain on the corpse." );
   }

   corpse.Carved = true;

   if ( corpse.IsCriminalAction( from ) )
    from.CriminalAction( true );
  }
 }



see the section in blue that was changed.
CODE

 public virtual void OnCarve( Mobile from, Corpse corpse )
 {
  int feathers = Feathers;
  int wool = Wool;
  int meat = Meat;
  int hides = Hides;
  int scales = Scales;

  if ( (feathers == 0 && wool == 0 && meat == 0 && hides == 0 && scales == 0) || Summoned || IsBonded )
  {
[COLOR=blue]      if (this is DullCopperElemental || this is ShadowIronElemental || this is CopperElemental || this is BronzeElemental || this is GoldenElemental || this is AgapiteElemental || this is VeriteElemental || this is ValoriteElemental || this is EarthElemental)
      from.SendMessage("You carve some resources from the corpse.");
     else[/COLOR][COLOR=red]    from.SendLocalizedMessage( 500485 ); // You see nothing useful to carve from the corpse.[/COLOR]   }
  else
  {
/*<snip> removed irrelevent code */
 }

the following should be added to all the elementals I listed in BaseCreature. Alternatively you could leave out the base.OnCarver and put your sendmessage in each of the elementals instead.
CODE

 public override void OnCarve( Mobile from, Corpse corpse )
 {
  base.OnCarve(from, corpse);
  corpse.DropItem(new IronOre((this.Map == Map.Felucca ? 16 : 8)));//now I added some extra if you are in Felucca;
 }



You can do that for other mobiles as well, but I've just included the misc Earth/Ore elementals just because I've always wanted to know why you can't target them with a bladed item and get resources out of it.

Just replace the IronOre with each Elemental's ore you want to drop, or if you want them all to drop other items like gems or reagents or whatever.

Now if you don't want to do the changes in BaseCreature

I suggest the following

CODE

 public override void OnCarve( Mobile from, Corpse corpse )
 {
  from.SendMessage("You carve some Iron Ore from this Corpse."); //<<-- notice the Iron Ore comment.  You could change that to resources if you want to carve multiple items from the corpse.
  corpse.DropItem(new IronOre((this.Map == Map.Felucca ? 16 : 8)));//now I added some extra if you are in Felucca;
 }


That should be it for this quick little mod!

Greystar- 03-26-2008
Apparently color coding and Bold don't work here, but you get the picture.