Cad

Member
Hello, been struggling to figure out how to get Instruments and tools such as pickaxe, hatchet, ETC; to display the uses remaining / durability.
Any guidance would be greatly appreciated. Picture attached is what I'm going for. Thanks in advance.

instrument.png
 
They removed that from UO a while ago so ServUO did too. I thought it was an error with my scripts but no, tools no longer wear so the durability is display never happens. Technically the "uses remaining" is still in the script.


I hoped to tell you how I restored the old method of operation on my server and I can't remember! I've looked through my scripts and nothing stands out to tell me what I changed. I usually keep good notes of what I change and it's just not there.
 
  • Like
Reactions: Cad
All good, I’m gonn keep messing with the code until I finally make some progress lol. Thanks tho.
 
So tools no longer wear out? They were always cheap, but kind of a hassle to keep making/buying more. I would fine with them lasting.
 
I’m really just trying to get the instruments to show durability. My tools are still showing uses remaining though
 
I found this line in the BaseInstrument file? Is there another line that goes with this to set it so it shows?

BaseInstrument:
        public override void AddUsesRemainingProperties(ObjectPropertyList list)
        {
            list.Add(1060584, UsesRemaining.ToString()); // uses remaining: ~1_val~
        }
 
Are the uses actually getting consumed on use (checkable with [props ) but the durability is just not being displayed?
 
yes, UOR. I've been looking into the BaseHarvestingtool.cs and Shovel.cs to see different lines that may be causing the durability to show on the shovel but nothing seems to working. My knowledge in C# and coding period are very slim
 
The older eras don't display the OPL (object property list) so the lines that add the durability to that list don't do anything on your shard.

The tools use this line to display durability in non-OPL situations. I don't know if it will work for instruments but it can't hurt to try! Add this just after the part you quoted above:

Code:
        public virtual void DisplayDurabilityTo(Mobile m)
        {
            LabelToAffix(m, 1017323, AffixType.Append, ": " + m_UsesRemaining.ToString()); // Durability
        }

It compiles for me but doesn't change what's displayed, *but* mine uses OPL so it could be an either/or situation. Give it a shot!
 
Don't keep the solution a secret -- somebody will find this thread in a search years from now and like 99% of every other promising link on the internet, it'll end without the resolution being shared!
 
  • Like
Reactions: Cad
For sure, Thank you for all the help. Ill be posting all changes made shortly.
Post automatically merged:

CHANGES MADE TO DISPLAY DURABILITY ON INSTRUMENTS.
Attached is my BaseInstrument.cs with just the changes made to display durability.


Line12
BaseInstrument.cs:
public abstract class BaseInstrument : Item, IUsesRemaining, ISlayer, IQuality, IResource // Added IUsesRemaining to show durability.

Around Line262
BaseInstrument.cs:
        public bool ShowUsesRemaining // Added to show UsesRemaining
        {
            get
            {
                return true;
            }
            set
            {
            }
        }

        public virtual bool BreakOnDepletion { get { return true; } }

Around Line511
BaseInstrument.cs:
        public virtual void DisplayDurabilityTo(Mobile m)
        {
            LabelToAffix(m, 1017323, AffixType.Append, ": " + m_UsesRemaining.ToString()); // Durability
        }
Post automatically merged:

instrument.png
 

Attachments

  • BaseInstrument.cs
    21.3 KB · Views: 8
Last edited:

Active Shards

Donations

Total amount
$0.00
Goal
$1,000.00
Back