ServUO Version
Publish Unknown
Ultima Expansion
None
this is my paragon chest script.
paragon chest aren't taking random hue
any help would be much appreciative

paragon chest:
using System;
using System.Collections;
using Server;
using Server.Gumps;
using Server.Multis;
using Server.Network;
using Server.ContextMenus;
using Server.Engines.PartySystem;

namespace Server.Items
{
    [FlipableAttribute( 0x232A, 0x232B )]
    public class ParagonChest1 : LockableContainer
    {
        public override int LabelNumber{ get{ return 3000541; } }

        private static int[] m_ItemIDs = new int[]
        {
            0x232A, 0x232B
        };

        private static int[] m_Hues = new int[]
        {
            0x0, 0x455, 0x47E, 0x89F, 0x8A5, 0x8AB,
            0x966, 0x96D, 0x972, 0x973, 0x979, 0x481,
                        0x4FE, 0x4F8, 0x480, 0x489, 1780, 1970,
             2747, 2377, 2385, 2391, 2395, 2397, 1153,
            1154, 1167, 1177, 1174, 1152, 1, 1180,
            1179, 1178, 1198, 1199, 1081, 1067, 1087,
            1085, 1076, 1086, 1091, 1097, 1089, 1066,
            1096, 1083, 1090, 1093, 1062, 1078, 1069,
            1059, 1073, 1084, 1094, 1064, 1095, 1074,
            1070, 1092, 1068, 1088, 1065, 1082, 1060,
            1071, 1080, 1075, 1077, 1063, 1079, 1061,
            1100, 1101, 1150, 1167, 1151, 1161   
        };

        private string m_Name;

        [Constructable]
        public ParagonChest1( string name, int level ) : base( Utility.RandomList( m_ItemIDs ) )
        {
            m_Name = name;
            Hue = Utility.RandomList( 0x0, 0x455, 0x47E, 0x89F, 0x8A5, 0x8AB, 0x966, 0x96D, 0x972, 0x973, 0x979, 0x481, 0x4FE, 0x4F8, 0x480, 0x489, 1780,
            1970,2747, 2377, 2385, 2391, 2395, 2397, 1153, 1154, 1167, 1177, 1174, 1152, 1, 1180, 1179, 1178, 1198, 1199, 1081, 1067, 1087, 1085, 1076,
            1086, 1091, 1097, 1089, 1066, 1096, 1083, 1090, 1093, 1062, 1078, 1069, 1059, 1073, 1084, 1094, 1064, 1095, 1074,1070, 1092, 1068, 1088, 1065,
            1082, 1060, 1071, 1080, 1075, 1077, 1063, 1079, 1061, 1100, 1101, 1150, 1167, 1151, 1161 );
            Fill( level );
        }

        public override void OnSingleClick( Mobile from )
        {
            LabelTo( from, 1063449, m_Name );
        }

        public override void GetProperties( ObjectPropertyList list )
        {
            base.GetProperties( list );

            list.Add( 1063449, m_Name );
        }

        public override int DefaultGumpID{ get{ return 0x102; } }
        public override int DefaultDropSound{ get{ return 0x42; } }

        public override Rectangle2D Bounds
        {
            get{ return new Rectangle2D( 35, 10, 155, 85 ); }
        }

        private static void GetRandomAOSStats( out int attributeCount, out int min, out int max )
        {
            int rnd = Utility.Random( 15 );

            if ( rnd < 1 )
            {
                attributeCount = Utility.RandomMinMax( 2, 6 );
                min = 20; max = 70;
            }
            else if ( rnd < 3 )
            {
                attributeCount = Utility.RandomMinMax( 2, 4 );
                min = 20; max = 50;
            }
            else if ( rnd < 6 )
            {
                attributeCount = Utility.RandomMinMax( 2, 3 );
                min = 20; max = 40;
            }
            else if ( rnd < 10 )
            {
                attributeCount = Utility.RandomMinMax( 1, 2 );
                min = 10; max = 30;
            }
            else
            {
                attributeCount = 1;
                min = 10; max = 20;
            }
        }

