Jump to content
Sign in to follow this  
Purzel

How do i attach a chemlight to a certain object?

Recommended Posts

Hi,

how do i attach a chemlight from the module to a certain object?

I want to have a kind of "traffic light" for the players to start the mission.

Unfortunately the module-effects-chemlight is not able to spawn in a certain high (only on the floor), so I tried the

"setpos/getpos" -and in my desperation even the "this flyInHeight"-syntax (but of course the last did not work.)

Same is with the "attach"-command.

Can anybody please help me with that issue...?

"Chemlight name" Which-command-need-I-to-attach-to-the-following "object"...?

Thanx!

Share this post


Link to post
Share on other sites

thank you!!!!!!

It works, but not as desired... *grmpfl*

but now the next question...:

How do I switch them on and off?

My intention was to stick them at one radio,

and when radio Alpha was triggered, the red light switches to green (and vice versa on radio beta.)

Or can I use a light and how?

I just need a little glowing point in red or green.

Greetz Purzel

Share this post


Link to post
Share on other sites

Chemlights don't have an on/off switch. You break them they mix chemicals and produce light.

Just have your radio command delete the red light and spawn in a green light just the same way.

Share this post


Link to post
Share on other sites

Create lights.sqf:

_obj = _This select 0;
_rate = _This select 1;
_light1Pos = _this select 2;
_light2Pos = _this select 3;
while {true} do {
_light = createVehicle ["#lightpoint", getPos _obj, [], 0, "NONE"];
_light lightAttachObject [_obj, _light1Pos];
_light setLightBrightness 0.2;
_light setLightAmbient [1.0, 0.0, 0.0];
_light setLightColor [1.0, 0.0, 0.0];
sleep _rate;
deleteVehicle _light;
_light = createVehicle ["#lightpoint", getPos _obj, [], 0, "NONE"];
_light lightAttachObject [_obj, _light2Pos];
_light setLightBrightness 0.2;
_light setLightAmbient [0.0, 1.0, 0.0];
_light setLightColor [0.0, 1.0, 0.0];
sleep _rate;
deleteVehicle _light;
};

Put this to your trigger activation:

nul = [object, 1, [pos1], [pos2] execVM "light.sqf";

Tweak it before you're satisfied.

Share this post


Link to post
Share on other sites

nul = [object, 1, [pos1], [pos2] execVM "light.sqf";

Does not work: "missing ]"

A Question to that code:

How does that code know, which object is the one I wanna attach it to? (In my case "Heli1")

Where do i have to exchange/insert the "Heli1"...?

Sorry but I have no clue, what that code exactly means, please can someone explain the following:

_obj = _This select 0;

_rate = _This select 1;

_light1Pos = _this select 2;

_light2Pos = _this select 3;

_light = createVehicle ["#lightpoint", getPos _obj, [], 0, "NONE"];

sleep _rate;

Thank you

Share this post


Link to post
Share on other sites

because that should have been typed as :

nul = [object, 1, [pos1], [pos2]] execVM "light.sqf";

Share this post


Link to post
Share on other sites
How does that code know, which object is the one I wanna attach it to? (In my case "Heli1")

nul = [Heli1, 1, [1, 0, 0], [-1, 0, 0]] execVM "lights.sqf";

Share this post


Link to post
Share on other sites

Aah, that easy! Thank you...

ok, but this light changes color continuesly from red to green. It just should switch.

Edited by Purzel

Share this post


Link to post
Share on other sites
Aah, that easy! Thank you...

ok, but this light changes color continuesly from red to green. It just should switch.

_obj = _This select 0;
_light1Pos = _this select 1;
_light2Pos = _this select 2;
_light = createVehicle ["#lightpoint", getPos _obj, [], 0, "NONE"];
_light lightAttachObject [_obj, _light1Pos];
_light setLightBrightness 0.2;
_light setLightAmbient [1.0, 0.0, 0.0];
_light setLightColor [1.0, 0.0, 0.0];
waitUntil {!isNil "yourVariableNameHere"};
deleteVehicle _light;
_light = createVehicle ["#lightpoint", getPos _obj, [], 0, "NONE"];
_light lightAttachObject [_obj, _light2Pos];
_light setLightBrightness 0.2;
_light setLightAmbient [0.0, 1.0, 0.0];
_light setLightColor [0.0, 1.0, 0.0];

nul = [Heli1, [1, 0, 0], [-1, 0, 0]] execVM "lights.sqf";

Create a trigger, add desired condition and put yourVariableName = true to the on-activation field. Didn't test, might contain typos.

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  

×