I´m currently getting started with modding in Grimrock 2.
For my new alcove puzzle, i want the Player to put 3 items from a specific type (here consumable) in an alcove. When he does that i want the items in the alcove to be destroyed and to spawn an item behind him. I also want the Event to trigger only once.
I used the following Code:
Code: Select all
function checkitems(alcove)
local count=0
for v,i in alcove:contents() do
if i:hasTrait ("consumable") then
count=count+1
end
end
if count==3 then
spawn("altar", 1, 26, 4, 0, 0).surface:addItem(spawn("diviner_cloak").item)
playSound("teleport")
hudPrint("Thank you")
party.party:shakeCamera(1,1)
end
if findEntity("dungeon_alcove_10") ~= nil then
for i, ent in dungeon_alcove_10.surface:contents() do
if ent:hasTrait ("consumable") then
ent.go:destroy()
end
end
end
end
endGreetings, Phil