        private void Fill( int level )
        {
            TrapType = TrapType.ExplosionTrap;
            TrapPower = level * 25;
            Locked = true;

            switch ( level )
            {
                case 1: RequiredSkill = 36; break;
                case 2: RequiredSkill = 76; break;
                case 3: RequiredSkill = 84; break;
                case 4: RequiredSkill = 92; break;
                case 5: RequiredSkill = 100; break;
            }

            LockLevel = RequiredSkill - 10;
            MaxLockLevel = RequiredSkill + 40;

            DropItem( new Gold( level * 200 ) );

            for ( int i = 0; i < level; ++i )
                DropItem( Loot.RandomScroll( 0, 63, SpellbookType.Regular ) );

            for ( int i = 0; i < level * 2; ++i )
            {
                Item item;

                if ( Core.AOS )
                    item = Loot.RandomArmorOrShieldOrWeaponOrJewelry();
                else
                    item = Loot.RandomArmorOrShieldOrWeapon();

                if ( item is BaseWeapon )
                {
                    BaseWeapon weapon = (BaseWeapon)item;

                    if ( Core.AOS )
                    {
                        int attributeCount;
                        int min, max;

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

                        BaseRunicTool.ApplyAttributesTo( weapon, attributeCount, min, max );
                    }
                    else
                    {
                        weapon.DamageLevel = (WeaponDamageLevel)Utility.Random( 6 );
                        weapon.AccuracyLevel = (WeaponAccuracyLevel)Utility.Random( 6 );
                        weapon.DurabilityLevel = (WeaponDurabilityLevel)Utility.Random( 6 );
                    }

                    DropItem( item );
                }
                else if ( item is BaseArmor )
                {
                    BaseArmor armor = (BaseArmor)item;

                    if ( Core.AOS )
                    {
                        int attributeCount;
                        int min, max;

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

                        BaseRunicTool.ApplyAttributesTo( armor, attributeCount, min, max );
                    }
                    else
                    {
                        armor.ProtectionLevel = (ArmorProtectionLevel)Utility.Random( 6 );
                        armor.Durability = (ArmorDurabilityLevel)Utility.Random( 6 );
                    }

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

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

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

                    DropItem( item );
                }
            }

            for ( int i = 0; i < level; i++ )
            {
                Item item = Loot.RandomPossibleReagent();
                item.Amount = Utility.RandomMinMax( 40, 60 );
                DropItem( item );
            }

            for ( int i = 0; i < level; i++ )
            {
                Item item = Loot.RandomGem();
                DropItem( item );
            }

            DropItem( new TreasureMap( level + 1, ( Utility.RandomBool() ? Map.Felucca : Map.Trammel ) ) );
        }

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

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

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

            writer.Write( m_Name );
        }

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

            int version = reader.ReadInt();

            m_Name = reader.ReadString();
        }
    }
}
 
Not sure if this was ment for your testing, but for starters to not work on 2 arrays:
Code:
Hue = Utility.RandomList(m_Hues);[code]

Now does the hue always stay 0?
 
yes that was for testing.
This is my original script and yes its staying at 0.

paragon chest:
using System;
using System.Collections;
using Server;
using Server.Gumps;
using Server.Multis;
using Server.Network;
using Server.ContextMenus;
using Server.Engines.PartySystem;

namespace Server.Items
{
    [FlipableAttribute( 0x232A, 0x232B )]
    public class ParagonChest1 : LockableContainer
    {
        public override int LabelNumber{ get{ return 3000541; } }

        private static int[] m_ItemIDs = new int[]
        {
            0x232A, 0x232B
        };

        private static int[] m_Hues = new int[]
        {
            0x0, 0x455, 0x47E, 0x89F, 0x8A5, 0x8AB,
            0x966, 0x96D, 0x972, 0x973, 0x979, 0x481,
                        0x4FE, 0x4F8, 0x480, 0x489, 1780, 1970,
             2747, 2377, 2385, 2391, 2395, 2397, 1153,
            1154, 1167, 1177, 1174, 1152, 1, 1180,
            1179, 1178, 1198, 1199, 1081, 1067, 1087,
            1085, 1076, 1086, 1091, 1097, 1089, 1066,
            1096, 1083, 1090, 1093, 1062, 1078, 1069,
            1059, 1073, 1084, 1094, 1064, 1095, 1074,
            1070, 1092, 1068, 1088, 1065, 1082, 1060,
            1071, 1080, 1075, 1077, 1063, 1079, 1061,
            1100, 1101, 1150, 1167, 1151, 1161  
        };

        private string m_Name;

        [Constructable]
        public ParagonChest1( string name, int level ) : base( Utility.RandomList( m_ItemIDs ) )
        {
            m_Name = name;
            Hue = Utility.RandomList( m_Hues );
            Fill( level );
        }

        public override void OnSingleClick( Mobile from )
        {
            LabelTo( from, 1063449, m_Name );
        }

        public override void GetProperties( ObjectPropertyList list )
        {
            base.GetProperties( list );

            list.Add( 1063449, m_Name );
        }

        public override int DefaultGumpID{ get{ return 0x102; } }
        public override int DefaultDropSound{ get{ return 0x42; } }

        public override Rectangle2D Bounds
        {
            get{ return new Rectangle2D( 35, 10, 155, 85 ); }
        }

        private static void GetRandomAOSStats( out int attributeCount, out int min, out int max )
        {
            int rnd = Utility.Random( 15 );

            if ( rnd < 1 )
            {
                attributeCount = Utility.RandomMinMax( 2, 6 );
                min = 20; max = 70;
            }
            else if ( rnd < 3 )
            {
                attributeCount = Utility.RandomMinMax( 2, 4 );
                min = 20; max = 50;
            }
            else if ( rnd < 6 )
            {
                attributeCount = Utility.RandomMinMax( 2, 3 );
                min = 20; max = 40;
            }
            else if ( rnd < 10 )
            {
                attributeCount = Utility.RandomMinMax( 1, 2 );
                min = 10; max = 30;
            }
            else
            {
                attributeCount = 1;
                min = 10; max = 20;
            }
        }

