Weapon/Armor Decay hardcoded or dfn/js editable?

Forum where anything UOX3-related goes - including, but not limited to: newbie-support, ideas, general questions, comments, etc and-so-forth.
Post Reply
stranf
UOX3 Guru
Posts: 939
Joined: Wed Jan 04, 2006 3:59 pm
Has thanked: 0
Been thanked: 0

Weapon/Armor Decay hardcoded or dfn/js editable?

Post by stranf »

Somehow I placed my post in "fixes". Sheesh, it's been so long, I've forgotten how the forum works.

Anyway, my question is this:

It's been over a year. It seems the more stable UOx3 gets, the less people post.

Ah well, I'm trying to get back into the swing of things.

Now, I'd like to tweak the rate at which armor and weapons get damaged during combat. I can't find it in the DFN or JS. Is this hardcoded? I guess I could go through all of the DFNs for each weapons and tweak their durability, but it would seem MUCH easier to simply change the rate at which UO takes a point of a weapons durability.

Any thoughts?
User avatar
Xuri
Site Admin
Posts: 3704
Joined: Mon Jun 02, 2003 9:11 am
Location: Norway
Has thanked: 48 times
Been thanked: 8 times
Contact:

Post by Xuri »

Hey stranf, been a while :)

The rate at which armor and weapons get damaged during combat is indeed hardcoded.

Here's how it currently works:
  • When attacking, there's currently a 1/6 chance of damaging the weapon you're attacking with for -1 HP.
  • When defending, it's more tricky. First there's a 1/2 hardcoded chance of the possibility of damaging the armor-piece that's hit, then that is followed up by another hardcoded 1/2 chance of doing either 0 or 1 damage to said armor-piece (code comment states 0 to 2 damage, but it never does anything but 0 or 1). If I'm thinking about this the right way, that means a 1/2 * 1/2 = 25% chance of 1 damage, and 75% chance of 0 damage?
I think, however, that I'll add the following settings to UOX.INI to give you some more control over this aspect of the game, with default values being approximates of the current setup:

WEAPONDAMAGECHANCE=17
WEAPONDAMAGEMIN=0
WEAPONDAMAGEMAX=1
ARMORDAMAGECHANCE=25
ARMORDAMAGEMIN=0
ARMORDAMAGEMAX=1

(The damage settings support values from 0 to 255.)

This gives us the following setup:
  • When attacking, there'll now be a WEAPONDAMAGECHANCE (17% by default) chance of damaging the weapon you're attacking with for WEAPONDAMAGEMIN (0 by default) to WEAPONDAMAGEMAX (1 by default) HP.
  • When defending, there'll now be a ARMORDAMAGECHANCE (25% by default) chance of damaging the armor-piece that's hit for ARMORDAMAGEMIN (0 by default) to ARMORDAMAGEMAX (1 by default) HP.
(Note also that damage to weapons and armor only occurs for players, NPCs are excluded from all this.)

I guess the reality in UO back in 2003 was more complicated than this, with stuff like mace weapons doing more damage to armors than other weapons, but it'll hopefully be an improvement, at least. :)
-= Ho Eyo He Hum =-
stranf
UOX3 Guru
Posts: 939
Joined: Wed Jan 04, 2006 3:59 pm
Has thanked: 0
Been thanked: 0

Post by stranf »

That's awesome Xu. Exactly what I wanted!

One more request: Anyway we can add "combatspeed" to uoxini? I have all of my weapons and armors balanced the way we like them; however, combat seems a bit slow. If I can put in one variable that would globally scale the speed of the combat algorithm, I can adjust the speed of combat to my shard user's liking WITHOUT actually touching the hard-coded combat algorithm OR (even worse) editing ALL the DFNS for monsters, weapons, and armor to get things re-balanced at a new speed.

If we could put a COMBATSPEED under [speedup] this would solve everything. I don't need a UO 2003 complex combat, the UOX3 base algorithm (unless you guys changed it in the past 4 years) works great! We just want to increase weapon/armor damage and speed it up slightly. Everything else works fine.

ONE FINAL point, it's been awhile. Where do I download an experimental build with these awesome changes you are implementing?

