Page 1 of 2
Change the colour of lights? expressing 3d vector in lua
Posted: Tue Sep 18, 2012 12:58 pm
by Grimwold
This has been mentioned before in a different thread, but I think it got buried...
Does anyone know how to change the colour of light objects?
I've experimented with cloning a light object e.g. prison_ceiling_lights and it should be possible to change the colour using the lightColor attribute, which takes a 3D vector in the range 0-1 for Red Green and Blue, but I've tried the following and can't get it to work:
Code: Select all
lightColor = {1,0.5,0}
lightColor = (1,0.5,0)
Any help on how to express a 3D vector in lua?
Re: Change the colour of lights? expressing 3d vector in lua
Posted: Tue Sep 18, 2012 1:17 pm
by Komag
Is the FX:setLight not something that applies here?
Re: Change the colour of lights? expressing 3d vector in lua
Posted: Tue Sep 18, 2012 1:50 pm
by Grimwold
Komag wrote:Is the FX:setLight not something that applies here?
Maybe. I honestly haven't looked into the FX stuff.. I thought that was more for short duration special effect lighting ? All I really want at the moment is to create a ceiling light that is a different colour to the prison and temple ones.
(in the long term I would also like to create a torch lighting effect without having torches the player can pick up... but that's for another time.)
Re: Change the colour of lights? expressing 3d vector in lua
Posted: Tue Sep 18, 2012 3:03 pm
by Komag
I made a green room by:
- creating an "fx" item, placing it in the room, naming it "fxlight1"
- creating a script Lua item, placing it near the fx, and entering:
Code: Select all
fxlight1:setLight(0.2, 0.7, 0.3, 10, 20, 360000, true)
fxlight1:translate(0, 2, 0)
this creates a soft green light that will last 100 hours, and it is raised up off the floor to be nearer the ceiling
This may not really be the correct use of an fx, I'm not sure, but it works
One idea for permanent wall lighting might be a new custom model of something like an orb holder with an orb in it, and then just make an fx light in the corresponding location
Re: Change the colour of lights? expressing 3d vector in lua
Posted: Tue Sep 18, 2012 3:45 pm
by Grimwold
Sounds like a good workaround. I will give it a try.
I also have another option to try regarding the lightColor attribute, having done a little side-reading on lua...
but can't test that until I get home.
For the torch replacement thing... since I'm pretty hopeless with graphics... I wonder if there's a way to use the existing torch in holder graphic for a custom wall object... or perhaps have an alcove that gives off a light when a certain item is placed on it.
Can you stop FX that are running, say when an alcove deactivated?
Re: Change the colour of lights? expressing 3d vector in lua
Posted: Tue Sep 18, 2012 3:49 pm
by Komag
for the fx light to turn off you just have a script send another setLight with the same settings as before except duration which you set to 0.1 so it appears to immediately turn off
Re: Change the colour of lights? expressing 3d vector in lua
Posted: Tue Sep 18, 2012 4:09 pm
by petri
To create a 3D vector you should use the vec function, e.g. vec(1,0.5,0) returns a vector with elements 1, 0.5 and 0.
Re: Change the colour of lights? expressing 3d vector in lua
Posted: Tue Sep 18, 2012 4:21 pm
by Montis
oh if I only knew before that it was this easy...
Code: Select all
cloneObject{
name = "red_ceiling_light",
baseObject = "temple_ceiling_lamp",
particleSystem = false,
lightColor = vec(1,0,0), -- edit the numbers in brackets to any r,g,b values between 0 and 1 to change the light color
}
Re: Change the colour of lights? expressing 3d vector in lua
Posted: Tue Sep 18, 2012 4:30 pm
by LordGarth
Is there a way to change the flame on the torch or is this just changing the light.
also can a glimmer effect be place on a monster so i can have skeletons with flaming heads.
Thx,
LordGarth
Re: Change the colour of lights? expressing 3d vector in lua
Posted: Tue Sep 18, 2012 4:36 pm
by petri
LordGarth wrote:Is there a way to change the flame on the torch or is this just changing the light.
also can a glimmer effect be place on a monster so i can have skeletons with flaming heads.
Yes, you need custom particle systems for those. Asset Definition Reference has some details.