Page 1 of 1

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

Posted: Fri Jan 04, 2013 1:36 pm
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.

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

Posted: Sat Jan 05, 2013 8:43 am
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.

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

Posted: Sat Jan 05, 2013 1:21 pm
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