        private void Fill( int level )
        {
            TrapType = TrapType.ExplosionTrap;
            TrapPower = level * 25;
            Locked = true;

            switch ( level )
            {
                case 1: RequiredSkill = 36; break;
                case 2: RequiredSkill = 76; break;
                case 3: RequiredSkill = 84; break;
                case 4: RequiredSkill = 92; break;
                case 5: RequiredSkill = 100; break;
            }

            LockLevel = RequiredSkill - 10;
            MaxLockLevel = RequiredSkill + 40;

            DropItem( new Gold( level * 200 ) );

            for ( int i = 0; i < level; ++i )
                DropItem( Loot.RandomScroll( 0, 63, SpellbookType.Regular ) );

            for ( int i = 0; i < level * 2; ++i )
            {
                Item item;

                if ( Core.AOS )
                    item = Loot.RandomArmorOrShieldOrWeaponOrJewelry();
                else
                    item = Loot.RandomArmorOrShieldOrWeapon();

                if ( item is BaseWeapon )
                {
                    BaseWeapon weapon = (BaseWeapon)item;

                    if ( Core.AOS )
                    {
                        int attributeCount;
                        int min, max;

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

                        BaseRunicTool.ApplyAttributesTo( weapon, attributeCount, min, max );
                    }
                    else
                    {
                        weapon.DamageLevel = (WeaponDamageLevel)Utility.Random( 6 );
                        weapon.AccuracyLevel = (WeaponAccuracyLevel)Utility.Random( 6 );
                        weapon.DurabilityLevel = (WeaponDurabilityLevel)Utility.Random( 6 );
                    }

                    DropItem( item );
                }
                else if ( item is BaseArmor )
                {
                    BaseArmor armor = (BaseArmor)item;

                    if ( Core.AOS )
                    {
                        int attributeCount;
                        int min, max;

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

                        BaseRunicTool.ApplyAttributesTo( armor, attributeCount, min, max );
                    }
                    else
                    {
                        armor.ProtectionLevel = (ArmorProtectionLevel)Utility.Random( 6 );
                        armor.Durability = (ArmorDurabilityLevel)Utility.Random( 6 );
                    }

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

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

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

                    DropItem( item );
                }
            }

            for ( int i = 0; i < level; i++ )
            {
                Item item = Loot.RandomPossibleReagent();
                item.Amount = Utility.RandomMinMax( 40, 60 );
                DropItem( item );
            }

            for ( int i = 0; i < level; i++ )
            {
                Item item = Loot.RandomGem();
                DropItem( item );
            }

            DropItem( new TreasureMap( level + 1, ( Utility.RandomBool() ? Map.Felucca : Map.Trammel ) ) );
        }

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

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

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

            writer.Write( m_Name );
        }

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

            int version = reader.ReadInt();

            m_Name = reader.ReadString();
        }
    }
}
 
Maybe try something along the lines of
C#:
m_Hue = Utility.RandomMinMax(0x0, 0x489);
with your hue #'s in place of these. I did this on a mob a while back & it gave it the ability to spawn in any hue within that range.
 
paragon chest:
using System;
using System.Collections;
using Server;
using Server.Gumps;
using Server.Multis;
using Server.Network;
using Server.ContextMenus;
using Server.Engines.PartySystem;

namespace Server.Items
{
    [FlipableAttribute( 0x232A, 0x232B )]
    public class ParagonChest1 : LockableContainer
    {
        public override int LabelNumber{ get{ return 3000541; } }

        private static int[] m_ItemIDs = new int[]
        {
            0x232A, 0x232B
        };

        private static int[] m_Hues = new int[]
        {
            0x0, 0x455, 0x47E, 0x89F, 0x8A5, 0x8AB,
            0x966, 0x96D, 0x972, 0x973, 0x979, 0x481,
                        0x4FE, 0x4F8, 0x480, 0x489, 1780, 1970,
             2747, 2377, 2385, 2391, 2395, 2397, 1153,
            1154, 1167, 1177, 1174, 1152, 1, 1180,
            1179, 1178, 1198, 1199, 1081, 1067, 1087,
            1085, 1076, 1086, 1091, 1097, 1089, 1066,
            1096, 1083, 1090, 1093, 1062, 1078, 1069,
            1059, 1073, 1084, 1094, 1064, 1095, 1074,
            1070, 1092, 1068, 1088, 1065, 1082, 1060,
            1071, 1080, 1075, 1077, 1063, 1079, 1061,
            1100, 1101, 1150, 1167, 1151, 1161   
        };

        private string m_Name;

        [Constructable]
        public ParagonChest1( string name, int level ) : base( Utility.RandomList( m_ItemIDs ) )
        {
            m_Name = name;
        m_Hue = Utility.RandomMinMax(0x0, 0x455, 0x47E, 0x89F, 0x8A5, 0x8AB, 0x966, 0x96D, 0x972, 0x973, 0x979, 0x481, 0x4FE, 0x4F8, 0x480, 0x489, 1780, 1970,
         2747, 2377, 2385, 2391, 2395, 2397, 1153, 1154, 1167, 1177, 1174, 1152, 1, 1180, 1179, 1178, 1198, 1199, 1081, 1067, 1087, 1085, 1076, 1086, 1091, 1097, 1089, 1066,
        1096, 1083, 1090, 1093, 1062, 1078, 1069, 1059, 1073, 1084, 1094, 1064, 1095, 1074, 1070, 1092, 1068, 1088, 1065, 1082, 1060, 1071, 1080, 1075, 1077, 1063, 1079, 1061,
        1100, 1101, 1150, 1167, 1151, 1161);
            Fill( level );
        }

