well guys... i'm here again... well... i have a little problem here... I need to do a method to remove a sobnpc when it have no Hitpoints... I have tryed alot of times and do some tests and don't got sucess...
My method to create a sobnpc working fine...
Creating a SobNPC...
Remove NPC code
The remove method is that
That code to remove work to remove the npc from dictionary... But the sobnpc don't remove from screen... Someone can help here?
My method to create a sobnpc working fine...
Creating a SobNPC...
Code:
SobNpcSpawn agility = new SobNpcSpawn
{
Name = "FlagTeste",
UID = 10105,
MapID = 1002,
X = 449,
Y = 449,
MaxHitpoints = 100000,
Hitpoints = 100000,
Mesh = 11150,
Type = Enums.NpcType.Stake
};
Kernel.Maps[(ushort)1002].AddNpc(agility);
Code:
public void AddNpc(INpc npc)
{
if (!this.Npcs.ContainsKey(npc.UID))
{
this.Npcs.Add(npc.UID, npc);
this.Floor[npc.X, npc.Y, MapObjectType.InvalidCast, npc] = false;
if (((npc.Mesh / 10) != 0x6c) && (npc.Type < ((Enums.NpcType)10)))
{
ushort x = npc.X;
ushort y = npc.Y;
foreach (Enums.ConquerAngle angle in Angles)
{
ushort num3 = x;
ushort num4 = y;
UpdateCoordonatesForAngle(ref num3, ref num4, angle);
this.Floor[num3, num4, MapObjectType.InvalidCast, null] = false;
}
}
}
}
Code:
if (((attacker.MapID == 1002) && (attacked.UID == 10105)) && (attacked.Hitpoints <= damage))
{
attacked.Hitpoints = 0;
SobNpcSpawn agility = new SobNpcSpawn
{
Name = "FlagTeste",
UID = 10105,
MapID = 1002,
X = 449,
Y = 449,
MaxHitpoints = 100000,
Hitpoints = attacked.Hitpoints,
Mesh = 11150,
Type = Enums.NpcType.Stake
};
Kernel.Maps[(ushort)1002].Removenpc(agility);
}
Code:
public void Removenpc(INpc npc)
{
if (this.Npcs.ContainsKey(npc.UID))
{
this.Npcs.Remove(npc.UID);
this.Floor[npc.X, npc.Y, MapObjectType.InvalidCast, npc] = true;
if (((npc.Mesh / 10) != 0x6c) && (npc.Type < ((Enums.NpcType)10)))
{
ushort x = npc.X;
ushort y = npc.Y;
foreach (Enums.ConquerAngle angle in Angles)
{
ushort num3 = x;
ushort num4 = y;
UpdateCoordonatesForAngle(ref num3, ref num4, angle);
this.Floor[num3, num4, MapObjectType.InvalidCast, null] = true;
}
}
}
}