Full Version : filled treasure chests
xmlspawner >>Scripts >>filled treasure chests


<< Prev | Next >>

ArteGordon- 07-06-2006
These are scripts for treasure chests that spawn locked, trapped, and filled with loot according to the general OSI standards for different levels of chests.
You can spawn them as

TreasureChestLevel1
TreasureChestLevel2
TreasureChestLevel3
TreasureChestLevel4
TreasureChestLevel5
TreasureChestLevel6

StarRyder- 09-27-2007
xmlspawner/lever2.gif
Was wondering can we get the lvl 5 , 6 to inthis spwaner ???

ArteGordon- 09-27-2007
sure, I'll add them in

StarRyder- 09-27-2007
Thx for fast replt Sir !!
2 Thumbs up

Erica- 02-26-2008
Nice just one problem when players unlock it and untrap it they open chest but cant take anything out of the chest says something like cant do that or cant move it its set to moveble false in chest.

ArteGordon- 02-26-2008
QUOTE (Erica @ February 26, 2008 08:04 am)
Nice just one problem when players unlock it and untrap it they open chest but cant take anything out of the chest says something like cant do that or cant move it its set to moveble false in chest.

that is a general issue with default unmovable container behavior in RunUO 2.0. You are forced to steal anything that is in an unmovable container.

To change that behavior you need to add this to the constructors

CODE

           // allow items to be lifted instead of stolen from containers
  LiftOverride = true;


I personally just have this in my BaseContainer constructor in Container.cs so that it applies to all containers, like this

CODE

 public BaseContainer( int itemID ) : base( itemID )
 {
           // allow items to be lifted instead of stolen from containers by default
  LiftOverride = true;
 }




but you can put it specifically in the treasure chest constructors if you only want it to apply to those.

Erica- 02-26-2008
Where would i add the lift in container script what line.

ArteGordon- 02-26-2008
the code from Scripts/Items/Containers/Container.cs that I posted is near the top, around line 40

Erica- 03-11-2008
Hi ArteGordon question i see that theres randomjewelry in treasure only thing im curious is instead of it giving a ring or bracelet with no stats on them how would i go about adding this in your treasurechest so it does add stats on the bracelet or ring ect ect.

ArteGordon- 03-13-2008
QUOTE (Erica @ March 11, 2008 02:41 pm)
Hi ArteGordon question i see that theres randomjewelry in treasure only thing im curious is instead of it giving a ring or bracelet with no stats on them how would i go about adding this in your treasurechest so it does add stats on the bracelet or ring ect ect.



The default Loot code doesnt implement random magic jewelry, but XmlSpawner does, so you could do it like this

In the treasure chest scripts change things like this

CODE

           // Jewelry
           for( int i = Utility.Random( 1, 2 ); i > 1; i-- )
               DropItem( Loot.RandomJewelry() );


to this
CODE

           // Jewelry
           for( int i = Utility.Random( 1, 2 ); i > 1; i-- )
               DropItem( BaseXmlSpawner.MagicJewelry(1,m_Level) );


which will drop random magic jewelry with the level of the attributes determined by the level of the treasure chest.

And add this to the top of the script as well

CODE

using Server.Mobiles;

Erica- 03-13-2008
QUOTE (ArteGordon @ March 13, 2008 06:32 am)
QUOTE (Erica @ March 11, 2008 02:41 pm)
Hi ArteGordon question i see that theres randomjewelry in treasure only thing im curious is instead of it giving a ring or bracelet with no stats on them how would i go about adding this in your treasurechest so it does add stats on the bracelet or ring ect ect.



The default Loot code doesnt implement random magic jewelry, but XmlSpawner does, so you could do it like this

In the treasure chest scripts change things like this

CODE

           // Jewelry
           for( int i = Utility.Random( 1, 2 ); i > 1; i-- )
               DropItem( Loot.RandomJewelry() );


to this
CODE

           // Jewelry
           for( int i = Utility.Random( 1, 2 ); i > 1; i-- )
               DropItem( BaseXmlSpawner.MagicJewelry(1,m_Level) );


which will drop random magic jewelry with the level of the attributes determined by the level of the treasure chest.

