- ServUO Version
- Publish 57
- Ultima Expansion
- Time Of Legends
Added health orbs in base creature,and server is getting random crashes.Any tip?Here the add in method:
Thanks in advance!
C#:
public virtual void AlterMeleeDamageFrom(Mobile from, ref int damage)
{
//Custom health orb drop
if (this == null || Utility.RandomDouble() > 0.05) //chance to drop 5%
return;
bool validLocation = false;
Point3D loc = this.Location;
for (int j = 0; !validLocation && j < 10; ++j)
{
int x = this.X + Utility.Random(4);
int y = this.Y + Utility.Random(4);
int z = this.Map.GetAverageZ(x, y);
if (validLocation = (this.Map.CanFit(x, y, this.Z, 6, false, false) && this.InLOS(new Point3D(x, y, this.Z))))
loc = new Point3D(x, y, this.Z);
else if (validLocation = (this.Map.CanFit(x, y, z, 6, false, false) && this.InLOS(new Point3D(x, y, z))))
loc = new Point3D(x, y, z);
}
if (!validLocation)
return;
//HealthOrb orb = new HealthOrb();
new HealthOrb().MoveToWorld(loc, this.Map);
//Custom healthorb drop