        public override void OnSingleClick( Mobile from )
        {
            LabelTo( from, 1063449, m_Name );
        }

        public override void GetProperties( ObjectPropertyList list )
        {
            base.GetProperties( list );

            list.Add( 1063449, m_Name );
        }

        public override int DefaultGumpID{ get{ return 0x102; } }
        public override int DefaultDropSound{ get{ return 0x42; } }

        public override Rectangle2D Bounds
        {
            get{ return new Rectangle2D( 35, 10, 155, 85 ); }
        }

        private static void GetRandomAOSStats( out int attributeCount, out int min, out int max )
        {
            int rnd = Utility.Random( 15 );

            if ( rnd < 1 )
            {
                attributeCount = Utility.RandomMinMax( 2, 6 );
                min = 20; max = 70;
            }
            else if ( rnd < 3 )
            {
                attributeCount = Utility.RandomMinMax( 2, 4 );
                min = 20; max = 50;
            }
            else if ( rnd < 6 )
            {
                attributeCount = Utility.RandomMinMax( 2, 3 );
                min = 20; max = 40;
            }
            else if ( rnd < 10 )
            {
                attributeCount = Utility.RandomMinMax( 1, 2 );
                min = 10; max = 30;
            }
            else
            {
                attributeCount = 1;
                min = 10; max = 20;
            }
        }

        private void Fill( int level )
        {
            TrapType = TrapType.ExplosionTrap;
            TrapPower = level * 25;
            Locked = true;

            switch ( level )
            {
                case 1: RequiredSkill = 36; break;
                case 2: RequiredSkill = 76; break;
                case 3: RequiredSkill = 84; break;
                case 4: RequiredSkill = 92; break;
                case 5: RequiredSkill = 100; break;
            }

            LockLevel = RequiredSkill - 10;
            MaxLockLevel = RequiredSkill + 40;

            DropItem( new Gold( level * 200 ) );

            for ( int i = 0; i < level; ++i )
                DropItem( Loot.RandomScroll( 0, 63, SpellbookType.Regular ) );

            for ( int i = 0; i < level * 2; ++i )
            {
                Item item;

                if ( Core.AOS )
                    item = Loot.RandomArmorOrShieldOrWeaponOrJewelry();
                else
                    item = Loot.RandomArmorOrShieldOrWeapon();

                if ( item is BaseWeapon )
                {
                    BaseWeapon weapon = (BaseWeapon)item;

                    if ( Core.AOS )
                    {
                        int attributeCount;
                        int min, max;

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

                        BaseRunicTool.ApplyAttributesTo( weapon, attributeCount, min, max );
                    }
                    else
                    {
                        weapon.DamageLevel = (WeaponDamageLevel)Utility.Random( 6 );
                        weapon.AccuracyLevel = (WeaponAccuracyLevel)Utility.Random( 6 );
                        weapon.DurabilityLevel = (WeaponDurabilityLevel)Utility.Random( 6 );
                    }

                    DropItem( item );
                }
                else if ( item is BaseArmor )
                {
                    BaseArmor armor = (BaseArmor)item;

                    if ( Core.AOS )
                    {
                        int attributeCount;
                        int min, max;

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

                        BaseRunicTool.ApplyAttributesTo( armor, attributeCount, min, max );
                    }
                    else
                    {
                        armor.ProtectionLevel = (ArmorProtectionLevel)Utility.Random( 6 );
                        armor.Durability = (ArmorDurabilityLevel)Utility.Random( 6 );
                    }

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

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

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

                    DropItem( item );
                }
            }

            for ( int i = 0; i < level; i++ )
            {
                Item item = Loot.RandomPossibleReagent();
                item.Amount = Utility.RandomMinMax( 40, 60 );
                DropItem( item );
            }

            for ( int i = 0; i < level; i++ )
            {
                Item item = Loot.RandomGem();
                DropItem( item );
            }

            DropItem( new TreasureMap( level + 1, ( Utility.RandomBool() ? Map.Felucca : Map.Trammel ) ) );
        }

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

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

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

            writer.Write( m_Name );
        }

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

            int version = reader.ReadInt();

            m_Name = reader.ReadString();
        }
    }
}




- Error: Scripts\custom\AAAAA\Paragon chest\ParagonChest1.cs: CS0122: (line 44, column 9) 'Server.Item.m_Hue' is inaccessible due to its protection level
 
Well m_Hue is just the array holding the values, therefor Hue is correct.

Fill also doesnt reset the hue.

Added your script, tested it, worked fine. No Issue. Hues get applied as they should

are you adding the right chest?
 
yea I have 9 chest types that I'm doing the hues with and when I kill a mob it just creates the chest on 0 hue in its corpse.
I tried this here it compiles but still o hue.