And last, but not least: In return, I'm going to be posting a SPAWN for Ilshenar. It needs to be populated. I quick UO before that map was available, so it's most likely NOT going to be canon; however, it's going to be better than nothing for new users. I'll even update my worldfile when my team has completed the decs/statics for the cities, etc.

Good to see you are still around, and I look forward to the updated executable with your new code!
User avatar
Xuri
Site Admin
Posts: 3704
Joined: Mon Jun 02, 2003 9:11 am
Location: Norway
Has thanked: 48 times
Been thanked: 8 times
Contact:

Post by Xuri »

Good idea.

I'm adding the following settings:

GLOBALATTACKSPEED=1 // for adjusting speed of melee and ranged attacks globally for all chars
NPCSPELLCASTSPEED=1 // for adjusting the overlal speed (or delay between) spellcasts for NPCs

These settings will accept decimal values. Some example values:
GLOBALATTACKSPEED=0.9997 will decrease the overall global attack speed
GLOBALATTACKSPEED=2 will double the overall global attack speed
NPCSPELLCASTSPEED=1 will not have any affect on the overall NPC casting speed
NPCSPELLCASTSPEED=3.14159 will increase the overall NPC casting speed

Beware that the NPCSPELLCASTSPEED setting only affects hardcoded spellcasting, and won't have any effect on spells cast through JS scripts.

These changes aren't available anywhere just yet, still doing some testing and trying to make sure I haven't screwed up anything in the process of making them, but I'll make them available both on the CVS and as an experimental build soonish(TM).
-= Ho Eyo He Hum =-
User avatar
Xuri
Site Admin
Posts: 3704
Joined: Mon Jun 02, 2003 9:11 am
Location: Norway
Has thanked: 48 times
Been thanked: 8 times
Contact:

Post by Xuri »

Alright, it's up on the CVS. Check this thread for changelog, and go over here for experimental build.
-= Ho Eyo He Hum =-
stranf
UOX3 Guru
Posts: 939
Joined: Wed Jan 04, 2006 3:59 pm
Has thanked: 0
Been thanked: 0

Post by stranf »

Awesome Xuri! Thanks! Downloading and testing now.

This is why I've never bothered to check into other emulators. Even after a couple of years hiatus, the speed at which you guys can implement and post even small changes is astounding. What may seem trivial to you guys adds hours of enjoyment for the players on my shards. So thanks for all the help.
stranf
UOX3 Guru
Posts: 939
Joined: Wed Jan 04, 2006 3:59 pm
Has thanked: 0
Been thanked: 0

Post by stranf »

So I ran the new executable with a blank INI in order to generate a default (a new INI was not supplied on the experimental build).

Sadly, when I edit a value, it says:

Code: Select all

ERROR: Malformed location entry in ini file
repeated 9 times.

Odd?
Last edited by stranf on Sun Nov 10, 2013 4:41 am, edited 1 time in total.
User avatar
Xuri
Site Admin
Posts: 3704
Joined: Mon Jun 02, 2003 9:11 am
Location: Norway
Has thanked: 48 times
Been thanked: 8 times
Contact:

Post by Xuri »

Oops, forgot to include an updated uox.ini. Adding them manually should work, though. They'll also be automatically added the first time you do a worldsave.

There's one other file that's been updated: js/magic/level1targ.js
-= Ho Eyo He Hum =-
stranf
UOX3 Guru
Posts: 939
Joined: Wed Jan 04, 2006 3:59 pm
Has thanked: 0
Been thanked: 0

Post by stranf »

Xu, just edited my above post, I did the "default" world file trick, but now I'm getting a malformed location entry. Weird?


//Edit

First test, set combatspeed to 0.75 (still malformed entry errors). Combat seemed slower, and the PC always faced NorthWest before the swing sound (no swinging animation). Combat seemed slower. UOX3 crashed.

Retrying. This time setting the speed to 2.

//Edit
Speed Setting 2 was a hoot! A bit too fast, animations were better, but an occasional swing facing North West (this reminds me of an old error we had years ago).

