hey guys, so last night i was working on my monster drop system and i found something that's kinda confused me.
so here is how i make my monsters drop the things i want them.
but somehow when i add more then 1 monster in this code , it start to loop. as you can see it says 15% only but when i kill the monster its 100% drop on all of them.
but if i make the code use only 1 monster not 3 it works fine.
so here is how i make my monsters drop the things i want them.
Code:
#region GreenCobra ston drop
if (Name == "GreenCobra" || Name == "Protector" || Name == "GhostFinder" && ServerBase.Kernel.percentSuccess(15))
{
uint Uid = 0;
byte type = (byte)ServerBase.Kernel.Random.Next(1, 5);
switch (type)
{
case 1: Uid = 727851; break;
case 2: Uid = 727851; break;
case 3: Uid = 727851; break;
case 4: Uid = 1458958; break;
case 5: Uid = 1458958; break;
}
if (Uid != 0)
{
ushort X = Owner.X, Y = Owner.Y;
Game.Map Map = ServerBase.Kernel.Maps[Owner.MapID];
if (Map.SelectCoordonates(ref X, ref Y))
{
Network.GamePackets.FloorItem floorItem = new Network.GamePackets.FloorItem(true);
floorItem.Item = new Network.GamePackets.ConquerItem(true);
floorItem.Item.ID = Uid;
floorItem.Item.MaximDurability = floorItem.Item.Durability = 65535;
floorItem.Item.MobDropped = true;
floorItem.Item.StackSize = 1;
floorItem.Item.MaxStackSize = 65535;
floorItem.Item.UID = Network.GamePackets.ConquerItem.ItemUID.Next;
floorItem.ValueType = Network.GamePackets.FloorItem.FloorValueType.Item;
floorItem.ItemID = Uid;
floorItem.MapID = Owner.MapID;
floorItem.MapObjType = Game.MapObjectType.Item;
floorItem.X = X;
floorItem.Y = Y;
floorItem.Type = Network.GamePackets.FloorItem.Drop;
floorItem.OnFloor = Time32.Now;
floorItem.ItemColor = floorItem.Item.Color;
floorItem.UID = Network.GamePackets.FloorItem.FloorUID.Next;
while (Map.Npcs.ContainsKey(floorItem.UID))
floorItem.UID = Network.GamePackets.FloorItem.FloorUID.Next;
Map.AddFloorItem(floorItem);
SendScreenSpawn(floorItem);
}
}
}
#endregion
but somehow when i add more then 1 monster in this code , it start to loop. as you can see it says 15% only but when i kill the monster its 100% drop on all of them.
but if i make the code use only 1 monster not 3 it works fine.