
How can I check what's actually on my pressure plate?
All I want to do is switch off a forcefield when a certain item is placed onto and therefore activates it.
Cheers.
Code: Select all
function checkplate()
for i in self.go.map:entitiesAt(dungeon_pressure_plate_1.x,dungeon_pressure_plate_1.y) do
print(i.id)
end
end
-- Edit: Or like this...
function checkstuff(sender)
for j in self.go.map:entitiesAt(sender.go.x,sender.go.y) do
if j.id == "acolyte_staff_1" then
force_field_1.controller:deactivate()
end
end
end
Not really sure what you're trying to achive. You can hook up the script above to any number of plates (since it's based on caller id), but it will only check for the same item on all of them.Eleven Warrior wrote:Now this is a Script I am after. How can it done with more plates? Also can the Item id be any eg: it does not matter what the item id is if it's a rock on 1 plate and arrow on 2nd plate a door opens. Could be any arrow or rock on the chosen plate.
You can get the "type" of the entity (rock, arrow,...) with entity.nameEleven Warrior wrote:Now this is a Script I am after. How can it done with more plates? Also can the Item id be any eg: it does not matter what the item id is if it's a rock on 1 plate and arrow on 2nd plate a door opens. Could be any arrow or rock on the chosen plate.
Code: Select all
function entityIn(x, y, name)
for e in self.go.map:entitiesAt(x, y) do
if e.name == name then
return true
end
end
return false
end
if entityIn(3, 3, "rock") and entityIn(3, 4, "arrow") then
print("ye")
end