Go Back   RunUO - Ultima Online Emulation > RunUO > Script Support

Script Support Get support for modifying RunUO Scripts, or writing your own!

Reply
 
Thread Tools Display Modes
Old 08-24-2008, 10:21 PM   #1 (permalink)
Newbie
 
dadnlad's Avatar
 
Join Date: Jul 2008
Age: 31
Posts: 35
Default Durability Problems

Items show durability when you mouse over them. When durability reaches 0, it no longer shows durability. Once it stops showing its durability, it never breaks. Weapn (and armor) will continue to show overhead "your equipement is serverely damaged" but it will go on forever.

I found this in Baseweapon.... I've no idea how to alter it to make it so

A. Duribility will always show, even if 0

B. Item will break if not fixed and continued to be used

Code:
if ( Core.AOS && m_AosWeaponAttributes.SelfRepair > Utility.Random( 10 ) )
	{
	HitPoints += 2;
	}
else
	{
	if ( m_Hits > 0 )
		{
		--HitPoints;
		}
	else if ( m_MaxHits > 1 )
		{
		--MaxHitPoints;
		if ( Parent is Mobile )
		((Mobile)Parent).LocalOverheadMessage( MessageType.Regular, 0x3B2, 1061121 ); // Your equipment is severely damaged.
		}
	else
		{
		Delete();
		}
	}

To me, it looks like it should work, but, I am like "King Noob" when it comes to fixing, writing, or evaluating scripts lol

Any ideas?
dadnlad is offline   Reply With Quote
Old 08-24-2008, 10:26 PM   #2 (permalink)
Forum Novice
 
Tassyon T's Avatar
 
Join Date: Sep 2007
Posts: 367
Default

Quote:
Originally Posted by dadnlad View Post
Items show durability when you mouse over them. When durability reaches 0, it no longer shows durability. Once it stops showing its durability, it never breaks. Weapn (and armor) will continue to show overhead "your equipement is serverely damaged" but it will go on forever.

I found this in Baseweapon.... I've no idea how to alter it to make it so

A. Duribility will always show, even if 0

B. Item will break if not fixed and continued to be used

Code:
if ( Core.AOS && m_AosWeaponAttributes.SelfRepair > Utility.Random( 10 ) )
	{
	HitPoints += 2;
	}
else
	{
	if ( m_Hits > 0 )
		{
		--HitPoints;
		}
	else if ( m_MaxHits > 1 )
		{
		--MaxHitPoints;
		if ( Parent is Mobile )
		((Mobile)Parent).LocalOverheadMessage( MessageType.Regular, 0x3B2, 1061121 ); // Your equipment is severely damaged.
		}
	else
		{
		Delete();
		}
	}

To me, it looks like it should work, but, I am like "King Noob" when it comes to fixing, writing, or evaluating scripts lol

Any ideas?

The code looks fine to me... but maybe this will help?

Code:
if ( Core.AOS && m_AosWeaponAttributes.SelfRepair > Utility.Random( 10 ) )
	{
	HitPoints += 2;
	}
else
	{
	if ( m_Hits > 0 )
		{
		--HitPoints;
		}
	else if ( m_MaxHits >= 1 )
		{
		--MaxHitPoints;
		if ( Parent is Mobile )
		((Mobile)Parent).LocalOverheadMessage( MessageType.Regular, 0x3B2, 1061121 ); // Your equipment is severely damaged.
		}
	else if ( m_MaxHits < 1 )
		{
		Delete();
		}
	}

Displaying info is also in baseweapon under a different method. See if you can find where it's adding info to a list.

Edit... now that I think about it... there may be some code somewhere that disallows MaxHits from going under 1. So, you may need to find that and change it where the MaxHits method resides.

Last edited by Tassyon T; 08-24-2008 at 10:30 PM.
Tassyon T is offline   Reply With Quote
Old 08-24-2008, 10:53 PM   #3 (permalink)
Forum Novice
 
