C++ Question Beacon light on/off switch

tauruslittrow84

New member
Joined
Nov 12, 2011
Messages
58
Reaction score
0
Points
0
If I am using the following code that is working to make 3 beacon lights on my ship, what code must i put in the buffered key area to make a switch that turns all three of them on/off at once say with OAPI_Key_L?
Code:
static BEACONLIGHTSPEC beacon1;
    static VECTOR3 beacon1pos = {1.5,-1.75,.37};
    static VECTOR3 beacon1col = {.1, .2, .992};
    
        beacon1.shape = (BEACONSHAPE_STAR);
        beacon1.pos = &beacon1pos;
        beacon1.col = &beacon1col;
        beacon1.size = (.7);
        beacon1.falloff = (0.6);
        beacon1.period = (13);
        beacon1.duration = (7);
        beacon1.tofs = (2);
        beacon1.active = true;
        
        AddBeacon (&beacon1);


static BEACONLIGHTSPEC beacon2;
    static VECTOR3 beacon2pos = {-1.35,1.49,1.23};
    static VECTOR3 beacon2col = {1,0,0};
    
        beacon2.shape = (BEACONSHAPE_STAR);
        beacon2.pos = &beacon2pos;
        beacon2.col = &beacon2col;
        beacon2.size = (.7);
        beacon2.falloff = (0.6);
        beacon2.period = (9);
        beacon2.duration = (5);
        beacon2.tofs = (3);
        beacon2.active = true;
        
        AddBeacon (&beacon2);

static BEACONLIGHTSPEC beacon3;
    static VECTOR3 beacon3pos = {-1.35,1.49,-.85};
    static VECTOR3 beacon3col = {0,1,0};
    
        beacon3.shape = (BEACONSHAPE_STAR);
        beacon3.pos = &beacon3pos;
        beacon3.col = &beacon3col;
        beacon3.size = (.7);
        beacon3.falloff = (0.6);
        beacon3.period = (9);
        beacon3.duration = (5);
        beacon3.tofs = (5);
        beacon3.active = true;
        
        AddBeacon (&beacon3);
 

gattispilot

Addon Developer
Addon Developer
Joined
Oct 17, 2007
Messages
8,716
Reaction score
2,685
Points
203
Location
Dallas, TX
ok try this. first in your beacon code change
beacon1.active = true; to beacon1.active = false;
do this for all 3. this says do not show the beacon.

then this:
Code:
if(key==OAPI_KEY_3)
{
   
for (int i = 0; i < 3; i++) {
		 beacon[i].active = false;
}
}  
if(key==OAPI_KEY_4)
{
    
for (int i = 0; i < 3; i++) {
		 beacon[i].active = true;
}
}
here 3 turn lights off and 4 turns on.
 
Top