Lemke

Member
Hello guys!
Found mob creature system,and looks works correctly,i get creatures get random level between 1-5 on spawn,but stats are not ok,just normal stats on a level bear.
Here the core code:
Code:
using Server;
using System;
using Server.Mobiles;
using Server.Items;


namespace Koryn.IlevelCreature
{
   
    public abstract class ILevel : BaseCreature
    {
       

        private int m_Level;            // Level
        [CommandProperty(AccessLevel.GameMaster)]
       
        public int Level
        {
            get { return Utility.RandomMinMax(1, 5); } 
            set { m_Level = value; InvalidateProperties(); }
        }

      

        public ILevel( AIType aiType, FightMode fightMode, int rangePerception, int rangeFight, double activeSpeed, double passiveSpeed ) : base ( aiType, fightMode, rangePerception, rangeFight, activeSpeed, passiveSpeed )
        {
           
        }

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

        public override void GetProperties(ObjectPropertyList list)
        {

            base.GetProperties(list);

            list.Add("Level {0} ",Level);
        }
       
        public static void addstats(Mobile mo_killer,int mo_level)
        {
            BaseCreature on = (BaseCreature)mo_killer;
           
            int Level = mo_level;
            int tamskill = Convert.ToInt32(on.MinTameSkill);
            if (Level == 1)
            {
                on.Title = "[Level 1]";
                on.RawStr += 100;
                on.RawDex += 100;
                on.RawInt += 100;
                on.VirtualArmor += 5;

                if (on.Tamable && tamskill < 100)
                {
                    on.MinTameSkill += 5;
                }
            }
            if (Level == 2)
            {
                on.Title = "[Level 2]";
                on.RawStr += 200;
                on.RawDex += 100;
                on.RawInt += 100;
                on.VirtualArmor += 10;

                if (on.Tamable && tamskill < 100)
                {
                    on.MinTameSkill += 7;
                }
            }
            if (Level == 3)
            {
                on.Title = "[Level 3]";
                on.RawStr += 300;
                on.RawDex += 100;
                on.RawInt += 100;
                on.VirtualArmor += 20;

                if (on.Tamable && tamskill < 100)
                {
                    on.MinTameSkill += 10;
                }
            }
            if (Level == 4)
            {
                on.Title = "[Level 4]";
                on.RawStr += 400;
                on.RawDex += 100;
                on.RawInt += 100;
                on.VirtualArmor += 30;

                if (on.Tamable && tamskill < 100)
                {
                    on.MinTameSkill += 15;
                }
            }
            if (Level == 5)
            {
                on.Title = "[Level 5]";
                on.RawStr += 500;
                on.RawDex += 100;
                on.RawInt += 100;
                on.VirtualArmor += 40;

                if (on.Tamable && tamskill < 100)
                {
                    on.MinTameSkill += 20;
                }
            }
            else
            {
                on.Tamable = false;
            }
        }

      

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

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

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

            int version = reader.ReadInt();

            switch (version)
            {
                case 0:
                    m_Level = reader.ReadInt();
                    break;
            }

        }
    }
}

Any ideas? Thanks in advance!!!
 
Why can't you just do = 300 instead of += ?
Hello and thank you,just tested,but the npc continue without gains.The new code is here:

Code:
using Server;
using System;
using Server.Mobiles;
using Server.Items;


namespace Koryn.IlevelCreature
{
   
    public abstract class ILevel : BaseCreature
    {
       

        private int m_Level;            // Level
        [CommandProperty(AccessLevel.GameMaster)]
       
        public int Level
        {
            get { return Utility.RandomMinMax(1, 5); }
            set { m_Level = value; InvalidateProperties(); }
        }

      

        public ILevel( AIType aiType, FightMode fightMode, int rangePerception, int rangeFight, double activeSpeed, double passiveSpeed ) : base ( aiType, fightMode, rangePerception, rangeFight, activeSpeed, passiveSpeed )
        {
           
        }

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

        public override void GetProperties(ObjectPropertyList list)
        {

            base.GetProperties(list);

            list.Add("Level {0} ",Level);
        }
       
        public static void addstats(Mobile mo_killer,int mo_level)
        {
            BaseCreature on = (BaseCreature)mo_killer;
           
            int Level = mo_level;
            int tamskill = Convert.ToInt32(on.MinTameSkill);
            if (Level == 1)
            {
                on.Title = "[Level 1]";
                on.RawStr = 100;
                on.RawDex = 100;
                on.RawInt = 100;
                on.VirtualArmor = 5;

              
            }
            if (Level == 2)
            {
                on.Title = "[Level 2]";
                on.RawStr = 200;
                on.RawDex = 100;
                on.RawInt = 100;
                on.VirtualArmor = 10;

               
            }
            if (Level == 3)
            {
                on.Title = "[Level 3]";
                on.RawStr = 300;
                on.RawDex = 100;
                on.RawInt = 100;
                on.VirtualArmor = 20;

               
            }
            if (Level == 4)
            {
                on.Title = "[Level 4]";
                on.RawStr = 400;
                on.RawDex = 100;
                on.RawInt = 100;
                on.VirtualArmor = 30;

               
            }
            if (Level == 5)
            {
                on.Title = "[Level 5]";
                on.RawStr = 500;
                on.RawDex = 100;
                on.RawInt = 100;
                on.VirtualArmor = 40;

               
            }
            else
            {
                on.Tamable = false;
            }
        }

      

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

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

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

            int version = reader.ReadInt();

            switch (version)
            {
                case 0:
                    m_Level = reader.ReadInt();
                    break;
            }

        }
    }
}

Note: For sure im using :
Code:
public class LevelBlackBear : ILevel
Code:
using Koryn.IlevelCreature;
 

Active Shards

Donations

Total amount
$0.00
Goal
$1,000.00
Back