paragon chest:
using System;
using System.Collections;
using Server;
using Server.Gumps;
using Server.Multis;
using Server.Network;
using Server.ContextMenus;
using Server.Engines.PartySystem;

namespace Server.Items
{
    [FlipableAttribute( 0x232A, 0x232B )]
    public class ParagonChest1 : LockableContainer
    {
        public override int LabelNumber{ get{ return 3000541; } }

        private static int[] m_ItemIDs = new int[]
        {
            0x232A, 0x232B
        };

        //private static int[] m_Hues = new int[]
        //{
        //    0x0, 0x455, 0x47E, 0x89F, 0x8A5, 0x8AB,
        //    0x966, 0x96D, 0x972, 0x973, 0x979, 0x481,
        //                 0x4FE, 0x4F8, 0x480, 0x489, 1780, 1970,
         //    2747, 2377, 2385, 2391, 2395, 2397, 1153,
        //    1154, 1167, 1177, 1174, 1152, 1, 1180,
        //    1179, 1178, 1198, 1199, 1081, 1067, 1087,
        //    1085, 1076, 1086, 1091, 1097, 1089, 1066,
        //    1096, 1083, 1090, 1093, 1062, 1078, 1069,
        //    1059, 1073, 1084, 1094, 1064, 1095, 1074,
        //    1070, 1092, 1068, 1088, 1065, 1082, 1060,
        //    1071, 1080, 1075, 1077, 1063, 1079, 1061,
        //    1100, 1101, 1150, 1167, 1151, 1161   
        //};

        private string m_Name;

        [Constructable]
        public ParagonChest1( string name, int level ) : base( Utility.RandomList( m_ItemIDs ) )
        {
            m_Name = name;
            Hue = Utility.RandomList (0x0, 0x455, 0x47E, 0x89F, 0x8A5, 0x8AB, 0x966, 0x96D, 0x972, 0x973, 0x979, 0x481, 0x4FE, 0x4F8, 0x480, 0x489, 1780, 1970,
         2747, 2377, 2385, 2391, 2395, 2397, 1153, 1154, 1167, 1177, 1174, 1152, 1, 1180, 1179, 1178, 1198, 1199, 1081, 1067, 1087, 1085, 1076, 1086, 1091, 1097, 1089, 1066,
        1096, 1083, 1090, 1093, 1062, 1078, 1069, 1059, 1073, 1084, 1094, 1064, 1095, 1074, 1070, 1092, 1068, 1088, 1065, 1082, 1060, 1071, 1080, 1075, 1077, 1063, 1079, 1061,
        1100, 1101, 1150, 1167, 1151, 1161);
            Fill( level );
        }
 
yep [add paragonchest1 asd 1
added 5 of them they all are 0 hue
This is in my base creature is it possible I need to add something here for hue?


paragon chest:
                if ( m_Paragon && Paragon.ChestChance > Utility.RandomDouble() )
//                    PackItem( new ParagonChest( this.Name, treasureLevel ) );
                    switch ( Utility.Random( 10 ))
                    {
                        case 0: PackItem( new ParagonChest( this.Name, treasureLevel ) ); break;
                        case 1: PackItem( new ParagonChest2( this.Name, treasureLevel ) ); break;
                        case 2: PackItem( new ParagonChest3( this.Name, treasureLevel ) ); break;
                        case 3: PackItem( new ParagonChest4( this.Name, treasureLevel ) ); break;
                        case 4: PackItem( new ParagonChest5( this.Name, treasureLevel ) ); break;
                        case 5: PackItem( new ParagonChest6( this.Name, treasureLevel ) ); break;
                        case 6: PackItem( new ParagonChest7( this.Name, treasureLevel ) ); break;
                        case 7: PackItem( new ParagonChest8( this.Name, treasureLevel ) ); break;
                        case 8: PackItem( new ParagonChest9( this.Name, treasureLevel ) ); break;
                        case 9: PackItem( new ParagonChest1( this.Name, treasureLevel ) ); break;

                    }
                else if ( (Map == Map.Felucca || Map == Map.Trammel) && TreasureMap.LootChance >= Utility.RandomDouble() )
                    PackItem( new TreasureMap( treasureLevel, Map ) );
            }
 
Last edited:
You could add someting like this somewhere in the constructor

Code:
            for(int i = 0; i < 20; i++)
            {
                Console.WriteLine(Utility.RandomList(m_Hues));
            }

And when you create a chest see what the console says
 
yes it does show the hue# on console
1094
1180
2385
1064
2377
1161
1079
1151
1078
1097
1062
2406
1174
1097
2425
1109
1074
2425
2213
2425

however I did notice that only 20 hues seem to show up randomly not all of them could this be the problem to may hues?
 
Since that works, you would need to look if Hue is overriden somewhere.

But in your Code I cant see that.
Therefor I would suggest to look at the LockableContainer script and see if it maybe overrides the Hue property
 
this is LockableContainer I dont see anything to do with hues=

paragon chest:
using System;
using Server.Network;
using Server.Items;
using Server.Engines.Craft;

namespace Server.Items
{
    public abstract class LockableContainer : TrapableContainer, ILockable, ILockpickable, ICraftable//, ITelekinesisable
    {
        private bool m_Locked;
        private int m_LockLevel, m_MaxLockLevel, m_RequiredSkill;
        private uint m_KeyValue;
        private Mobile m_Picker;

