zerodowned

Moderator
I've searched Server/mobile, playermobile, and basecreature and can't find anything.

Does anyone know how to disable blood when a mobile is damaged? I don't want to do it for ALL Mobs, just one. But can't find a method to override.
 
Unfortunately its in the BaseWeapon OnHit method, it calls the AddBlood method. Therefore any override would be on a weapon, not on a mobile. You will have to rewrite or do a workaround.
 
You could just toss in some extra check in the method @Ravenwolfe mentioned, and exclude the mobile of choice. shouldnt be much more difficult than that, if i understand what you were wanting.
 
For me i added a virtual bool canbleed in the basecreature if i'm right, so i can just override it to false.
I can provide example if you wish.
 
Gah... there's a damn 1 min time limit to edit...
here's what i did.

I've added it to my server in basecreature.cs
like such:
public virtual bool BloodCreature{ get{ return true; } }

then

in public virtual void OnCarve( Mobile from, Corpse corpse )
i added a check for the new Blood( 0x122D ).MoveToWorld( corpse.Location, corpse.Map );
with if ( BloodCreature)

then

i added this in the public virtual void OnHit( Mobile attacker, Mobile defender, double damageBonus )
Code:
if ( defender is BaseCreature )
{
if( ((BaseCreature)defender).BloodCreature ) //BloodCreature
AddBlood( attacker, defender, damage );
}
 
yep right on :)

So this is to disable having blood splatter OnHit then, right? You know, I think I might have to take that idea and run with it too ;) Thats a great idea, not all mobs should splatter blood.. genius..
 
managed to get this from runuo before it went down today


Lord_Greywolf

Little fix for blood splats where should not be :)

Many critters are Bleed Immune, ans that is normaly because they have no blood :eek:

but when you attack them, they bleed :rolleyes:

this little fix makes it so no blood shows up if they are not sapposed to bleed

open up baseweapon.cs
and find this section:
Code:
        public virtual void AddBlood( Mobile attacker, Mobile defender, int damage )
        {
            if ( damage > 0 )





and replace the part in red with:
Code:
if ( damage > 0 && ( (defender is BaseCreature && !((BaseCreature)defender).BleedImmune) || !(defender is BaseCreature) ) )


so it looks like this:
Code:
  public virtual void AddBlood( Mobile attacker, Mobile defender, int damage )
        {
            if ( damage > 0 && ( (defender is BaseCreature && !((BaseCreature)defender).BleedImmune) || !(defender is BaseCreature) ) )



and those with out blood will no longer bleed :cool:


edit then this should work

public override bool BleedImmune{ get{ return true;}}

see below for correct change
 
Last edited:
@Ravenwolfe thank you for pointing that out.

as mentioned above here's what i've done

in BaseCreature

under public virtual bool BleedImmune { get { return false; } }
I added public virtual bool DoesNotBleed { get { return false;} }
//false because it will default to false

then in BaseWeapon I added the part shown below
Code:
public virtual void AddBlood(Mobile attacker, Mobile defender, int damage)
  {
	/// beginning of addition
      if( ((BaseCreature)defender).DoesNotBleed )
      {
        return;
      }
     /// end of addition

  else if (damage > 0)
  {
  new Blood().MoveToWorld(defender.Location, defender.Map);
  int extraBlood = (Core.SE ? Utility.RandomMinMax(3, 4) : Utility.RandomMinMax(0, 1));
  for (int i = 0; i < extraBlood; i++)
  {
  new Blood().MoveToWorld(new Point3D(
  defender.X + Utility.RandomMinMax(-1, 1),
  defender.Y + Utility.RandomMinMax(-1, 1),
  defender.Z), defender.Map);
  }
  }
  }

Finally, for the Mobile that you want to use it on
under the...class?

public class MobileName : BaseCreature
{
public override bool DoesNotBleed{ get{ return true;}}
 
Back