The Black Wyrm's Lair - Forums

Mod development resources & discussion => Modder's Workshop => Topic started by: Sticz on August 21, 2006, 08:14:08 PM

Title: Adding a lock and key to an existing Door
Post by: Sticz on August 21, 2006, 08:14:08 PM
I want to add a lock to an existing door that uses a key, and is not unlockable using pick-lock or knock.

What lines of code would I need for this, using WeiDu?

Sticz
Title: Adding a lock and key to an existing Door
Post by: Rabain on August 21, 2006, 09:49:19 PM
If the door already uses a key then most likely it is already not unlockable by pick-lock and knock.  If you have the key then you can open the door.

Is what you are trying to say that you want to make an existing door that can be opened by pick-lock and knock into a door that can't be opened unless you have a specific key?

I can't think of any instances in the game where a door has a key but also can be opened by pick-lock and knock.  Doors locked with keys are usually locked for a reason.

Making a door require a key that didn't previously require a key would require you to find the offset of option "key" and write an entry to that offset.  The Offset will be different depending on which door in which area you are looking to make the change for, NI will show you the offset.

As for the specific code required someone with more knowledge of write long/short hopefully will come by and oblige or set me right if I am wrong about any of the above.
Title: Adding a lock and key to an existing Door
Post by: Avenger_teambg on August 22, 2006, 09:55:36 AM
Modify the pick lock chance from 100 to something lower.
A picklock chance of 100 means it is unlockable, it is a special value.
Even a pick lock chance of 101 is unlockable (with extremely high skills).

It makes sense if not all keyed doors are story-tools. Or at least, not such obvious 'force the walkthrough path' style cheesy stuff.
Title: Adding a lock and key to an existing Door
Post by: Sticz on August 23, 2006, 12:42:24 PM
I have been fidgeting with a code to make a specific door locked, unpickable and using a key. The code below works for making it use a key. I now need an example of locking the door (which would be the same as this but only minor changes, I dont know what numbers to use inplace of BOR 0b00000100) specifying a key, and setting the lock-picking dificulty to 100.

// makes doors actually require keys that they are listed as requiring
COPY_EXISTING ~AR0329.ARE~ ~override~
READ_LONG 0xa4 "door_num"
READ_LONG 0xa8 "door_off"
WHILE ("%door_num%" > 0) BEGIN
SET "door_num" = ("%door_num%" - 1)
READ_ASCII ("%door_off%" + ("%door_num%" * 0xc8)) "doorname"
READ_BYTE ("%door_off%" + 0x29 + ("%door_num%" * 0xc8)) "usekey"
PATCH_IF ((("%doorname%" STRING_COMPARE_CASE "DOOR07" = 0) OR ("%doorname%" STRING_COMPARE_CASE "DOOR08" = 0))
AND ("%usekey%" BOR 0b11111011 = 0b11111011)) BEGIN
WRITE_BYTE ("%door_off%" + 0x29 + ("%door_num%" * 0xc8)) ("%usekey%" BOR 0b00000100) // sets uses key bit
END
END
BUT_ONLY_IF_IT_CHANGES

I have seen examples of what I am needing to do, they are too specific though, and will not allow the mod to work with other mods that may modify the area. Any examples? This set of code is from the G3 fixpack.


Sticz