Counting items in an alcove

Talk about creating Grimrock 1 levels and mods here. Warning: forum contains spoilers!
User avatar
TheLastOrder
Posts: 104
Joined: Wed Oct 17, 2012 1:56 am

Re: Counting items in an alcove

Post by TheLastOrder »

Grimwold wrote:There is a way to do it with just counters, but you'd need to have 5 of them... 1 counter for each alcove initial value 1 which decrement when the alcove has an item inserted, and increment when the item is removed. Each of the 4 counters is linked to the 5th counter with decrement and increment events. the 5th counter has initial value 4 and when it reaches 0 the door opens.. if it deactivates then close the door.


To do the same puzzle with scripts all you need is to check alcove:getItemCount() ~= 0 for each one. e.g.

Code: Select all

function checkAlcoves()
  if alcove_1:getItemCount() ~= 0 and alcove_2:getItemCount() ~= 0 and alcove_3:getItemCount() ~= 0 and alcove_4:getItemCount() ~ 0 then
    temple_alcove_door:open()
  else
    temple_alcove_door:close()
  end
end
Oaoh!!!

Soooooooo easy as I can't believe it XDDDDDD To use different counters refering to a 5th one!!!

:D

One more time, Grimwold saving our modding-based lives :D

Thaaaaaanks man :)
Post Reply