Page 2 of 2

Re: a little help ;)

Posted: Mon Sep 17, 2012 8:48 pm
by Billick
papazombie wrote:I wonder if you could write for 2 or more concretes items in 2 or more alcoves to open a door. For example; to open a door you have to put a dagger on the first alcove and a compass on the second alcove. I have tried to modify what you write but it doesnt work. Thanks again ;)
Hmm, that's a bit trickier, and there are a few way to do it, but I'll give it a go...

Code: Select all

function daggerCheck()
   for i in alcove_1:containedItems() do
      if i.name == "dagger" then
         compassCheck()
         return
      end
   end
end

function compassCheck()
   for i in alcove_2:containedItems() do
      if i.name == "compass" then
         my_door:open()
         return
      end
   end
end
Make sure that both alcoves are connected to the daggerCheck function in the script. The daggerCheck function will call the compassCheck function if it finds a dagger on the first alcove, and that will check for a compass on the second alcove. Also be sure to change the object IDs to the ones on your map. This should work, but I can't test it on this computer, so I make no guarantees :D

Edit: ninja'd by Magus! His uses a little bit different logic, but should work as well.