(help) check script

Talk about creating Grimrock 1 levels and mods here. Warning: forum contains spoilers!
Post Reply
hyteria
Posts: 266
Joined: Sat Dec 29, 2012 8:22 pm

(help) check script

Post by hyteria »

hello

Code: Select all

function check()
   local valid = {"gor_coin_copper"}
	local counter = 0   

   for i in altar_2:containedItems() do
      local ok = false
      for j = 1,#valid do
         if i.name == valid[j] then
            counter = counter + 1
            ok = true
            break
         end
      end
      if not ok then
         counter = -1
         break
      end
   end

   for i in altar_3:containedItems() do
      local ok = false
      for j = 1,#valid do
         if i.name == valid[j] then
            counter = counter + 1
            ok = true
            break
         end
      end
      if not ok then
         counter = -1
         break
      end
   end
   for i in altar_4:containedItems() do
      local ok = false
      for j = 1,#valid do
         if i.name == valid[j] then
            counter = counter + 1
            ok = true
            break
         end
      end
      if not ok then
         counter = -1
         break
      end
   end
   for i in altar_5:containedItems() do
      local ok = false
      for j = 1,#valid do
         if i.name == valid[j] then
            counter = counter + 1
            ok = true
            break
         end
      end
      if not ok then
         counter = -1
         break
      end
   end
   
  -- print(counter)
   
   if counter == 4 then
	northern_dungeon_wall_grating_3:open()
   end
end
this is a basic check altar puzzle to open a door , but i miss a line if player get back item on altar to close the door , can someone help plz?

thx
User avatar
msyblade
Posts: 792
Joined: Fri Oct 12, 2012 4:40 am
Location: New Mexico, USA
Contact:

Re: (help) check script

Post by msyblade »

You can simply connect the alcove directly to close on deactivate, and check the "activate always" box so they cannot lay something else then pick up the item. No scripting required :)
Currently conspiring with many modders on the "Legends of the Northern Realms"project.

"You have been captured by a psychopathic diety who needs a new plaything to torture."
Hotel Hades
hyteria
Posts: 266
Joined: Sat Dec 29, 2012 8:22 pm

Re: (help) check script

Post by hyteria »

hehe thx , sometimes i feel idiot )
Post Reply