Page 2 of 3

Re: Torch activation help please

Posted: Wed Sep 19, 2012 11:36 pm
by Xzalander
Neikun have you tried doing what Montis has suggested yet?

I had the same problem with torches not having a reaction when removed > viewtopic.php?f=14&t=3099&start=30#p32633
I then changed the Torchholders activation from on Activate to Any. That resolved it. The sample I give there should be adaptable to work with pits instead of doors but I'll see if I can recreate this in a sample dungeon and If I can I'll drop the code here.

Right, how many Pits are we talking here? Because as Montis said in his post, you can ever so easily rig up a Pit that opens and closes via a torch by literally just setting the Torch Connector to

"ANY > dungeon_pit_1 > Toggle"

Re: Torch activation help please

Posted: Wed Sep 19, 2012 11:47 pm
by Neikun
That code bit confuses me, and I don't really see where or how to set activation to any.
If you could explain it specific to this code, I might be able to pick up on it, I think.
Thank you.

One pit per torch holder.

Re: Torch activation help please

Posted: Wed Sep 19, 2012 11:50 pm
by Xzalander
You dont need to code it.

Click the Torch holder, link it to the pit. On the torch holder once linked will have a drop down box under Event with the options Activate, Deactivate and Any.

Image

Re: Torch activation help please

Posted: Wed Sep 19, 2012 11:52 pm
by Neikun
Oh my god. oh my god I feel so silly!
I did not realize there was a drop down menu there!
*hides head in dirt*
Oh I'm so foolish
lol
Thank you.

Edit: Tested, success. Oh how the sound of pits opening has never sounded so sweet.

Hey! this fixes my issue with levers too, Where I'd flip the lever, then hafta flip it up to reset it if I wanted to flip it again.

Re: Torch activation help please

Posted: Wed Sep 19, 2012 11:59 pm
by Xzalander
Neikun;

Incase you ever have a need to script it:

Code: Select all

function torchpit()
   if torch_holder_30:hasTorch() == true then
   dungeon_pit_13:open()
else
	dungeon_pit_13:close()
	
end end
You still need to set the torch holder to any, but using that above you can tie multiple torches to a single pit (as per the Combination Torch Lock).
Also you can reverse the open / close states and obviously you'd need to rename the torch_holder and dungeon_pit entries.

Also youll be able to specify multiple pits and torches at once in a single script, so it would save you leg work in the long run with all those connections. :mrgreen:

Re: Torch activation help please

Posted: Thu Sep 20, 2012 12:02 am
by Neikun
Thank you very much. You've been most helpful.

Truth be told when Montis said set activation any
I was like "WAHT THAT EVEN IS?"

Re: Torch activation help please (solution found)

Posted: Tue Oct 09, 2012 11:51 am
by KouDy
I am trying to figure out torches combination for secret door opening. Trying it out with 2 holders just for a test. I'm nost sure if i followed correctly but i cannot achieve desired result.
So i have following :
dungeon_secret_door_1
torch_holder_5
torch_holder_6
script_entity_1

Script has this :

Code: Select all

function torches1 ()
	if torch_holder_6:hasTorch () == true and
	torch_holder_5:hasTorch () == true then
		if dungeon_secret_door_1:isClosed () then
		dungeon_secret_door_1:open()
		else dungeon_secret_door_1:close()
		end
	end
end
I placed connectors from holders to door. That leads to door being open upon first torch placed into holder.
When i place connectors from holders to the script object, door won't even open.

What am i doing wrong here?

Re: Torch activation help please (solution found)

Posted: Tue Oct 09, 2012 2:38 pm
by Komag
first thing, don't have a space before all the (), so it should be torches1() for example, and the other ones too. Also, no need to check whether the door it closed before opening it, just send the open command. Also, you can leave off the == true if you want.

Code: Select all

function torches1()
  if torch_holder_6:hasTorch() and
  torch_holder_5:hasTorch() then
    dungeon_secret_door_1:open()
  else
    dungeon_secret_door_1:close()
  end
end
be sure to connect both torches to the script with Event "any"

Re: Torch activation help please (solution found)

Posted: Tue Oct 09, 2012 3:37 pm
by KouDy
Yes it's spaces before the ()... How stupid is that. I am returning here to edit the post and finding your answer same time :)

When you take my original code and just fix the spaces the script works. But door won't close when you remove the torch. So i removed the check for closed door and now it works how it should.
Corrected code is here :

Code: Select all

function torches1()
	if torch_holder_6:hasTorch() == true and
	torch_holder_5:hasTorch() == true then
		dungeon_secret_door_1:open()
	else dungeon_secret_door_1:close()
	end
end

Re: Torch activation help please (solution found)

Posted: Wed Oct 10, 2012 2:09 am
by Trap
wasn't sure if someone answered you but..

== means "is equal to"
where = means "this IS this" ( usually used for assigning a variable ).