Facebook Twitter YouTube Frictional Games | Forum | Privacy Policy | Dev Blog | Dev Wiki | Support | Gametee


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Change Lamp (Not Light) Colour Through Script
MapleLeaf Offline
Junior Member

Posts: 6
Threads: 1
Joined: Oct 2018
Reputation: 0
#1
Change Lamp (Not Light) Colour Through Script

Like the title says, is it possible to change the color of a lamp entity via script?

I thought doing it manually, like duplicating the same entity and do the changes in the other tab, but that would not be the best way if I could just script it and not having the same entity overlapping each other.
10-29-2018, 04:32 PM
Find Reply
Abion47 Offline
Senior Member

Posts: 369
Threads: 22
Joined: Oct 2015
Reputation: 46
#2
RE: Change Lamp (Not Light) Colour Through Script

I'm doing this from memory as I'm getting ready to walk out the door and it's been a little while since I've done this effect, so if it isn't quite right, I'll take another stab at it when I get home from work. I think it's something along these lines, though:

iLuxEntity @lamp = Map_GetEntity("lamp"); // The name of the entity in the level editor
iLight @light = lamp.GetLightFromName("light"); // The name of the attached light in the model editor
light.SetIlluminationColor(cColor(0.0, 0.0, 1.0)); // RGB values, 0-1 scale

10-29-2018, 04:49 PM
Find Reply
MapleLeaf Offline
Junior Member

Posts: 6
Threads: 1
Joined: Oct 2018
Reputation: 0
#3
RE: Change Lamp (Not Light) Colour Through Script

(10-29-2018, 04:49 PM)Abion47 Wrote:
iLuxEntity @lamp = Map_GetEntity("lamp"); // The name of the entity in the level editor
iLight @light = lamp.GetLightFromName("light"); // The name of the attached light in the model editor
light.SetIlluminationColor(cColor(0.0, 0.0, 1.0)); // RGB values, 0-1 scale

Okay, I've just tested it today and sad to say it didn't work. I only added the script you gave to a lever and made two if-statements, one for red and the other white.

Also,

// The name of the attached light in the model editor
You mean in the level editor, right? Just making sure Tongue
10-30-2018, 01:56 PM
Find Reply
Abion47 Offline
Senior Member

Posts: 369
Threads: 22
Joined: Oct 2015
Reputation: 46
#4
RE: Change Lamp (Not Light) Colour Through Script

Quote:You mean in the level editor, right? Just making sure Tongue

No, I meant the model editor. Lamp entities have light sources defined for them in the model editor, which is different than talking about attaching external light sources in the level editor.

10-30-2018, 04:23 PM
Find Reply
MapleLeaf Offline
Junior Member

Posts: 6
Threads: 1
Joined: Oct 2018
Reputation: 0
#5
RE: Change Lamp (Not Light) Colour Through Script

(10-30-2018, 04:23 PM)Abion47 Wrote: No, I meant the model editor. Lamp entities have light sources defined for them in the model editor, which is different than talking about attaching external light sources in the level editor.

Okay, did what you said and again didn't work. I also delete my cache file, seeing if that might had something to do with this, but no still got the same result.
10-30-2018, 04:52 PM
Find Reply


[-]
Quick Reply
Message
Type your reply to this message here.

Human Verification
Please tick the checkbox that you see below. This process is used to prevent automated spam bots.



Users browsing this thread: 1 Guest(s)