Page 1 of 1

(help) check script

Posted: Sun Jan 20, 2013 6:41 pm
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

Re: (help) check script

Posted: Sun Jan 20, 2013 7:04 pm
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 :)

Re: (help) check script

Posted: Sun Jan 20, 2013 7:30 pm
by hyteria
hehe thx , sometimes i feel idiot )