Uox3 crashed again though. I'm running client version 5.0.1i, for what it's worth. Not only that, but my callback scripts are failing now. "Handled exception in cScript.cpp DoCallback()". My old server was v0.95-4.0h, which is a bit old. Maybe I'm missing some critical files other than the JS.dll and the UOX3.exe (which I copied straight across). I'll keep playing with it..
stranf
UOX3 Guru
Posts: 939
Joined: Wed Jan 04, 2006 3:59 pm
Has thanked: 0
Been thanked: 0

Post by stranf »

Xu,

I'm turning in for the night, but here is what I've done so far:

I've updated nearly all the stock JS scripts and File Associations. This seems to have solved the "crashing while in combat". Combat animations also seem better, except for the "Uox3 legacy bug" of randomly facing the wrong way every now and then...I can live with that.

My "Malformed" error is gone now too. I can edit and upload UOx.ini at will.

However, I keep crashing when using targeted scripts. My custom scripts give the "Handled exception in cScript.cpp DoCallback()".

I even got the shard to crash while using the stock "Forensic Evaluation" on a dead orc. Anatomy has also given me crashes.

Any thoughts on this? Is your build giving you any similar trouble?

Thanks again for all the help.

// One final addition: The new axe.js script seems to have fixed a bug where I couldn't chop wood in Ilshenar. However, I only got one swing in before the server crashed. No error reported. I'm going to try and see if the fresh experimental build has these error, if not, I'll slowly add my custom scripts and DFNs over until I find the culprit...
User avatar
Xuri
Site Admin
Posts: 3704
Joined: Mon Jun 02, 2003 9:11 am
Location: Norway
Has thanked: 48 times
Been thanked: 8 times
Contact:

Post by Xuri »

Hm. Could you try see if you get those same crashes when running UOX3 using only the default files contained in the experimental zip? Then slowly re-introduce your custom scripts to see where it might be going wrong?

Also, on a general note: if you've upgraded directly from 0.95-4.0h to the experimental build, there are likely many other files you'll need apart from the JS and UOX3.exe. Dictionaries have been updated, plus various DFN changes that have happened since then might be required (creatures.dfn needed for swing animations to work properly, for instance). One hot tip would be to run something like WinMerge to make it very easy to see the exact differences between your current setup and the latest.

The malformed location entries might be because cliloc-entries have been added at the end of those entries for the default starting locations to work properly. Example of starting locations with cliloc-entries:

Code: Select all

[start locations]
{
LOCATION=Yew,Center,545,982,0,0,1075072
LOCATION=Minoc,Tavern,2477,411,15,0,1075073
LOCATION=Britain,Sweet Dreams Inn,1495,1629,10,0,1075074
LOCATION=Moonglow,Docks,4406,1045,0,0,1075075
LOCATION=Trinsic,West Gate,1832,2779,0,0,1075076
LOCATION=Magincia,Docks,3675,2259,20,0,1075077
LOCATION=Jhelom,Docks,1492,3696,0,0,1075078
LOCATION=Skara Brae,Docks,639,2236,0,0,1075079
LOCATION=Vesper,Ironwood Inn,2771,977,0,0,1075080
}
If you keep crashing and can reproduce those crashes at will, feel free to zip up your UOX3 folder (sans world-files and account-folder) and I'll check it through debug mode and see what I can find.

Also, finally - you mention the "face northwest at random times in combat"-bug. Was that not present in 0.95-04?
-= Ho Eyo He Hum =-
stranf
UOX3 Guru
Posts: 939
Joined: Wed Jan 04, 2006 3:59 pm
Has thanked: 0
Been thanked: 0

Post by stranf »

Ok, Xuri,

I've done a lot of DFN and JS porting over and found, so far, that combat crashing appears to be random when a weapon or armor created before the server update is involved in combat. Using new items seems to be stable. This is acceptable.

But I can't get my custom armslore script to work anymore. First it seemed to be crashing because it was looking for the "race" tag on weapons. It appears that base_item.dfn has removed the RACE tag. So I guess no more "double damage" on races anymore? So I removed that portion of the script.

Now, I get this error:

ERROR: Handled exception in cScript.cpp DoCallback().

The custom script uses a d100 roll vs. a set DC (minus skill) to reveal information of the object.

Here is my code:

Code: Select all

