Change the colour of lights? expressing 3d vector in lua

Talk about creating Grimrock 1 levels and mods here. Warning: forum contains spoilers!
User avatar
Grimwold
Posts: 511
Joined: Thu Sep 13, 2012 11:45 pm
Location: A Dungeon somewhere in the UK

Change the colour of lights? expressing 3d vector in lua

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

Re: Change the colour of lights? expressing 3d vector in lua

Post by Komag »

Is the FX:setLight not something that applies here?
Finished Dungeons - complete mods to play
User avatar
Grimwold
Posts: 511
Joined: Thu Sep 13, 2012 11:45 pm
Location: A Dungeon somewhere in the UK

Re: Change the colour of lights? expressing 3d vector in lua

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

Re: Change the colour of lights? expressing 3d vector in lua

Post 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
Finished Dungeons - complete mods to play
User avatar
Grimwold
Posts: 511
Joined: Thu Sep 13, 2012 11:45 pm
Location: A Dungeon somewhere in the UK

Re: Change the colour of lights? expressing 3d vector in lua

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

Code: Select all

lightColor = vector3(1,0.5,0)
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?
User avatar
Komag
Posts: 3658
Joined: Sat Jul 28, 2012 4:55 pm
Location: Boston, USA

Re: Change the colour of lights? expressing 3d vector in lua

Post 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
Finished Dungeons - complete mods to play
User avatar
petri
Posts: 1917
Joined: Thu Mar 01, 2012 4:58 pm
Location: Finland

Re: Change the colour of lights? expressing 3d vector in lua

Post 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.
User avatar
Montis
Posts: 340
Joined: Sun Apr 15, 2012 1:25 am
Location: Grimrock II 2nd playthrough (hard/oldschool)

Re: Change the colour of lights? expressing 3d vector in lua

Post 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
}
When destiny calls, the chosen have no choice.

My completed dungeon (LoG1): Hypercube
User avatar
LordGarth
Posts: 500
Joined: Mon Jun 18, 2012 5:07 pm
Location: Colorado USA

Re: Change the colour of lights? expressing 3d vector in lua

Post 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
Dungeon Master and DOOM will live forever.
User avatar
petri
Posts: 1917
Joined: Thu Mar 01, 2012 4:58 pm
Location: Finland

Re: Change the colour of lights? expressing 3d vector in lua

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