ServUO Version
Publish 57
Ultima Expansion
Endless Journey
public override void OnDamage(int amount, Mobile from, bool willKill)
{
int disruptThreshold;


if (!Core.AOS)
{
disruptThreshold = 0;
}
else if (from != null && from.Player)
{
disruptThreshold = 19;
}
else
{
disruptThreshold = 26;
}

if (Core.SA)
{
disruptThreshold += Dex / 12;
}

if (amount > disruptThreshold)
{
BandageContext c = BandageContext.GetContext(this);

if (c != null)
{
c.Slip();
}
}

if (Confidence.IsRegenerating(this))
{
Confidence.StopRegenerating(this);
}

if (m_ReceivedHonorContext != null)
{
m_ReceivedHonorContext.OnTargetDamaged(from, amount);
}
if (m_SentHonorContext != null)
{
m_SentHonorContext.OnSourceDamaged(from, amount);
}

if (willKill && from is PlayerMobile)
{
Timer.DelayCall(TimeSpan.FromSeconds(10), ((PlayerMobile)@from).RecoverAmmo);
}

#region Mondain's Legacy
if (InvisibilityPotion.HasTimer(this))
{
InvisibilityPotion.Iterrupt(this);
}
#endregion

UndertakersStaff.TryRemoveTimer(this);

base.OnDamage(amount, from, willKill);
}

I have a question about the onamage method on playermobile.cs , for example

#endregion

UndertakersStaff.TryRemoveTimer(this);
this.Mana -= 10;
base.OnDamage(amount, from, willKill);
Adding this.Mana -=10; method reduces mana by 10 each time the player is damaged. Conversely, adding this.Mana +=10; has the proper effect of restoring mana by 10 each time the player is damaged. The problem is: this.Hits +=10; adding this method or this.Hits -=10; did not decrease or recover player hp when adding this method. I don't think the method related to hp works. Maybe it's just me or I tried all the other methods, but it didn't work. Can you help if it's just me or what's causing this?
 
I think the this.hits means the item not the player might have to do like mobile.hits not sure just stabbing at dark but this looks like it might be calling out the undertakersstaff
 
I think the this.hits means the item not the player might have to do like mobile.hits not sure just stabbing at dark but this looks like it might be calling out the undertakersstaff
I've found a solution to this problem. Thank you very much for your help!
 
Last edited:
What I was saying is when it says ( this.mana ) this means the item in the script which looks like it was referencing the undertakerstaff and not the player wielding it. anytime the term this.something is called out its referencing the item in the script. I am not expert but that is what I was thinking the problem was.
Could you post what your solution was so we can see how you fixed it in case someone else has a similar problem. It always helps out others maybe with other scripts for people.
 
What I was saying is when it says ( this.mana ) this means the item in the script which looks like it was referencing the undertakerstaff and not the player wielding it. anytime the term this.something is called out its referencing the item in the script. I am not expert but that is what I was thinking the problem was.
Could you post what your solution was so we can see how you fixed it in case someone else has a similar problem. It always helps out others maybe with other scripts for people.
Instead of using the //public override void OnDamage (intmount, Mobile from, bool willkill) //method, I tried the following method.
//public override int Damage (intmount, Mobile from, bool infoMount, bool checkDisrupt) //I applied it to this method and tested it, and the previous problem was solved and it worked well.
 
Last edited:
Back