Is there a way to change headlight beam color?

Add the following line to a loco config.txt
light_color 230,200,100
its R,G,B 0-256 I think
greetings GM
 
The light_color in the config.txt only changes the color of the coronas, used for the headlights. The color of the illumination effect of the headlights could be changed in a script using SetHeadlightColor.

A very simple example (red, with a little green and blue):
Code:
include "locomotive.gs"

class my_loco isclass Locomotive
{
    void Init(void)
    {
        inherited();
        SetHeadlightColor(1.0, 0.1, 0.1); // R,G,B values between 0.0 and 1.0
    }
};
Peter
 
Last edited:
@G.M.
That are the coronas of the headlight, but not the illumination of other objects by the headlights.

@Traincraft101
- Create a simple text file
- copy the script lines into this file
- save the file as my_script.gs
- copy the script file to the locomotives folder
- add the following 2 lines to the config.txt (at the top level, not inside any { } container)
Code:
script "my_script.gs"
class "my_loco"
- delete any prevously existing lines defining script and class (a locomotive used as a light source doesn't need other scripts)

Peter

**Added the missing inherited statement to the script above.
 
Last edited:
Peter is right (as usual)
again this is 1 feature for the wishlist in suggestion boxcar
when you change the color via light_color R,G,B, the beam should also change
or we need a tag: beam_color R,G,B
so a special script is not needed
 
The light_color in the config.txt only changes the color of the coronas, used for the headlights. The color of the illumination effect of the headlights could be changed in a script using SetHeadlightColor.
A very simple example (red, with a little green and blue):
Code:
include "locomotive.gs"

class my_loco isclass Locomotive
{
    void Init(void)
    {
        inherited();
        SetHeadlightColor(1.0, 0.1, 0.1); // R,G,B values between 0.0 and 1.0
    }
};
Peter
Can you show an example of how it looks like inside the config? I'm having trouble trying to write it in myself.
 
Back
Top