function SkillRegistration()
{
	RegisterSkill( 4, true );	// Arms Lore
}

function onSkill( pUser, objType, skillUsed )
{
	var pSock = pUser.socket;
	if( pSock )
		pSock.CustomTarget( 0, GetDictionaryEntry( 855, pSock.Language ) );

	return true;
}

function onCallback0( pSock, ourObj )
{
	var pUser = pSock.currentChar;
	if( ourObj && ourObj.isItem && pUser )
	{
		
		// variable set up
		pUser.CheckSkill( 4, 0, 1000 );   //run dummy function for skill gain purposes only.
		
		var ourDef = ourObj.Resist( 1 );
		var ourLoDmg = ourObj.lodamage;
		var ourHiDmg = ourObj.hidamage;
		var ourStr = ourObj.strength;
		var ourHealth = ourObj.health;
		var ourMaxHP = ourObj.maxhp;
		var ourSpeed = ourObj.speed;
		var ourMorex = ourObj.morex;
		var ourMorey = ourObj.morey;
		var ourMorez = ourObj.morez;
		var ourMore = ourObj.more;
		var ourType= ourObj.type;
		var ourLayer= ourObj.layer;
		var ourDef= ourObj.Resist(1);
        var alore = pUser.skills.armslore/ 10;
        
        //Base DC parameter setup.  Use for balancing.  % chance is determined by 100-DC.  For base setup
        //weapon condition is a 15% chance (85)
        //weapon damage is a 0% chance (100)
        //weapon specials is a -15% chance (115)
        //The combined die-roll (1-100) + armslore skill (1 point per 1 skill) must be greater than the DC for
        //success
        
        var DcCondition = 85;
        var DcDamage = 100;
        var DcSpecial = 130;
        
	//Base weapon check (any skill)
	
	var condition = ourHealth / ourMaxHP;
	
	if (condition > .98)				
	    {
		pUser.SysMessage("This " + ourObj.name + " looks like new.");    //display when new
	   }
   else if (condition > .24)
       {
	     pUser.SysMessage("This " + ourObj.name + " is worn.");  	//display when greater than 25%
       }
   else
      pUser.SysMessage("This " + ourObj.name + " is badly damaged.");    //display when less than 25%
		
       if (ourLayer == 1)
			pUser.SysMessage("One Handed");
	   if (ourLayer == 2) 
	        pUser.SysMessage("Two Handed");
	}
	
	
	// DC roll setup and dice roll (1-100)
	var roll = RandomNumber( 1, 100 );
	var DCcheck = roll + alore;        //DC check is 1-100 dice + 1 point per skill.  Keep as float so that "tenths" of a 

skill count.
	//pUser.SysMessage(DCcheck);  //debug
	
	//First check.  Weapon condition.  DC = 15% chance + 1 point per skill to display weapon condition
	if (DCcheck > DcCondition)
	{
	pUser.SysMessage("Condition: " + ourHealth + "/" + ourMaxHP);	
	    
	}
	
	//Second check.  Weapon Damage.  DC = 0% + 1 point per skill
	
	if (DCcheck > DcDamage)
	{
	pUser.SysMessage("Damage: " + ourLoDmg + "-" + ourHiDmg);	
	pUser.SysMessage("Speed: " + ourSpeed);
	pUser.SysMessage("Strength Required: " + ourStr);
	
	if (ourDef > 1)
	   pUser.SysMessage("Resist: " + ourDef);
	}
	
	
	

}
Any thoughts?
User avatar
Xuri
Site Admin
Posts: 3704
Joined: Mon Jun 02, 2003 9:11 am
Location: Norway
Has thanked: 48 times
Been thanked: 8 times
Contact:

Post by Xuri »

Hm.. The race tag should still be usable - the list of tags in base_item is not complete, and anything that's not there will get added with their hardcoded default values (usually 0) in any case, so that shouldn't(TM) be the cause of your problems.

As for the script you posted, it seems to be working on my side without any problems, unfortunately (which makes it hard to debug for me). Using your custom armslore script and targeting a random item returns some text like "looks like new" and "Two Handed", with no errors in console. :/

