Jump to content

Recommended Posts

Alright, so currently I am developing an OPTRE Spec Ops mission, where a group of ODST soldiers start in a Pelican dropship headed towards its insertion point. I want to begin the mission with a red light within the interior of the Pelican, which I have managed to do successfully. But, I want that light to switch to green whenever the dropship is over the insertion point activated by a trigger that I have designated as (A1). It seems that the code I implement within the initialization fields of the dropship works, but only for a split second as the red light flickers, but does not change to green. Any help is greatly appreciated!

This is the code that I have tried to implement:

if( triggerActivated A1) then                                              

{  

   //The following code will set the interior color to Green.                                                              

   light2 = "#lightpoint" createVehicleLocal [0,0,0]; 
   light2 setLightBrightness .125; 
   light2 setLightAmbient [1,0.2,0.2]; 
   light2 setLightColor [0,0,255]; 
   light2 lightAttachObject [this,[0,-2.5,-0.8]];                        

};      

 

if ( !triggerActivated A1) then                                          

 {

   //The following code will set the interior to Red.                                                                          

   light1 = "#lightpoint" createVehicleLocal [0,0,0]; 
   light1 setLightBrightness .125; 
   light1 setLightAmbient [1,0.2,0.2]; 
   light1 setLightColor [255,0,0]; 
   light1 lightAttachObject [this,[0,-2.5,-0.8]];                          

  pelican1 say3D ["music1", 10, 1];                                  

  };      

Share this post


Link to post
Share on other sites

First of all, you are creating 2 lights, when you probably should try to create only one and change its colour.

 

BTW, the code for the first light is blue, not green.

 

I made it work like this:

 

1) Copy the code for the red light in the init-field of the vehicle you want to use.

 

 light2 = "#lightpoint" createVehicleLocal [0,0,0]; 
 light2 setLightBrightness .125; 
 light2 setLightAmbient [1,0.2,0.2]; 
 light2 setLightColor [0,0,255]; 
 light2 lightAttachObject [this,[0,-2.5,-0.8]];

 

2) Create a trigger where you want the vehicle to change color. Set the conditions as you prefer.

 

3) In the activiation field of the trigger, using the same name for the light you used in the vehicle, simply write

 

light2 setLightColor [255,0,0];  

 

Remember to only use 1 light, as it creates less clutter and if you just create one light on top of each other, you´ll only get a rainbow.

 

You might have some issues with this in multiplayer as the effects of "SetLightColor" aren´t broadcasted to everyone.

 

I hope this helps.

  • Like 1

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  

×