Doing this off the top of my head (and I SUCK at scripting), but I think this one is easy

Let us know if it doesn't work off the bat.
NOTE: You will need to replace some of this with your actual door names.
Create a "script entity" near the puzzle. First, you will need the key to be on a "trigger". An alcove or Altar will work great for this. On the right side of the editor, with the altar selected, choose "add connector" there will be a box that lets you choose "Activate", "deactivate", or "any". This is to select whether you want the connection to trigger when something is placed ON the altar (activate), taken OFF of the altar (deactivate, the one you want), or any change (put on OR taken off). Normally, deactivate will only work when the last item is removed, you can select the "always activate" box to make it react when ANYTHING is removed, regardless of how many objects are left. I would suggest not to do this, as the player could place a rock on the altar, then remove it to trigger the script. Now, connect the altar to the script entity, set to "deactivate", and paste this code into the SE (after changing the objects to your objects names, exact syntax is imperative):
Code: Select all
function takekey()
mydoor_1: close()
mydoor_2: open()
end
I hope that looks simple enough to you, it really is that straightforward. It will not be foolproof, resourceful modders will be able to find cracks in this and possibly cheat it (replacing the object in the correct order, etc.). And a better scripter could write a more complex script to counter that problem. But if you just want one door to open, and another to close, it should work fine.
This is a more secure code (but less likely to work right away, because,as I said, I'm not very good at this.)
Code: Select all
function takekey2()
for i in myaltar_1:containedItems() do
if i.name == "the_key" then
door_1:open()
door_2:close()
else
door_1:close()
door_2:open()
break
end
end
end
If this gives you trouble, remove an "end" and try it again. Otherwise, the first code may work for your purpose.
Hope this helps!