Monster UID Problem

05/14/2015 15:46 Soulfly25#1
hello mates, Could you help me with my problem? with this UID of a monster.

Code:
  public void Spawnthis(Database.MonsterInformation mt, Client.GameState client, ushort ID, ushort x, ushort y)
        {
            if (mt == null) return;
            mt.RespawnTime += 5;
            Entity entity = new Entity(EntityFlag.Monster, false);
            entity.MapObjType = MapObjectType.Monster;
            entity.MonsterInfo = mt.Copy();
            entity.MonsterInfo.Owner = entity;
            entity.Name = mt.Name;
            entity.MinAttack = mt.MinAttack;
            entity.MaxAttack = entity.MagicAttack = mt.MaxAttack;
            entity.Hitpoints = entity.MaxHitpoints = mt.Hitpoints;
            entity.Body = mt.Mesh;
            entity.Level = mt.Level;
            entity.UID = (uint)ServerBase.Kernel.Random.Next(6000000, 6100000);
            entity.MapID = 1024;
            entity.X = 79;
            entity.Y = 79;
            entity.SendUpdates = true;
            AddEntity(entity);
            entity.SendSpawn(client);
        }
when I use this entity.UID = (uint)ServerBase.Kernel.Random.Next(6000000, 6100000); there's a lot of monster would summon. but when I use 6000000 it only summon 1 but when I summon it back it will freeze. so if anyone willing to help me it would be nice :D


BTW, I want to summon a single Boss Monster that is like Sword Master.


thank You Mates
05/15/2015 14:59 CptSky#2
Shouldn't you at least make sure the UID isn't already used ?
05/15/2015 15:36 pintinho12#3
Create a uint somewhere you can just increase the number when summoning a new monster?
With a check on the get, as if it is >= 610000 it will just go back to 600000, then you check if the ID is enabled
05/16/2015 01:39 abdoumatrix#4
EntityCounter.Next
05/16/2015 06:14 Soulfly25#5
I did that EntityCounter.Next yet still it summon lot's of monster maybe 10 or more.
05/16/2015 06:54 pintinho12#6
Well, I manually do it with get;set;