Yes, I am trying to edit the treasuechestmod.cs file so only the treasure gets spawned and not the whole chest.
Why? Lets just say that I would like to put it in a certain spot and have it spawn there all the time. When it spawns, it may turn to one direction that what I want. My OCD is looking at this chest and just screaming at me to make it look right. This is where I need your help, I have been getting these errors when trying to do that:
+ Customs/treasures.cs:
CS1520: Line 17: Method must have a return type
CS1031: Line 17: Type expected
CS1520: Line 17: Method must have a return type
CS1031: Line 17: Type expected
CS1520: Line 18: Method must have a return type
CS1031: Line 18: Type expected
CS1520: Line 18: Method must have a return type
CS1031: Line 18: Type expected
CS1520: Line 19: Method must have a return type
CS1001: Line 19: Identifier expected
CS1520: Line 21: Method must have a return type
CS1001: Line 21: Identifier expected
CS1520: Line 22: Method must have a return type
CS1001: Line 22: Identifier expected
CS1520: Line 23: Method must have a return type
CS1001: Line 23: Identifier expected
CS1519: Line 25: Invalid token '>' in class, struct, or interface member declaration
CS1519: Line 25: Invalid token '--' in class, struct, or interface member declaration
CS1520: Line 26: Method must have a return type
CS1001: Line 26: Identifier expected
CS1518: Line 29: Expected class, delegate, enum, interface, or struct
CS1518: Line 33: Expected class, delegate, enum, interface, or struct
CS1518: Line 40: Expected class, delegate, enum, interface, or struct
CS1520: Line 51: Method must have a return type
CS1031: Line 51: Type expected
CS1520: Line 51: Method must have a return type
CS1031: Line 51: Type expected
CS1520: Line 52: Method must have a return type
CS1031: Line 52: Type expected
CS1520: Line 52: Method must have a return type
CS1031: Line 52: Type expected
CS1519: Line 53: Invalid token '(' in class, struct, or interface member declaration
CS1520: Line 55: Method must have a return type
CS1031: Line 55: Type expected
CS1520: Line 55: Method must have a return type
CS1002: Line 55: ; expected
CS1520: Line 56: Method must have a return type
CS1031: Line 56: Type expected
CS1520: Line 56: Method must have a return type
CS1002: Line 56: ; expected
CS1520: Line 57: Method must have a return type
CS1031: Line 57: Type expected
CS1520: Line 57: Method must have a return type
CS1002: Line 57: ; expected
CS1520: Line 58: Method must have a return type
CS1031: Line 58: Type expected
CS1520: Line 58: Method must have a return type
CS1002: Line 58: ; expected
CS1520: Line 59: Method must have a return type
CS1031: Line 59: Type expected
CS1520: Line 59: Method must have a return type
CS1002: Line 59: ; expected
CS1520: Line 60: Method must have a return type
CS1031: Line 60: Type expected
CS1520: Line 60: Method must have a return type
CS1002: Line 60: ; expected
CS0116: Line 62: A namespace cannot directly contain members such as fields or methods
CS1518: Line 64: Expected class, delegate, enum, interface, or struct
CS1518: Line 65: Expected class, delegate, enum, interface, or struct
CS1022: Line 66: Type or namespace definition, or end-of-file expected

Here is the code I have so far, which has stumped me:
Code:
// Treasure Chest Pack - Version 0.99I
// By Nerun

using Server;
using Server.Items;
using Server.Multis;
using Server.Network;
using System;

namespace Server.Items
{

// ---------- [Level 1] ----------
    public class Treasure1
    {
    DropItem(new Gold(30, 100));
    DropItem(new Bolt(10));
    DropItem(Loot.RandomClothing());

    AddLoot(Loot.RandomWeapon());
    AddLoot(Loot.RandomArmorOrShield());
    AddLoot(Loot.RandomJewelry());

        for (int i = Utility.Random(3) + 1; i > 0; i--) // random 1 to 3
            DropItem( Loot.RandomGem() );
    }

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

        public override void Serialize( GenericWriter writer )
        {
            base.Serialize( writer );

            writer.Write( (int) 0 ); // version
        }

        public override void Deserialize( GenericReader reader )
        {
            base.Deserialize( reader );

            int version = reader.ReadInt();
        }
    }

