Author Topic: Adding a key, lock difficulty to an existing door  (Read 1005 times)

Offline Sticz

  • Planewalker
  • *****
  • Posts: 7
Adding a key, lock difficulty to an existing door
« on: August 23, 2006, 10:30:14 AM »
I am needing to add two additional lines of code to the block below, but I don't really know where to get them from. I want to add a specific key "PARKEY" to open it, and set the lock difficulty to 100. I was considering writing code to lock the door too, but should be able to do that with scripting since I am going to add .cres to the area anyways.

Is there an example of adding a key and setting the lock difficulty out there?

// makes doors actually require keys that they are listed as requiring
COPY_EXISTING ~AR2600.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 "DOOR02" = 0))
AND ("%usekey%" BOR 0b11111011 = 0b11111011)) BEGIN
WRITE_BYTE ("%door_off%" + 0x29 + ("%door_num%" * 0xc8)) ("%usekey%" BOR 0b00000100) // sets uses key bit



With Quick-Reply you can write a post when viewing a topic without loading a new page. You can still use bulletin board code and smileys as you would in a normal post.

Warning: this topic has not been posted in for at least 120 days.
Unless you're sure you want to reply, please consider starting a new topic.

Name: Email:
Type the letters shown in the picture
Listen to the letters / Request another image
Type the letters shown in the picture:
What color is grass?:
What is the seventh word in this sentence?:
What is five minus two (use the full word)?: