Page 2 of 2
Re: How to script torch holders?
Posted: Tue Oct 28, 2014 11:48 am
by Grimfan
What Prozail said though you can also use getItem() instead of getHasTorch() for torch holders, as in...
Code: Select all
function TorchPuzzle1()
if t1.socket:getItem() and t2.socket:getItem() then
dungeon_secret_door_10.door:open()
else
dungeon_secret_door_10.door:close()
end
end
Re: How to script torch holders?
Posted: Tue Oct 28, 2014 11:58 am
by Jouki
Mysterious wrote:Ok I have 2 torch holders named t1 and t2. The first to Scripts work, but the 3rd Script does not. Does anyone know how to fix this I have tried for 3 hours lol.
function TorchPuzzle1()
if t1.controller:getHasTorch() == true and
if t2.controller:getHasTorch() == true then ---Error is here---
If you want create a multiply condition you can use only 'and'. The second 'if' is not required. btw if you want negative you condition write 'not' for example:
Code: Select all
if t1.controller:getHasTorch() == true and not
t2.controller:getHasTorch() == true then
yeah this is a bad example because a return value of conditions are boolean but if you have something like
Code: Select all
if not counter1.counter:getValue() == 5 and
t2.controller:getHasTorch() == true then
bla bla bla bla
Re: How to script torch holders?
Posted: Sat Nov 08, 2014 2:52 pm
by Mysterious
Hi ok I have this atm:
1 - counter called. counter1 value = 5
1 - Torch called. t2
I have connected t2 to the Script, thinking when I take the torch out after 5 times the door would open, but the door does not open. I am not sure what I am doing wrong, I thought the counter1 decrements auto like. I would also like to have multiple torch holders to open the door e: t1, t2, t2 etc.. Some may need torches some not. Thxs for any assistance
Code: Select all
function torchpuz1a()
if not counter1.counter:getValue() == 5 and
t2.controller:getHasTorch() == true then
dungeon_door_wooden_11.door:open()
end
end
Re: How to script torch holders?
Posted: Sat Nov 08, 2014 5:24 pm
by Jouki
If you mean this one:
video
here's the guide:
Code: Select all
torchCounter = 0
function DoItFiveTimes()
torchCounter = torchCounter + 1
if torchCounter >= 5 then ourDoor.door:open() end
end