Join Date: Jul 2004
Location: Lincoln, IL
Age: 35
Posts: 147
Send a message via MSN to Mad Clown
Default

the item does eventually break if you props the item the max his will show the max dur and the item hits shoes what it is basicly what happens say you have a item that has 255 dur it goes to 0 and shows no more well it counts down from there -255 -254 -253 to 0 again at 0 the item will break
Mad Clown is offline   Reply With Quote
Old 08-24-2008, 11:19 PM   #4 (permalink)
Newbie
 
dadnlad's Avatar
 
Join Date: Jul 2008
Age: 31
Posts: 35
Default

ah, now that makes sence....

So, is there a way to change that, so an item with 255 durability when it hits 0, instead of going to -255, goes to just -5 instead. So that players aren't using an item with 255, for 510?
dadnlad is offline   Reply With Quote
Old 08-24-2008, 11:24 PM   #5 (permalink)
Forum Novice
 
Join Date: Jul 2004
Location: Lincoln, IL
Age: 35
Posts: 147
Send a message via MSN to Mad Clown
Default

i have never looked into that i would assume that would be in your baseweapon and basearmor scripts im heading to bed now ill have a look tomorrow and get back with ya if i find it
Mad Clown is offline   Reply With Quote
Old 08-24-2008, 11:36 PM   #6 (permalink)
Forum Novice
 
Join Date: Jul 2004
Location: Lincoln, IL
Age: 35
Posts: 147
Send a message via MSN to Mad Clown
Default

ok i lied lol i get into this and i know i wont get to sleep
i found this i tghink this is where its at and ita all math wont be somehting easy to fix


HTML Code:
		public virtual void UnscaleDurability()
		{
			int scale = 100 + GetDurabilityBonus();

			m_Hits = ((m_Hits * 100) + (scale - 1)) / scale;
			m_MaxHits = ((m_MaxHits * 100) + (scale - 1)) / scale;
			InvalidateProperties();
		}

		public virtual void ScaleDurability()
		{
			int scale = 100 + GetDurabilityBonus();

			m_Hits = ((m_Hits * scale) + 99) / 100;
			m_MaxHits = ((m_MaxHits * scale) + 99) / 100;
			InvalidateProperties();
		}

ok so basicly you have to do the math just a math update you always do the stuff in the () first then do whats outside

this i believe is where it is all computed hope it helps ya out


with out doing all the math you could just lower the durability on the item per say 127 or 128 which is about half of 255 so they are actually getting 255 out of the item but that will be up to you
Mad Clown is offline   Reply With Quote
Old 08-25-2008, 04:04 AM   #7 (permalink)
Forum Master
 
Lord_Greywolf's Avatar
 
Join Date: Dec 2005
Posts: 6,777
Send a message via Yahoo to Lord_Greywolf
Default

it never goes negative

the way it works (origional code is fine) is
hits goes to 0
once there - each time it is "damaged" it will loose 1 point from max dura
so if starting at 255 - will cound down 255 more "damages" untill then it is 0 also
then it will break

it does not count into negative numbers
if you want it to go faster when it hits 0 hp so it break sooner then modify this line:
--MaxHitPoints;
to something like this:
MaxHitPoints -= 20;
if (MaxHitpoints < 0) MaxHitPoints = 0;

and it will lower the max dura by 20 points at a time giving them basicaly 13 more "dammages" instead of 255
__________________
http://www.AoAUO.com

:) ..... Come for the Customs, Play for the Fun. Return to see your new Friends ..... :)
Lord_Greywolf is offline   Reply With Quote
Old 08-25-2008, 04:46 AM   #8 (permalink)
Newbie
 
dadnlad's Avatar
 
Join Date: Jul 2008
Age: 31
Posts: 35
Default

Greywolf, have I told you lately that your a genius.
dadnlad is offline   Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off



Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0 RC5