Jump to content
Sign in to follow this  
ofp_f3d3

Attach light to c130

Recommended Posts

Hi everyone, i´m new at MP scripting and i´m trying to create some kind of alert for the C130 halo operators. I created the red light (don´t move) and the green light (jump).

I´ve created a GAME LOGIC with this init:

LName = "#lightpoint" createVehicleLocal (getpos c130); LName setLightAmbient [0,0,0]; LName setLightBrightness 0.1; LName setLightColor [0,0,0]; LName lightAttachObject [c130, [0,-4,-1]];

with this i create the light without colour or brightness. Then in the c130 i add the following lines in the init field

this addAction ["LUZ ROJA --- ALERTA","red.sqs",[1],0,false,true,""," driver _target == _this"];this addAction ["LUZ VERDE --- SALTAR","green.sqs",[1],0,false,true,""," driver _target == _this"];this addAction ["APAGAR LUCES DE HALO","lightoff.sqs",[1],0,false,true,""," driver _target == _this"];

with this i stablish that the only person in the plane that with turn on and off the lights is the pilot or driver.

"red.sqs" and "green.sqs" only change the colour of the light so i dont have to create a new one and create a mess.

the lights work perfectly in SP but when i execute them in MP, the pilot (or executer) is the only one who is able to see those lights.

I´ve tried everything over and over again and i´m out of options. Can someone tell me what is wrong with this script and how to make it work in MP?

Share this post


Link to post
Share on other sites

The thing with addAction is that things are only local. You also use createVehicleLocal which should only, obviously, create it for the pilot.

Also is there a particular reason you use sqs over sqf?

To move back to your original issue, try something like this:

init.sqf

redlight = false;
greenlight = false;

lights.sqf

waitUntil {greenlight || redlight};

if (redlight && isServer) then {
_redlight = "#lightpoint" createVehicle (getpos c130);
_redlight setLightAmbient [255,0,0];
_redlight setLightBrightness 0.5;
_redlight setLightColor [255,0,0];
_redlight lightattachobject [c130, [0,-4,-1]];
sleep 20;
deletevehicle _redlight;
redlight = false;
};

if (greenlight && isServer) then {
_greenlight = "#lightpoint" createVehicle (getpos c130);
_greenlight setLightAmbient [55,255,0];
_greenlight setLightBrightness 0.5;
_greenlight setLightColor [55,255,0];
_greenlight lightattachobject [c130, [0,-4,-1]];

sleep 20;
deletevehicle _greenlight;
greenlight = false;
};

Make an addaction for both greenlight and redlight.

redlight.sqf

redlight = true;
publicVariable "redlight";

greenlight.sqf

greenlight = true;
publicVariable "greenlight";

Share this post


Link to post
Share on other sites

Thanks a lot, i´ll try it now and tellyou if it worked.

---------- Post added at 17:12 ---------- Previous post was at 16:31 ----------

tryteiker, i tried what you posted, but light don´t turn on, i tried it in SP (eliminating isServer) and it didn´t work, i tried in MP but they didnt turn on for me or any other in the server, i don´t know what is wrong in the script as it doesn´t show any kind of error

Share this post


Link to post
Share on other sites

i don´t know whats going on, but for some reason, lights seem to combine, with this i mean:

redlight ---> [1,0,0]

greenlight ---> [0,1,0]

when i change from red light to green light, the colour is [1,1,0], but it has never happened to me before, do you know if they are supposed to do this?

---------- Post added at 19:15 ---------- Previous post was at 19:14 ----------

i don´t know whats going on, but for some reason, lights seem to combine, with this i mean:

redlight ---> [1,0,0]

greenlight ---> [0,1,0]

when i change from red light to green light, the colour is [1,1,0], but it has never happened to me before, do you know if they are supposed to do this?

Share this post


Link to post
Share on other sites

Please, nobody knows why lights appear only for me and not for other players??¿?¿?¿?¿??¿?¿

Share this post


Link to post
Share on other sites

because addactions are local, so when u use action u see light. noone else used action so they dont see it.. u need to use PVEH like in this example (addaction issue also) http://forums.bistudio.com/showthread.php?103270-Updating-tasks-in-multiplayer

or activate thru a trigger or something global so it broadcast info to everyone. having a trigger call the lights script would prob be easiest. 2 triggers both with nul = execVM "lights.sqf"; on activation.. then make 1 with condition: redlight the other with condition: greenlight. this way the variable trips the trigger then the trigger (thats global) will call script for everyone.

Share this post


Link to post
Share on other sites

i saw that post panther, but i need to activate the light via addaction, so i´m trying the nimrod´s alternative. if it doesnt work, i´ll try with that

---------- Post added at 03:24 ---------- Previous post was at 02:55 ----------

Nimrod, i tried your alternative but it didn´t work, this is how i do it:

First "init.sqf"

//init.sqf

[] execVM "publicvariable.sqf";

"MY_name" addPublicVariableEventHandler { this = [] execVM "light.sqf"; };

redlight = false;

greenlight = false;

----------

Now "publicvariable.sqf"

//publicVariable.sqf

MY_name = name player;

publicVariable "MY_name";

this = [] execVM "light.sqf";

-------

then "redlight.sqf"

redlight = true;

publicVariable "redlight";

null = execVM "light.sqf";

-----------

Finally "light.sqf"

waitUntil {greenlight || redlight};

waitUntil{!(isNil "BIS_MPF_InitDone")};

if (redlight && isServer) then {

_redlight = "#lightpoint" createVehicle (getpos c130);

_redlight setLightAmbient [0.1,0,0];

_redlight setLightBrightness 0.1;

_redlight setLightColor [0.1,0,0];

_redlight lightattachobject [c130, [0,-6,-3]];

_text1 = parseText format ["<t align=center' color='#f39403' shadow='1' shadowColor='#000000'>A L E R T A</t><br/><t align='center' color='#666666'>------------------------------</t><br/><br/><t align='center' color='#ffffff' shadow='1' shadowColor='#000000'><img size='4' image='roja.paa'/></t><br/><br/><t align='center' color='#ffcc33' shadow='1' shadowColor='#000000'>Prepararse para el salto</t><br/><br/><t align='center' color='#ffffff' shadow='1' shadowColor='#000000'></t&gt];

[nil,nil,rHINT,_text1] call RE;

sleep 15;

deletevehicle _redlight;

redlight = false;

greenlight = true;

};

if (greenlight && isServer) then {

_greenlight = "#lightpoint" createVehicle (getpos c130);

_greenlight setLightAmbient [0,0.1,0];

_greenlight setLightBrightness 0.1;

_greenlight setLightColor [0,0.1,0];

_greenlight lightattachobject [c130, [0,-6,-3]];

_text2 = parseText format ["<t align=center' color='#f39403' shadow='1' shadowColor='#000000'>A L E R T A</t><br/><t align='center' color='#666666'>------------------------------</t><br/><br/><t align='center' color='#ffffff' shadow='1' shadowColor='#000000'><img size='4' image='verde.paa'/></t><br/><br/><t align='center' color='#ffcc33' shadow='1' shadowColor='#000000'>S A L T E N</t><br/><br/><t align='center' color='#ffffff' shadow='1' shadowColor='#000000'></t&gt];

[nil,nil,rHINT,_text2] call RE;

sleep 30;

deletevehicle _greenlight;

greenlight = false;

};

----------

If it helps, this is how i add the action to the c130

lightaction = c130 addAction ["S.A.V.H","redlight.sqf",[1],0,false,true,""," driver _target == _this"];

Share this post


Link to post
Share on other sites
i saw that post panther, but i need to activate the light via addaction, so i´m trying the nimrod´s alternative. if it doesnt work, i´ll try with that

Did you see post #17?

Share this post


Link to post
Share on other sites

I tried both options, none of them works :( i don´t know what to do.

Share this post


Link to post
Share on other sites

Depends on the altitude. If your in a C130 above 2000m, you have to set the brightness extremely high, (I forget what I did but I think its something like +25.0 for each 2000-3000m). Make Sure you execute this local to each player and terminate the second the player exits the aircraft. At brightness levels that high the entire map changes color at ground level.

Share this post


Link to post
Share on other sites

i didn´t know about the altitude, but i ahve to ask as a noob scripter.

1) i know how the execute the addaction FOR ME, but how can i make every player execute it locally?

2)What do you mean with

and terminate the second the player exits the aircraft.

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  

×