        [CommandProperty( AccessLevel.GameMaster )]
        public Mobile Picker
        {
            get
            {
                return m_Picker;
            }
            set
            {
                m_Picker = value;
            }
        }

        [CommandProperty( AccessLevel.GameMaster )]
        public int MaxLockLevel
        {
            get
            {
                return m_MaxLockLevel;
            }
            set
            {
                m_MaxLockLevel = value;
            }
        }

        [CommandProperty( AccessLevel.GameMaster )]
        public int LockLevel
        {
            get
            {
                return m_LockLevel;
            }
            set
            {
                m_LockLevel = value;
            }
        }

        [CommandProperty( AccessLevel.GameMaster )]
        public int RequiredSkill
        {
            get
            {
                return m_RequiredSkill;
            }
            set
            {
                m_RequiredSkill = value;
            }
        }

        [CommandProperty( AccessLevel.GameMaster )]
        public virtual bool Locked
        {
            get
            {
                return m_Locked;
            }
            set
            {
                m_Locked = value;

                if ( m_Locked )
                    m_Picker = null;

                InvalidateProperties();
            }
        }

        [CommandProperty( AccessLevel.GameMaster )]
        public uint KeyValue
        {
            get
            {
                return m_KeyValue;
            }
            set
            {
                m_KeyValue = value;
            }
        }

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

            writer.Write( (int) 4 ); // version

            writer.Write( (int) m_RequiredSkill );

            writer.Write( (int) m_MaxLockLevel );

            writer.Write( m_KeyValue );
            writer.Write( (int) m_LockLevel );
            writer.Write( (bool) m_Locked );
        }

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

            int version = reader.ReadInt();

            switch ( version )
            {
                case 4:
                {
                    m_RequiredSkill = reader.ReadInt();

                    goto case 3;
                }
                case 3:
                {
                    m_MaxLockLevel = reader.ReadInt();

                    goto case 2;
                }
                case 2:
                {
                    m_KeyValue = reader.ReadUInt();

                    goto case 1;
                }
                case 1:
                {
                    m_LockLevel = reader.ReadInt();

                    goto case 0;
                }
                case 0:
                {
                    if ( version < 3 )
                        m_MaxLockLevel = 100;

                    if ( version < 4 )
                    {
                        if ( (m_MaxLockLevel - m_LockLevel) == 40 )
                        {
                            m_RequiredSkill = m_LockLevel + 6;
                            m_LockLevel = m_RequiredSkill - 10;
                            m_LockLevel = m_RequiredSkill + 39;
                        }
                        else
                        {
                            m_RequiredSkill = m_LockLevel;
                        }
                    }

                    m_Locked = reader.ReadBool();

                    break;
                }
            }
        }

        public LockableContainer( int itemID ) : base( itemID )
        {
            m_MaxLockLevel = 100;
        }

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

        public override bool CheckContentDisplay( Mobile from )
        {
            return !m_Locked && base.CheckContentDisplay( from );
        }

        public override bool TryDropItem( Mobile from, Item dropped, bool sendFullMessage )
        {
            if ( from.AccessLevel < AccessLevel.GameMaster && m_Locked )
            {
                from.SendLocalizedMessage( 501747 ); // It appears to be locked.
                return false;
            }

            return base.TryDropItem( from, dropped, sendFullMessage );
        }

        public override bool OnDragDropInto( Mobile from, Item item, Point3D p )
        {
            if ( from.AccessLevel < AccessLevel.GameMaster && m_Locked )
            {
                from.SendLocalizedMessage( 501747 ); // It appears to be locked.
                return false;
            }

            return base.OnDragDropInto( from, item, p );
        }

        public override bool CheckLift( Mobile from, Item item )
        {
            if ( !base.CheckLift( from, item ) )
                return false;

            if ( item != this && from.AccessLevel < AccessLevel.GameMaster && m_Locked )
                return false;

            return true;
        }

        public override bool CheckItemUse( Mobile from, Item item )
        {
            if ( !base.CheckItemUse( from, item ) )
                return false;

            if ( item != this && from.AccessLevel < AccessLevel.GameMaster && m_Locked )
            {
                from.LocalOverheadMessage( MessageType.Regular, 0x3B2, 1019045 ); // I can't reach that.
                return false;
            }

            return true;
        }

        public override bool DisplaysContent{ get{ return !m_Locked; } }

        public virtual bool CheckLocked( Mobile from )
        {
            bool inaccessible = false;

            if ( m_Locked )
            {
                int number;

                if ( from.AccessLevel >= AccessLevel.GameMaster )
                {
                    number = 502502; // That is locked, but you open it with your godly powers.
                }
                else
                {
                    number = 501747; // It appears to be locked.
                    inaccessible = true;
                }

                from.Send( new MessageLocalized( Serial, ItemID, MessageType.Regular, 0x3B2, 3, number, "", "" ) );
            }

            return inaccessible;
        }

