Page 1 of 1

Alcove item remove

Posted: Sun Oct 07, 2012 3:58 pm
by DeDy
Hi, need help alcove script.
In alcove is "SnakeKey"
party take key = open pit
party insert key to alcove = close pit

Thanks

Re: Alcove item remove

Posted: Sun Oct 07, 2012 4:48 pm
by crisman
Try this script, but first you need to add a coounter. Don't forget to connect the alcove to the script with activate always ticked, and set to "any" the event.

function pitOpen()
counter:setValue(0)

for i in alcove:containedItems() do
if i.name == "SnakeKey" then
pit:close()
counter:setValue(1)
end
end

if counter:getValue() == 0 then
pit:open()
end

end

Re: Alcove item remove

Posted: Sun Oct 07, 2012 5:06 pm
by DeDy
counter is good idea, thanks

Re: Alcove item remove

Posted: Sun Oct 07, 2012 5:44 pm
by DeDy
If add false key to alcove script is not work. Please help.
SpoilerShow
function SnakeKey()
counter_snake_key:setValue(0)

for i in alcove_snake:containedItems() do
if i.name == "snake_key" and "snake_key_false" then
dungeon_pit_52:close()
dungeon_pit_53:close()
counter_snake_key:setValue(1)
end
end

if counter_snake_key:getValue() == 0 then
dungeon_pit_52:open()
dungeon_pit_53:open()
end
end

Re: Alcove item remove

Posted: Sun Oct 07, 2012 6:06 pm
by crisman
I need to know how the pits should behave.
They must close when both keys are inside the alcove?
I think... you want to swap the right key key with the fake one to keep the pits close, right?
If so, should be (haven't tested)
SpoilerShow
function SnakeKey()
counter_snake_key:setValue(0)

for i in alcove_snake:containedItems() do
if i.name == "snake_key" or i.name == "snake_key_false" then
dungeon_pit_52:close()
dungeon_pit_53:close()
counter_snake_key:setValue(1)
end
end

if counter_snake_key:getValue() == 0 then
dungeon_pit_52:open()
dungeon_pit_53:open()
end
end
EDIT: just realised you haven't put
i.name ==
right before "snake_key_false"
maybe it's just for that.

Re: Alcove item remove

Posted: Sun Oct 07, 2012 9:13 pm
by DeDy
work correct, thanks :)
player first take on alcove snake_key_false, after snake_key
must return false key to alcove = pit close (test combinations OK)