// ---------- [Level 1 Hybrid] ----------
    public class Treasure1h
    {
            DropItem( new Gold( 10, 40 ) );
            DropItem( new Bolt( 5 ) );
            switch ( Utility.Random( 6 ))
            {
                case 0: DropItem( new Candelabra()  ); break;
                case 1: DropItem( new Candle() ); break;
                case 2: DropItem( new CandleLarge() ); break;
                case 3: DropItem( new CandleLong() ); break;
                case 4: DropItem( new CandleShort() ); break;
                case 5: DropItem( new CandleSkull() ); break;
            }
            switch ( Utility.Random( 2 ))
            {
                case 0: DropItem( new Shoes( Utility.Random( 1, 2 ) ) ); break;
                case 1: DropItem( new Sandals( Utility.Random( 1, 2 ) ) ); break;
            }

            switch ( Utility.Random( 3 ))
            {
                case 0: DropItem( new BeverageBottle(BeverageType.Ale) ); break;
                case 1: DropItem( new BeverageBottle(BeverageType.Liquor) ); break;
                case 2: DropItem( new Jug(BeverageType.Cider) ); break;
            }

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

        public override void Serialize( GenericWriter writer )
        {
            base.Serialize( writer );

            writer.Write( (int) 0 ); // version
        }

        public override void Deserialize( GenericReader reader )
        {
            base.Deserialize( reader );

            int version = reader.ReadInt();
        }
    }

// ---------- [Level 2] ----------
    public class Treasure2
    {
            DropItem( new Gold( 70, 100 ) );
            DropItem( new Arrow( 10 ) );
            DropItem( Loot.RandomPotion() );
            for( int i = Utility.Random( 1, 2 ); i > 1; i-- )
            {
                Item ReagentLoot = Loot.RandomReagent();
                ReagentLoot.Amount = Utility.Random( 1, 2 );
                DropItem( ReagentLoot );
            }
            if (Utility.RandomBool()) //50% chance
                for (int i = Utility.Random(8) + 1; i > 0; i--)
                    DropItem(Loot.RandomScroll(0, 39, SpellbookType.Regular));

            if (Utility.RandomBool()) //50% chance
                for (int i = Utility.Random(6) + 1; i > 0; i--)
                    DropItem( Loot.RandomGem() );
        public Treasure2( Serial serial ) : base( serial )
        {
        }

        public override void Serialize( GenericWriter writer )
        {
            base.Serialize( writer );

            writer.Write( (int) 0 ); // version
        }

        public override void Deserialize( GenericReader reader )
        {
            base.Deserialize( reader );

            int version = reader.ReadInt();
        }
    }

// ---------- [Level 3] ----------
    public class Treasure3
    {
            DropItem( new Gold( 180, 240 ) );
            DropItem( new Arrow( 10 ) );

            for( int i = Utility.Random( 1, 3 ); i > 1; i-- )
            {
                Item ReagentLoot = Loot.RandomReagent();
                ReagentLoot.Amount = Utility.Random( 1, 9 );
                DropItem( ReagentLoot );
            }

            for ( int i = Utility.Random( 1, 3 ); i > 1; i-- )
                DropItem( Loot.RandomPotion() );

            if ( 0.67 > Utility.RandomDouble() ) //67% chance = 2/3
                for (int i = Utility.Random(12) + 1; i > 0; i--)
                    DropItem(Loot.RandomScroll(0, 47, SpellbookType.Regular));

            if ( 0.67 > Utility.RandomDouble() ) //67% chance = 2/3
                for (int i = Utility.Random(9) + 1; i > 0; i--)
                    DropItem( Loot.RandomGem() );

            for( int i = Utility.Random( 1, 3 ); i > 1; i-- )
                DropItem( Loot.RandomWand() );

            // Magical ArmorOrWeapon
            for( int i = Utility.Random( 1, 3 ); i > 1; i-- )
            {
                Item item = Loot.RandomArmorOrShieldOrWeapon();

                if (!Core.AOS)
                {
                    if (item is BaseWeapon)
                    {
                        BaseWeapon weapon = (BaseWeapon)item;
                        weapon.DamageLevel = (WeaponDamageLevel)Utility.Random(3);
                        weapon.AccuracyLevel = (WeaponAccuracyLevel)Utility.Random(3);
                        weapon.DurabilityLevel = (WeaponDurabilityLevel)Utility.Random(3);
                        weapon.Quality = WeaponQuality.Regular;
                    }
                    else if (item is BaseArmor)
                    {
                        BaseArmor armor = (BaseArmor)item;
                        armor.ProtectionLevel = (ArmorProtectionLevel)Utility.Random(3);
                        armor.Durability = (ArmorDurabilityLevel)Utility.Random(3);
                        armor.Quality = ArmorQuality.Regular;
                    }
                }
                else
                    AddLoot(item);
            }

            for( int i = Utility.Random( 1, 2 ); i > 1; i-- )
                AddLoot( Loot.RandomClothing() );

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

            // Magic clothing (not implemented)
           
            // Magic jewelry (not implemented)

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

        public override void Serialize( GenericWriter writer )
        {
            base.Serialize( writer );

            writer.Write( (int) 0 ); // version
        }

        public override void Deserialize( GenericReader reader )
        {
            base.Deserialize( reader );

            int version = reader.ReadInt();
        }
    }

