[FIXED] Doors not locking?

Here we stuff all the bugs we've managed to squash/squish/squelch.
Locked
stranf
UOX3 Guru
Posts: 939
Joined: Wed Jan 04, 2006 3:59 pm
Has thanked: 0
Been thanked: 0

Doors not locking?

Post by stranf »

This is a bug I noticed awhile back but apperently forgot to post.

I wonder if someone could verify this.

I set a door to the "locked door" type, as per Xuri's guide. (I can't recall type number off of the top of my head). I didn't specify a more value for a key, I just wanted a locked door.

When my PC clicked on the door it says "You unlock the door and quickly lock it behind you" as if I had a key to it. Basically the locked doors are broken.

Can someone see if this occurs on their shard also?
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 »

Verified. As long as the door is of TYPE 13 (locked door), anyone can open it by doubleclicking on it.

I think the "You unlock the door and quickly lock it behind you" is intended for players who are carrying the key to their house, and for GMs that automatically unlock any doors they open. :P
-= Ho Eyo He Hum =-
giwo
Developer
Posts: 1780
Joined: Fri Jun 18, 2004 4:17 pm
Location: California
Has thanked: 0
Been thanked: 0

Post by giwo »

Off the top of my head it's taking the default more value of the door (0) and looks for an object in your pack with the same more value (0) as a key. I'm thinking we just need a check if( more == 0 ) don't look for a key
Scott
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 »

Yep. Just tested giving a door with type 13 a random more value now, and the player could no longer automagically unlock it without a key. :)
-= Ho Eyo He Hum =-
giwo
Developer
Posts: 1780
Joined: Fri Jun 18, 2004 4:17 pm
Location: California
Has thanked: 0
Been thanked: 0

Post by giwo »

in doors.js

Replace this

Code: Select all

function FindKey( pUser, iUsed )
{
	var foundKey = false;
	var pPack = pUser.pack;
	if( pPack != null )
		foundKey = FindKeyInPack( pUser, pPack, iUsed );
	
	return foundKey;
}
with this

Code: Select all


function FindKey( pUser, iUsed )
{
	var foundKey = false;
	if( iUsed.more > 0 )
	{
		var pPack = pUser.pack;
		if( pPack != null )
			foundKey = FindKeyInPack( pUser, pPack, iUsed );
	}
	
	return foundKey;
}

Let me know if you run into any issues, or that doesn't resolve the problem (I'm far too lazy to test it myself).
Scott
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 »

Looks like a fix! :)
-= 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 »

Thanks Giwo. I will be testing out this script as soon as I get some free time.
Locked