[HELP] I need a script for the Torch to goes off

Talk about creating Grimrock 1 levels and mods here. Warning: forum contains spoilers!
Post Reply
User avatar
Daght
Posts: 146
Joined: Sun Apr 15, 2012 12:28 pm
Location: Italy

[HELP] I need a script for the Torch to goes off

Post by Daght »

I'm creating my tribute to Dungeonquest Board Game, and i need a script to to light off the torch in a special room (3x3). And, in the script, the door will cloose untill the player light another torch. Is it possible?

And another script i need can be a small percentage on each step to burn more quickly the torches (the light's duration will decrease). This must be applied on the entire 32x32 dungeon level.
If we do not end the war, the war will end us.
dasarby
Posts: 28
Joined: Sun Dec 30, 2012 10:46 pm

Re: [HELP] I need a script for the Torch to goes off

Post by dasarby »

Adding a torch to a holder is easy:

Code: Select all

function AddTorch()
	torchHolder:addTorch()
end
Removing a torch from a holder seems to be a bit trickier. The best I can come up with actually destroys ALL torches at the cell that the torch holder is at, including ones that are on the ground:

Code: Select all

function RemoveTorch(torchHolder)
	for e in entitiesAt(torchHolder.level, torchHolder.x, torchHolder.y) do
		if e.name == "torch" then
			e:destroy()
		end
	end
end
As for the second part, are you talking about making torches on the walls dim after each step? I think you might be in for a bit of work for that, because I don't think that torches on the walls can be dimmed like torches that are held. I've only seen them be full brightness or burnt out when on the wall.

You might be able to pull it off by duplicating torches and torch holders, and creating/destroying lights based on torch fuel level.
User avatar
Komag
Posts: 3659
Joined: Sat Jul 28, 2012 4:55 pm
Location: Boston, USA

Re: [HELP] I need a script for the Torch to goes off

Post by Komag »

You could use a similar script to reduce their fuel such as setFuel(100) but that will only have an effect once you pick them up and use them - in the torchholders they will last forever and be just as bright
Finished Dungeons - complete mods to play
Post Reply