Jump to content
Sign in to follow this  
wogz187

Toggle Cabin Light SOLVED

Recommended Posts

May I have some help to compile this script,

 

if (Plight == 0) then {
    playSound ["click", true];
cockpit = playerJET;
CPlight = "#lightpoint" createVehicle [0,0,0];
    CPlight setLightBrightness 0.1;

    CPLight setLightAmbient [0.0, 1.0, 0.0];

    CPlight setLightColor [0.0, 1.0, 0.0];
CPlight attachTo [cockpit, [0,5,-0.5], "vez"];  
    addMissionEventHandler ["Draw3D", {
        CPlight setVectorDirAndUp [
        (cockpit selectionPosition "pohon") vectorFromTo (cockpit selectionPosition "otochlaven"), 
        [0,0,1];
    Plight=1;
    ];
}];
    }
else {
    deletevehicle CPlight;
    Plight=0;
};

It reports "Missing ]" but I don't know where it is. Before the "else", likely.

Thanks!

Share this post


Link to post
Share on other sites

@Grumpy Old Man, @sarogahtyp,

thanks, this works,

 

CabLight.sqf
if (Plight == 0) then {
playSound ["click", true];
cockpit = playerJET;
CPlight = "#lightpoint" createVehicle [0,0,0];
    CPlight setLightBrightness 0.1;

    CPLight setLightAmbient [0.0, 1.0, 0.0];

    CPlight setLightColor [0.0, 1.0, 0.0];
    CPlight attachTo [cockpit, [0,5,-0.5], "vez"];  
    
    addMissionEventHandler ["Draw3D", {
    CPlight setVectorDirAndUp [
        (cockpit selectionPosition "pohon") vectorFromTo (cockpit selectionPosition "otochlaven"),[0,0,1]
    ];
}];
    plight=1;
    }
else {
    deletevehicle CPlight;
    Plight=0;
};

Connected to a GUI button to toggle,
 

    action = "_nil=[]ExecVM ""CABlight.sqf""";

Actually it works really, really great!
Thanks!

  • Like 1

Share this post


Link to post
Share on other sites

Eh, 
Almost solved. The light still changes position (forward) when the vehicle is in motion and blinks like crazy. Interestingly, the visual effect it has looks like hitting warp speed into a green aurora borealis. The LightPoint will not keep up with the EH or the light properties make it go crazy. Removing light ambient, maybe?

This following script works but doesn't allow customizing the light source and it kind of feels like duct-taping a lantern onto the jet. But it does work.
 

CabLight.sqf

 

if (Plight == 0) then {
    playSound ["click", true];
cockpit = playerJET;
CPlight = "Land_PortableLight_single_F" createVehicle [0,0,0];
    CPlight attachTo [cockpit, [0,7,-1], "vez"];  
    
    addMissionEventHandler ["Draw3D", {
    CPlight setVectorDirAndUp [
        (cockpit selectionPosition "pohon") vectorFromTo (cockpit selectionPosition "vez"),[0,0,0]
    ];
}];
    plight=1;
    }
else {
    deletevehicle CPlight;
    Plight=0;
};

 

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×