And add this to the top of the script as well

CODE

using Server.Mobiles;

Ok Thanks.

Greystar- 03-13-2008
Related Question... Since it's in RunUO for magic jewelry couldn't you just mod this to use the stuff from TreasureMapChest?

The following was in level 3.
CODE

           // According to OSI, loot in level 3 chest is:
           //  Gold 250 - 350
           //  Arrows 10
           //  Reagents
           //  Scrolls
           //  Potions
           //  Gems
           //  Magic Wand
           //  Magic weapon
           //  Magic armour
           //  Magic clothing  (not implemented)
           //  Magic jewelry  (not implemented)

ArteGordon- 03-13-2008
QUOTE (Greystar @ March 13, 2008 09:38 am)
Related Question... Since it's in RunUO for magic jewelry couldn't you just mod this to use the stuff from TreasureMapChest?

The following was in level 3.
CODE

           // According to OSI, loot in level 3 chest is:
           //  Gold 250 - 350
           //  Arrows 10
           //  Reagents
           //  Scrolls
           //  Potions
           //  Gems
           //  Magic Wand
           //  Magic weapon
           //  Magic armour
           //  Magic clothing  (not implemented)
           //  Magic jewelry  (not implemented)

yes, you could but this is how it is implemented in TreasureMapChest.cs

CODE

    else if ( item is BaseJewel )
    {
     int attributeCount;
     int min, max;

     GetRandomAOSStats( out attributeCount, out min, out max );

     BaseRunicTool.ApplyAttributesTo( (BaseJewel)item, attributeCount, min, max );

     cont.DropItem( item );
    }


which is exactly what this BaseXmlSpawner.MagicJewelry(1,m_Level)
method implements

from basexmlspawner.cs
CODE

       public static Item MagicJewelry(int minLevel, int maxLevel)
       {
           BaseCreature.Cap(ref minLevel, 0, 5);
           BaseCreature.Cap(ref maxLevel, 0, 5);
           if (Core.AOS)
           {
               Item item = Loot.RandomJewelry();

               if (item == null)
                   return null;

               int attributeCount, min, max;
               BaseCreature.GetRandomAOSStats(minLevel, maxLevel, out attributeCount, out min, out max);

               if (item is BaseJewel)
                   BaseRunicTool.ApplyAttributesTo((BaseJewel)item, attributeCount, min, max);

               return item;
           }
           else
           {
               Item jewel = Loot.RandomJewelry();

               return jewel;
           }
       }


So you could do it either way.

You wouldnt want to use the TreasureMapChest Fill method, because that puts in more than just normal treasure chest stuff.

Hanse46- 03-21-2008
I made the changes to containers as suggested and got this:

CODE

RunUO - [www.runuo.com] Version 2.0, Build 2959.20979
Core: Running on .NET Framework Version 2.0.50727
Core: Optimizing for 2 processors
Scripts: Compiling C# scripts...failed (1 errors, 0 warnings)
Errors:
+ Items/Containers/Container.cs:
   CS1518: Line 30: Expected class, delegate, enum, interface, or struct
   CS1518: Line 38: Expected class, delegate, enum, interface, or struct
   CS1518: Line 46: Expected class, delegate, enum, interface, or struct
   CS1518: Line 52: Expected class, delegate, enum, interface, or struct
   CS1518: Line 75: Expected class, delegate, enum, interface, or struct
   CS0116: Line 81: A namespace does not directly contain members such as field
s or methods
   CS1022: Line 84: Type or namespace definition, or end-of-file expected
Scripts: One or more scripts failed to compile or no script files were found.
- Press return to exit, or R to try again.


and here are the changes I made:

CODE

 public BaseContainer( int itemID ) : base( itemID )
 {
 // allow items to be lifted instead of stolen from containers by default
 LiftOverride = true;
}
 }


what did I do wrong?

ArteGordon- 03-21-2008
you have an extra bracket

QUOTE

public BaseContainer( int itemID ) : base( itemID )
{
// allow items to be lifted instead of stolen from containers by default
LiftOverride = true;
}  <--- get rid of this one
}