Jump to content
Sign in to follow this  
Onto

Turn lights off

Recommended Posts

Hi,

I wanted to turn off the lights in my custom base I made in the editor.

https://community.bistudio.com/wiki/switchLight

In ArmA3 this command is broken [1], use setHit instead:

_lamp = nearestObject [player, "Lamps_base_F"];

_lamp setHit ["light_1_hitpoint", 0.97]; //off

_lamp setHit ["light_1_hitpoint", 0]; //on

I added a generator in the editor with this Init-Line:

bul7 addAction ["Turn lights in base off", "lampdir180 sethit ('light_1_hitpoint', 0.97)"];

I want to add an Action where I can turn of the lights.

bul7 is the generator.

lampdir180 is the name of the light.

When I preview the map or try to use the addAcation I get this error:

http://cloud-2.steampowered.com/ugc/3318331657276660588/A45AF7DF507A0739BF39FBC59639472ECBB4A35C/ (539 kB)

I have no clue where the missing ) is.

Can you help me guys?

Thank you :)

Share this post


Link to post
Share on other sites

Try this :

bul7 addAction ["Turn lights in base off", {lampdir180 sethit ['light_1_hitpoint', 0.97]}];

Share this post


Link to post
Share on other sites

Awesome! Thx the error is gone.

Now I faced the problem that the sethit command didn't work out.

So I tried to setdamage and it worked.

To clear some things up for people with simular problems:

I placed a object in the editor with the init:

LB1= "Land_LampHalogen_F" createVehicle position this; deleteVehicle this; LB1 allowDamage false; LB1 setdir 180;

"Land_LampHalogen_F" is the lamp. I've got the classname from the configviewer.

Then I placed the generator (with name bul7) where I wanted to add the Action to turn off/on lights with the init:

bul7 setdir 0; bul7 addAction ["Turn lights in base off", "LB1 setDamage 0.95"];

bul7 addAction ["Turn lights in base on", "LB1 setDamage 0.00"];

I set "LB1 allowDamage false" to the lamp because it only has 0.05 damage left and I don't want that the lamp gets destroyed by looking at it. It doesn't interfere with the setDamage.

Edited by Onto

Share this post


Link to post
Share on other sites

You're welcome! Glad you could sort it out. ;)

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  

×