        public override void OnTelekinesis( Mobile from )
        {
            if ( CheckLocked( from ) )
            {
                Effects.SendLocationParticles( EffectItem.Create( Location, Map, EffectItem.DefaultDuration ), 0x376A, 9, 32, 5022 );
                Effects.PlaySound( Location, Map, 0x1F5 );
                return;
            }

            base.OnTelekinesis( from );
        }

        public override void OnDoubleClickSecureTrade( Mobile from )
        {
            if ( CheckLocked( from ) )
                return;

            base.OnDoubleClickSecureTrade( from );
        }

        public override void Open( Mobile from )
        {
            if ( CheckLocked( from ) )
                return;

            base.Open( from );
        }

        public override void OnSnoop( Mobile from )
        {
            if ( CheckLocked( from ) )
                return;

            base.OnSnoop( from );
        }

        public virtual void LockPick( Mobile from )
        {
            Locked = false;
            Picker = from;
        }
        #region ICraftable Members

        public int OnCraft( int quality, bool makersMark, Mobile from, CraftSystem craftSystem, Type typeRes, BaseTool tool, CraftItem craftItem, int resHue )
        {
            if ( from.CheckSkill( SkillName.Tinkering, -5.0, 15.0 ) )
            {
                from.SendLocalizedMessage( 500636 ); // Your tinker skill was sufficient to make the item lockable.

                Key key = new Key( KeyType.Copper, Key.RandomValue() );

                KeyValue = key.KeyValue;
                DropItem( key );

                double tinkering = from.Skills[SkillName.Tinkering].Value;
                int level = (int)(tinkering * 0.8);

                RequiredSkill = level - 4;
                LockLevel = level - 14;
                MaxLockLevel = level + 35;

                if ( LockLevel == 0 )
                    LockLevel = -1;
                else if ( LockLevel > 95 )
                    LockLevel = 95;

                if ( RequiredSkill > 95 )
                    RequiredSkill = 95;

                if ( MaxLockLevel > 95 )
                    MaxLockLevel = 95;
            }
            else
            {
                from.SendLocalizedMessage( 500637 ); // Your tinker skill was insufficient to make the item lockable.
            }

            return 1;
        }

        #endregion
    }
}
 
well the issue lies in the trapable.cs I added some code to turn the the small pouch red when trapped do you see what I might change here to only affect the small pouch rather then all trap category?

paragon chest:
using System;

namespace Server.Items
{
    public enum TrapType
    {
        None,
        MagicTrap,
        ExplosionTrap,
        DartTrap,
        PoisonTrap
    }

    public abstract class TrapableContainer : BaseContainer, ITelekinesisable
    {
        private TrapType m_TrapType;
        private int m_TrapPower;

        [CommandProperty( AccessLevel.GameMaster )]
        public TrapType TrapType
        {
            get
            {
                return m_TrapType;
            }
            set
            {
                m_TrapType = value;

//[COLOR="Red"]///////////////////////////////Changes the color when the pouch becomes trapped/////////////////////////////////[/COLOR]
//        if (( TrapType == TrapType.MagicTrap )&&(this.ItemID == 0xE79 ))
//        {
//            Hue = 2499;
//        }
//        else
//        {
//                Hue = 0;
//        }
//[COLOR="Red"]////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////[/COLOR]
    }
}

        [CommandProperty( AccessLevel.GameMaster )]
        public int TrapPower
        {
            get
            {
                return m_TrapPower;
            }
            set
            {
                m_TrapPower = value;
            }
        }

        public TrapableContainer( int itemID ) : base( itemID )
        {
        }

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

        public virtual bool ExecuteTrap( Mobile from )
        {
            if ( m_TrapType != TrapType.None )
            {
                switch ( m_TrapType )
                {
                    case TrapType.ExplosionTrap:
                    {
                        from.SendLocalizedMessage( 502999 ); // You set off a trap!

                        if ( from.InRange( GetWorldLocation(), 2 ) )
                        {
                            AOS.Damage( from, m_TrapPower, 0, 100, 0, 0, 0 );
                            from.SendLocalizedMessage( 503000 ); // Your skin blisters from the heat!
                        }

                        Point3D loc = GetWorldLocation();

                        Effects.PlaySound( loc, Map, 0x307 );
                        Effects.SendLocationEffect( new Point3D( loc.X + 1, loc.Y + 1, loc.Z - 11 ), Map, 0x36BD, 15 );

                        break;
                    }
                    case TrapType.MagicTrap:
                    {
                        if ( from.InRange( GetWorldLocation(), 1 ) )
                            from.Damage( m_TrapPower );
                            //AOS.Damage( from, m_TrapPower, 0, 100, 0, 0, 0 );

                        Point3D loc = GetWorldLocation();

                        Effects.PlaySound( loc, Map, 0x307 );

                        Effects.SendLocationEffect( new Point3D( loc.X - 1, loc.Y, loc.Z ), Map, 0x36BD, 15 );
                        Effects.SendLocationEffect( new Point3D( loc.X + 1, loc.Y, loc.Z ), Map, 0x36BD, 15 );

                        Effects.SendLocationEffect( new Point3D( loc.X, loc.Y - 1, loc.Z ), Map, 0x36BD, 15 );
                        Effects.SendLocationEffect( new Point3D( loc.X, loc.Y + 1, loc.Z ), Map, 0x36BD, 15 );

                        Effects.SendLocationEffect( new Point3D( loc.X + 1, loc.Y + 1, loc.Z + 11 ), Map, 0x36BD, 15 );

 //                               Hue = 0;    //[COLOR="Red"] // changes the color back after the pouch is used[/COLOR]

                        break;
                    }
                    case TrapType.DartTrap:
                    {
                        AOS.Damage( from, m_TrapPower, 100, 0, 0, 0, 0 );

                        Effects.SendMovingEffect( this, from, 0x1BFE, 7, 0, false, false );
                        Effects.PlaySound( from.Location, from.Map, 0x234 );
                        break;
                    }
                    case TrapType.PoisonTrap:
                    {
                        AOS.Damage( from, m_TrapPower, 0, 0, 0, 100, 0 );
    
                        from.Poison = Poison.Greater;

                        Point3D loc = GetWorldLocation();
                        Effects.PlaySound( loc, Map, 0x1DE );
                        Effects.SendLocationEffect( new Point3D( from.Location.X + 1, from.Location.Y + 1, from.Location.Z + 15 ), from.Map, 0x11A6, 48 );
                        break;
                    }
                }

                m_TrapType = TrapType.None;
                return true;
            }

            return false;
        }

