I am trying to put three particular items on a floor trigger to open some mine_door_spears nearby. The items are dropped - not placed, so an alcove is not wanted. Once the items are dropped they open the door_ spear, but I need the items to be destroyed. I wanted it to only accept three specific items, and any other item dropped is obviously lost. I have used a script_auto_trigger to achieve this, but dropping any item opens the spear doors.
I have looked through the forums, but I am unable to make the script work. I have added destroy terms, but that just crashes back to the editor.
function surfaceContains(surface, item)
for v,i in surface:contents() do
if i.go.name == item then return true
end
end
end
function spawnSecretItems()
if surfaceContains(floor_trigger_12.surface, "blue_gem") or
surfaceContains(floor_trigger_12.surface, "green_gem") or
surfaceContains(floor_trigger_12.surface, "red_gem") then
mine_door_spear_79.door:open()
else
mine_door_spear_79.door:close()
end
end
end
self.go.floortrigger:addConnector('onActivate',self.go.id,'execute')
Any help would be appreciated.