//Somewhere in BaseCreature.cs
public override bool CanBeHarmful(Mobile to)
{
//use this if you want to prevent harm to anyone by pets
if (this.Controlled) return false;
//use this if you want to prevent a pet from harming it's owner
if (this.Controlled && this.Owner != null && this.Owner == to) return false;
}
Thanks Lokai.I'll test it later.Anyway, add something like this. If this method already exists, just place one of these "if" statements near the top of the method.
Code://Somewhere in BaseCreature.cs public override bool CanBeHarmful(Mobile to) { //use this if you want to prevent harm to anyone by pets if (this.Controlled) return false; //use this if you want to prevent a pet from harming it's owner if (this.Controlled && this.Owner != null && this.Owner == to) return false; }
You might have to substitute ControlMaster for Owner, not sure. This should get you started.
public override bool CanBeHarmful(Mobile target, bool message, bool ignoreOurBlessedness)
{
if (target is BaseFactionGuard)
{
return false;
}
if (this.Controlled && target.Player)
{
return false;
}
if ((target is BaseVendor && ((BaseVendor)target).IsInvulnerable) || target is PlayerVendor || target is TownCrier)
{
if (message)
{
if (target.Title == null)
{
SendMessage("{0} the vendor cannot be harmed.", target.Name);
}
else
{
SendMessage("{0} {1} cannot be harmed.", target.Name, target.Title);
}
}
return false;
}
return base.CanBeHarmful(target, message, ignoreOurBlessedness);
}
We use essential cookies to make this site work, and optional cookies to enhance your experience.