        public virtual void OnTelekinesis( Mobile from )
        {
            Effects.SendLocationParticles( EffectItem.Create( Location, Map, EffectItem.DefaultDuration ), 0x376A, 9, 32, 5022 );
            Effects.PlaySound( Location, Map, 0x1F5 );

            if ( !ExecuteTrap( from ) )
                base.DisplayTo( from );
        }

        public override void Open( Mobile from )
        {
            if ( !ExecuteTrap( from ) )
                base.Open( from );
        }

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

            writer.Write( (int) 1 ); // version

            writer.Write( (int) m_TrapPower );
            writer.Write( (int) m_TrapType );
        }

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

            int version = reader.ReadInt();

            switch ( version )
            {
                case 1:
                {
                    m_TrapPower = reader.ReadInt();

                    goto case 0;
                }

                case 0:
                {
                    m_TrapType = (TrapType)reader.ReadInt();

                    break;
                }
            }
        }
    }
}
 
If you do it this way, it will only affect TrappableContainers with that ItemID, other ones are not influenced

Code:
        if(ItemID == 0xE79)
        {
            if (TrapType == TrapType.MagicTrap)
            {
                Hue = 2499;
            }
            else
            {
                Hue = 0;
            }
        }
 
Thanks a ton! everything seems to be working as it should. @PyrO
I spoke to soon if I un-trap other container types they go to 0 hue how would I just acknowledge the pouch h0xE79 in the code for untrap?

paragon chest:
        public virtual bool ExecuteTrap( Mobile from )
        {
            if ( m_TrapType != TrapType.None )
            {
                switch ( m_TrapType )
                {
                    case TrapType.ExplosionTrap:
                    {
                        from.SendLocalizedMessage( 502999 ); // You set off a trap!

                        if ( from.InRange( GetWorldLocation(), 2 ) )
                        {
                            AOS.Damage( from, m_TrapPower, 0, 100, 0, 0, 0 );
                            from.SendLocalizedMessage( 503000 ); // Your skin blisters from the heat!
                        }

                        Point3D loc = GetWorldLocation();

                        Effects.PlaySound( loc, Map, 0x307 );
                        Effects.SendLocationEffect( new Point3D( loc.X + 1, loc.Y + 1, loc.Z - 11 ), Map, 0x36BD, 15 );

                        break;
                    }
                    case TrapType.MagicTrap:
                    {
                        if ( from.InRange( GetWorldLocation(), 1 ) )
                            from.Damage( m_TrapPower );
                            //AOS.Damage( from, m_TrapPower, 0, 100, 0, 0, 0 );

                        Point3D loc = GetWorldLocation();

                        Effects.PlaySound( loc, Map, 0x307 );

                        Effects.SendLocationEffect( new Point3D( loc.X - 1, loc.Y, loc.Z ), Map, 0x36BD, 15 );
                        Effects.SendLocationEffect( new Point3D( loc.X + 1, loc.Y, loc.Z ), Map, 0x36BD, 15 );

                        Effects.SendLocationEffect( new Point3D( loc.X, loc.Y - 1, loc.Z ), Map, 0x36BD, 15 );
                        Effects.SendLocationEffect( new Point3D( loc.X, loc.Y + 1, loc.Z ), Map, 0x36BD, 15 );

                        Effects.SendLocationEffect( new Point3D( loc.X + 1, loc.Y + 1, loc.Z + 11 ), Map, 0x36BD, 15 );

 //                               Hue = 0;    //[COLOR="Red"] // changes the color back after the pouch is used[/COLOR]

                        break;
                    }
this works does it look like I missed anything?
paragon chest:
//                                Hue = 0;    //[COLOR="Red"] // changes the color back after the pouch is used[/COLOR]

        if(ItemID == 0xE79)
        {
            if (TrapType == TrapType.MagicTrap)
            {
                Hue = 0;
            }
 
Last edited:
Back