The client/server-versions I've tried (works fine in each case):
Client 4.0.11a + UOX3 0.98-4.0h
Client 4.0.11a + UOX3 0.99.2c
Client 5.0.0b + UOX3 0.98-4.0h
Client 5.0.0b + UOX3 0.99.2c
Client 6.0.12.3 + UOX3 0.98-4.0h
Client 6.0.12.3 + UOX3 0.99.2c

Does the crash with this script happen with items that existed prior to your upgrade as well as with new items?
-= Ho Eyo He Hum =-
stranf
UOX3 Guru
Posts: 939
Joined: Wed Jan 04, 2006 3:59 pm
Has thanked: 0
Been thanked: 0

Post by stranf »

Found the error:

It seems the new dice and cup (5020) and Bedroll (5021) scripts were sharing script numbers with two obsolete custom magic item scripts. Easy enough to delete the offending 5020 and 5021 entries.

Why those entries were effecting an 804 armslore script, and NOT my global script 0 is beyond me; however, I'm wondering if my random combat crashes were part of the same issue, as I have a custom two-handed weapon swing as well as flame weapon animation which uses script 0.

So far so good, thanks for your help Xuri, and this new Uox3 version is awesome. Kudos to the entire community..
User avatar
Xuri
Site Admin
Posts: 3704
Joined: Mon Jun 02, 2003 9:11 am
Location: Norway
Has thanked: 48 times
Been thanked: 8 times
Contact:

Post by Xuri »

Glad to hear you found a solution :)
-= Ho Eyo He Hum =-
stranf
UOX3 Guru
Posts: 939
Joined: Wed Jan 04, 2006 3:59 pm
Has thanked: 0
Been thanked: 0

Post by stranf »

The error is back.

I even loaded an empty experimental build and used both anatomy and armslore STOCK scripts (as uploaded on the experimental build). Created a new PC on the Guest1 account and used arms lore on the equipped sword provided when created a new Paladin.

Handled exception in cScript.cpp DoCallback().

I downloaded a new experimental build and the same thing. Think a file is corrupt or is something really messed up on my PC? I thought I had this random bug licked..
stranf
UOX3 Guru
Posts: 939
Joined: Wed Jan 04, 2006 3:59 pm
Has thanked: 0
Been thanked: 0

Post by stranf »

Playing around some more, the crash exists with the "stock" setup available for download in the experimental build thread. Happens everytime now, I'm not sure how I got it to work previously...

I'm using client 5.0.1i.

Not sure what this is, the old server still works fine. Maybe JS32.dll or the *.exe is lightly corrupted on the download page?

[edit, update]

Re-downloaded both experimental and official builds. Found that my experimental build was corrupted. Scripts work until I copy my DFN entries over, I located the offending file to skills.dfn. All I did was modify the values to speedup skill-gain and changed a couple of the skills. This was done years ago and has never been a problem. Now I'll have to go through and find out where my error is in the DFN. Shouldn't be too hard.

I'll report back when I find the offending entry, but it looks like *crosses fingers* I have the problem solved.....again.
dragon slayer
UOX3 Guru
Posts: 776
Joined: Thu Dec 21, 2006 7:37 am
Has thanked: 4 times
Been thanked: 26 times

Post by dragon slayer »

I'm working on a fix for you soon as I find the line that crashes it.
dragon slayer
UOX3 Guru
Posts: 776
Joined: Thu Dec 21, 2006 7:37 am
Has thanked: 4 times
Been thanked: 26 times

Post by dragon slayer »

I'm using the build from the boards that xuri made and I can not get it to crash.

I'm using client muls I posted and the lastest uo client version 7.0.34.2
stranf
UOX3 Guru
Posts: 939
Joined: Wed Jan 04, 2006 3:59 pm
Has thanked: 0
Been thanked: 0

Post by stranf »

Thanks dragon slayer!

I found the bug, it was in skills DFN. I had customized my skill gain algorithms and as such never upgrade skills DFN. The recent updates have added new skills which took the same number as str, dex, int, etc. when running a skill script, there were more identified skills in the JS folders and less itentified by DFN, so Uox3 simply gave up the ghost.

I added the new skills to the DFN and assigned the current skill numbers to the attributes and I've been gold. Loving the new updates!
Post Reply