// ---------- [Level 4] ----------
    public class Treasure4
    {
            DropItem( new Gold( 200, 400 ) );
            DropItem( new BlankScroll( Utility.Random( 1, 4 ) ) );
           
            for( int i = Utility.Random( 1, 4 ); i > 1; i-- )
            {
                Item ReagentLoot = Loot.RandomReagent();
                ReagentLoot.Amount = Utility.Random( 6, 12 );
                DropItem( ReagentLoot );
            }
   
            for ( int i = Utility.Random( 1, 4 ); i > 1; i-- )
                DropItem( Loot.RandomPotion() );
           
            if ( 0.75 > Utility.RandomDouble() ) //75% chance = 3/4
                for (int i = Utility.RandomMinMax(8,16); i > 0; i--)
                    DropItem(Loot.RandomScroll(0, 47, SpellbookType.Regular));

            if ( 0.75 > Utility.RandomDouble() ) //75% chance = 3/4
                for (int i = Utility.RandomMinMax(6,12) + 1; i > 0; i--)
                    DropItem( Loot.RandomGem() );

            for( int i = Utility.Random( 1, 4 ); i > 1; i-- )
                DropItem( Loot.RandomWand() );

            // Magical ArmorOrWeapon
            for( int i = Utility.Random( 1, 4 ); i > 1; i-- )
            {
                Item item = Loot.RandomArmorOrShieldOrWeapon();

                if (!Core.AOS)
                {
                    if (item is BaseWeapon)
                    {
                        BaseWeapon weapon = (BaseWeapon)item;
                        weapon.DamageLevel = (WeaponDamageLevel)Utility.Random(4);
                        weapon.AccuracyLevel = (WeaponAccuracyLevel)Utility.Random(4);
                        weapon.DurabilityLevel = (WeaponDurabilityLevel)Utility.Random(4);
                        weapon.Quality = WeaponQuality.Regular;
                    }
                    else if (item is BaseArmor)
                    {
                        BaseArmor armor = (BaseArmor)item;
                        armor.ProtectionLevel = (ArmorProtectionLevel)Utility.Random(4);
                        armor.Durability = (ArmorDurabilityLevel)Utility.Random(4);
                        armor.Quality = ArmorQuality.Regular;
                    }
                }
                else
                    AddLoot(item);
            }

            for( int i = Utility.Random( 1, 2 ); i > 1; i-- )
                AddLoot( Loot.RandomClothing() );
           
            for( int i = Utility.Random( 1, 2 ); i > 1; i-- )
                AddLoot( Loot.RandomJewelry() );
           
            DropItem( new MagicCrystalBall() );

            // Magic clothing (not implemented)
           
            // Magic jewelry (not implemented)
           
        public Treasure4( Serial serial ) : base( serial )
        {
        }

        public override void Serialize( GenericWriter writer )
        {
            base.Serialize( writer );

            writer.Write( (int) 0 ); // version
        }

        public override void Deserialize( GenericReader reader )
        {
            base.Deserialize( reader );

            int version = reader.ReadInt();
        }
    }

}

Appreciate any and all help.
 
