Page 1 of 1
Multiple activation elements...
Posted: Thu Sep 13, 2012 7:46 pm
by RyNo
Hi guys and girls
I'm trying out the dungeon editor and wanted to set up a puzzle where for example two empty torch holders require torches to activate something... I can set it up so they both activate something individually, but I want the holders to all need torches before the activation occurs.
Any ideas? Hope I've explained this well enough.
Cheers.
Re: Multiple activation elements...
Posted: Thu Sep 13, 2012 7:48 pm
by Aazlan
Use the counter thingy... attach the torch holders to the counter, then attach the counter to whatever should be activated. Hope that helps =)
Re: Multiple activation elements...
Posted: Thu Sep 13, 2012 8:05 pm
by Magus
Or you create simple scripts like:
Code: Select all
function secretdoorevent01()
if torch01:hasTorch() == true and
torch02:hasTorch() == true then
secretdoor01:open()
else
secretdoor01:close()
end
end
You need to rename torch01, torch02 and secretdoor01 of course.
You can find more about scripting here:
http://www.grimrock.net/modding/how-to- ... tion-lock/
Re: Multiple activation elements...
Posted: Thu Sep 13, 2012 8:58 pm
by RyNo
Couldn't get the counter to work, but I managed to get a script running... First time I've messed about with that so I'm happy I eventually got it working. Thanks for pointing me in the right direction Magus
I've used the following to achieve activation, but I'd like deactivation if the torches are removed which I can't seem to get working... Any suggestions? Sorry if it's a stupid question, I'm new to scripting.
function teleporterevent()
if torch_holder_10:hasTorch() == true and
torch_holder_11:hasTorch() == true then
teleporter_3:activate()
end
end
I did try using " else teleporter_3:deactivate() " but that didn't seem to deactivate the teleporter when torches were removed

Re: Multiple activation elements...
Posted: Thu Sep 13, 2012 9:06 pm
by Montis
imho it should work when you use this script in a lua script entity (with the "else" part) and you connect both torch holders to the script entity with an "any" event.
Re: Multiple activation elements...
Posted: Thu Sep 13, 2012 9:11 pm
by antti
RyNo wrote:I did try using " else teleporter_3:deactivate() " but that didn't seem to deactivate the teleporter when torches were removed

It could be because the function is triggered only when the torch holders are activated (eg. when a torch is inserted into them). Check the inspectors of the torch holders and set the actions to "any".
The trusty print() is your friend when trying to figure out problems like these.

Re: Multiple activation elements...
Posted: Thu Sep 13, 2012 9:33 pm
by Magus
Ah yeah sry i forgot about that^^
Like antti said, always use print() for debugging, thats a wisdom for your life^^
Re: Multiple activation elements...
Posted: Thu Sep 13, 2012 9:33 pm
by RyNo
Thanks for the replies both... I put the "else" part of my script back in and changed the "Event" on the torch holders to "any" like you said Antti and it now works perfectly

Much appreciated. Starting to get to grips with this now
