How to check for a specific item on a pressure plate
Posted: Tue Oct 09, 2012 11:41 pm
It took me about an hour to figure this out, so I wanted to share it with everyone.
The goal was to get a specific item to trigger a pressure plate (only when the item is placed on the plate) and open a door.
Replace a1 with the specific ITEM ID, replace p1 with the specific PRESSURE PLATE ID, and replace d1 with the specific DOOR ID. It will open the door if and only if the item is placed on the plate. This LUA needs to be connected to the pressure plate that is used.
Enjoy!
P.S. I noticed that the post took away my perfect spacing(formatting) and I was wondering if anyone knows how to make it NOT do that? **EDIT** Thanks for the fix!
The goal was to get a specific item to trigger a pressure plate (only when the item is placed on the plate) and open a door.
SpoilerShow
function checkWhatActivated()
Code: Select all
if findEntity("a1") ~= nil then
if a1.x == p1.x and a1.y == p1.y and p1:isDown() then
d1:open()
end
end
endEnjoy!
P.S. I noticed that the post took away my perfect spacing(formatting) and I was wondering if anyone knows how to make it NOT do that? **EDIT** Thanks for the fix!