I've fixed the errors ( I hope) But it won't compile cause of this public Treasure1(Serial serial) : base(serial)
you have to find what class you wanted to derive your treasure classes from, my guess is item(due to base(Serial s).

So to make it compile derive class from Item. Just add : Item
as so
public class Treasure1 : Item

Like I said I don't know how it's supposed to work.

What was wrong? Well you had just dumped the code right after your class declaration. Can't do that. Gotta add a method or constructor in which you add your code


Code:
// Treasure Chest Pack - Version 0.99I
// By Nerun
using Server;
using Server.Items;
using Server.Multis;
using Server.Network;
using System;

namespace Server.Items
{

    // ---------- [Level 1] ----------
    public class Treasure1
    {
        public Treasure1()
        {
            DropItem(new Gold(30, 100));
            DropItem(new Bolt(10));
            DropItem(Loot.RandomClothing());

            AddLoot(Loot.RandomWeapon());
            AddLoot(Loot.RandomArmorOrShield());
            AddLoot(Loot.RandomJewelry());

            for (int i = Utility.Random(3) + 1; i > 0; i--) // random 1 to 3
                DropItem(Loot.RandomGem());
        }

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

        public override void Serialize(GenericWriter writer)
        {
            base.Serialize(writer);

            writer.Write((int)0); // version
        }

        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);

            int version = reader.ReadInt();
        }
    }

    // ---------- [Level 1 Hybrid] ----------
    public class Treasure1h
    {
        public Treasure1h()
        {
            DropItem(new Gold(10, 40));
            DropItem(new Bolt(5));
            switch (Utility.Random(6))
            {
                case 0: DropItem(new Candelabra()); break;
                case 1: DropItem(new Candle()); break;
                case 2: DropItem(new CandleLarge()); break;
                case 3: DropItem(new CandleLong()); break;
                case 4: DropItem(new CandleShort()); break;
                case 5: DropItem(new CandleSkull()); break;
            }
            switch (Utility.Random(2))
            {
                case 0: DropItem(new Shoes(Utility.Random(1, 2))); break;
                case 1: DropItem(new Sandals(Utility.Random(1, 2))); break;
            }

            switch (Utility.Random(3))
            {
                case 0: DropItem(new BeverageBottle(BeverageType.Ale)); break;
                case 1: DropItem(new BeverageBottle(BeverageType.Liquor)); break;
                case 2: DropItem(new Jug(BeverageType.Cider)); break;
            }
        }

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

        public override void Serialize(GenericWriter writer)
        {
            base.Serialize(writer);

            writer.Write((int)0); // version
        }

        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);

            int version = reader.ReadInt();
        }
    }

    // ---------- [Level 2] ----------
    public class Treasure2
    {

        public Treasure2()
        {
            DropItem(new Gold(70, 100));
            DropItem(new Arrow(10));
            DropItem(Loot.RandomPotion());
            for (int i = Utility.Random(1, 2); i > 1; i--)
            {
                Item ReagentLoot = Loot.RandomReagent();
                ReagentLoot.Amount = Utility.Random(1, 2);
                DropItem(ReagentLoot);
            }
            if (Utility.RandomBool()) //50% chance
                for (int i = Utility.Random(8) + 1; i > 0; i--)
                    DropItem(Loot.RandomScroll(0, 39, SpellbookType.Regular));

            if (Utility.RandomBool()) //50% chance
                for (int i = Utility.Random(6) + 1; i > 0; i--)
                    DropItem(Loot.RandomGem());
        }
        public Treasure2(Serial serial) : base(serial)
        {
        }

        public override void Serialize(GenericWriter writer)
        {
            base.Serialize(writer);

            writer.Write((int)0); // version
        }

        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);

            int version = reader.ReadInt();
        }
    }

    // ---------- [Level 3] ----------
    public class Treasure3
    {
        public Treasure3()
        {
            DropItem(new Gold(180, 240));
            DropItem(new Arrow(10));

            for (int i = Utility.Random(1, 3); i > 1; i--)
            {
                Item ReagentLoot = Loot.RandomReagent();
                ReagentLoot.Amount = Utility.Random(1, 9);
                DropItem(ReagentLoot);
            }

            for (int i = Utility.Random(1, 3); i > 1; i--)
                DropItem(Loot.RandomPotion());

            if (0.67 > Utility.RandomDouble()) //67% chance = 2/3
                for (int i = Utility.Random(12) + 1; i > 0; i--)
                    DropItem(Loot.RandomScroll(0, 47, SpellbookType.Regular));

            if (0.67 > Utility.RandomDouble()) //67% chance = 2/3
                for (int i = Utility.Random(9) + 1; i > 0; i--)
                    DropItem(Loot.RandomGem());

            for (int i = Utility.Random(1, 3); i > 1; i--)
                DropItem(Loot.RandomWand());

            // Magical ArmorOrWeapon
            for (int i = Utility.Random(1, 3); i > 1; i--)
            {
                Item item = Loot.RandomArmorOrShieldOrWeapon();

                if (!Core.AOS)
                {
                    if (item is BaseWeapon)
                    {
                        BaseWeapon weapon = (BaseWeapon)item;
                        weapon.DamageLevel = (WeaponDamageLevel)Utility.Random(3);
                        weapon.AccuracyLevel = (WeaponAccuracyLevel)Utility.Random(3);
                        weapon.DurabilityLevel = (WeaponDurabilityLevel)Utility.Random(3);
                        weapon.Quality = WeaponQuality.Regular;
                    }
                    else if (item is BaseArmor)
                    {
                        BaseArmor armor = (BaseArmor)item;
                        armor.ProtectionLevel = (ArmorProtectionLevel)Utility.Random(3);
                        armor.Durability = (ArmorDurabilityLevel)Utility.Random(3);
                        armor.Quality = ArmorQuality.Regular;
                    }
                }
                else
                    AddLoot(item);
            }

            for (int i = Utility.Random(1, 2); i > 1; i--)
                AddLoot(Loot.RandomClothing());

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

            // Magic clothing (not implemented)

            // Magic jewelry (not implemented)
        }

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

        public override void Serialize(GenericWriter writer)
        {
            base.Serialize(writer);

            writer.Write((int)0); // version
        }

        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);

            int version = reader.ReadInt();
        }
    }

    // ---------- [Level 4] ----------
    public class Treasure4
    {
        public Treasure4()
        {
            DropItem(new Gold(200, 400));
            DropItem(new BlankScroll(Utility.Random(1, 4)));

            for (int i = Utility.Random(1, 4); i > 1; i--)
            {
                Item ReagentLoot = Loot.RandomReagent();
                ReagentLoot.Amount = Utility.Random(6, 12);
                DropItem(ReagentLoot);
            }

            for (int i = Utility.Random(1, 4); i > 1; i--)
                DropItem(Loot.RandomPotion());

            if (0.75 > Utility.RandomDouble()) //75% chance = 3/4
                for (int i = Utility.RandomMinMax(8, 16); i > 0; i--)
                    DropItem(Loot.RandomScroll(0, 47, SpellbookType.Regular));

            if (0.75 > Utility.RandomDouble()) //75% chance = 3/4
                for (int i = Utility.RandomMinMax(6, 12) + 1; i > 0; i--)
                    DropItem(Loot.RandomGem());

            for (int i = Utility.Random(1, 4); i > 1; i--)
                DropItem(Loot.RandomWand());

            // Magical ArmorOrWeapon
            for (int i = Utility.Random(1, 4); i > 1; i--)
            {
                Item item = Loot.RandomArmorOrShieldOrWeapon();

                if (!Core.AOS)
                {
                    if (item is BaseWeapon)
                    {
                        BaseWeapon weapon = (BaseWeapon)item;
                        weapon.DamageLevel = (WeaponDamageLevel)Utility.Random(4);
                        weapon.AccuracyLevel = (WeaponAccuracyLevel)Utility.Random(4);
                        weapon.DurabilityLevel = (WeaponDurabilityLevel)Utility.Random(4);
                        weapon.Quality = WeaponQuality.Regular;
                    }
                    else if (item is BaseArmor)
                    {
                        BaseArmor armor = (BaseArmor)item;
                        armor.ProtectionLevel = (ArmorProtectionLevel)Utility.Random(4);
                        armor.Durability = (ArmorDurabilityLevel)Utility.Random(4);
                        armor.Quality = ArmorQuality.Regular;
                    }
                }
                else
                    AddLoot(item);
            }

            for (int i = Utility.Random(1, 2); i > 1; i--)
                AddLoot(Loot.RandomClothing());

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

            DropItem(new MagicCrystalBall());

            // Magic clothing (not implemented)

            // Magic jewelry (not implemented)
        }

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

        public override void Serialize(GenericWriter writer)
        {
            base.Serialize(writer);

            writer.Write((int)0); // version
        }

        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);

            int version = reader.ReadInt();
        }
    }
}
 
Last night it got to me, I wanted to spawn the chest, leave the chest right where it's at, spawn the treasure inside, have that respawn, but the chest stays there. Then if I wanted to, I could add stuff to it.

I think you got it.
Like I said, last night, all of a sudden I needed to fix this so it would work. I may come to my senses in a day or two, but oh well.

Thanks.

But you are right, I can't get it to compile no how.

* * * * EDIT * * * *
I have, with much searching on ServUO, JustUO, XMLSpawner Forums, and searching for everything else, I have figured out how to use XMLSpawner for what I want. Admittedly it is the long way of doing things, but I like having a little control rather than trusting the "system" to spawn the treasure for me in any of my custom dungeons. Who knows, I may switch them all over.

Oh god, OCD is kicking in, time to sign off.
 
Last edited:
Back