Torch activation help please (solution found)

Talk about creating Grimrock 1 levels and mods here. Warning: forum contains spoilers!
User avatar
Xzalander
Posts: 62
Joined: Thu Sep 13, 2012 1:27 pm
Location: Yorkshire, United Kingdom

Re: Torch activation help please

Post 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"
Last edited by Xzalander on Wed Sep 19, 2012 11:49 pm, edited 1 time in total.
User avatar
Neikun
Posts: 2457
Joined: Thu Sep 13, 2012 1:06 pm
Location: New Brunswick, Canada
Contact:

Re: Torch activation help please

Post 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.
"I'm okay with being referred to as a goddess."
Community Model Request Thread
See what I'm working on right now: Neikun's Workshop
Lead Coordinator for Legends of the Northern Realms Project
  • Message me to join in!
User avatar
Xzalander
Posts: 62
Joined: Thu Sep 13, 2012 1:27 pm
Location: Yorkshire, United Kingdom

Re: Torch activation help please

Post 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
User avatar
Neikun
Posts: 2457
Joined: Thu Sep 13, 2012 1:06 pm
Location: New Brunswick, Canada
Contact:

Re: Torch activation help please

Post 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.
"I'm okay with being referred to as a goddess."
Community Model Request Thread
See what I'm working on right now: Neikun's Workshop
Lead Coordinator for Legends of the Northern Realms Project
  • Message me to join in!
User avatar
Xzalander
Posts: 62
Joined: Thu Sep 13, 2012 1:27 pm
Location: Yorkshire, United Kingdom

Re: Torch activation help please

Post 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:
User avatar
Neikun
Posts: 2457
Joined: Thu Sep 13, 2012 1:06 pm
Location: New Brunswick, Canada
Contact:

Re: Torch activation help please

Post 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?"
"I'm okay with being referred to as a goddess."
Community Model Request Thread
See what I'm working on right now: Neikun's Workshop
Lead Coordinator for Legends of the Northern Realms Project
  • Message me to join in!
KouDy
Posts: 3
Joined: Sun Sep 30, 2012 11:24 pm

Re: Torch activation help please (solution found)

Post 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?
User avatar
Komag
Posts: 3658
Joined: Sat Jul 28, 2012 4:55 pm
Location: Boston, USA

Re: Torch activation help please (solution found)

Post 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"
Finished Dungeons - complete mods to play
KouDy
Posts: 3
Joined: Sun Sep 30, 2012 11:24 pm

Re: Torch activation help please (solution found)

Post 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
User avatar
Trap
Posts: 67
Joined: Mon Sep 24, 2012 2:09 am

Re: Torch activation help please (solution found)

Post 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 ).
Post Reply