Jump to content
Sign in to follow this  
sariel

turn street lights off around an object

Recommended Posts

Hi,

in the wiki i found this script:

{ _x setHit ["light_1_hitpoint", 0.97]; _x setHit ["light_2_hitpoint", 0.97]; _x setHit ["light_3_hitpoint", 0.97]; _x setHit ["light_4_hitpoint", 0.97]; } forEach nearestObjects [player, [ "Lamps_base_F", "PowerLines_base_F", "PowerLines_Small_base_F" ], 500];

it turnes off all the street lights etc in a radius of 500 m to the player.

can somebody tell me how i can turn off the street lights around an object?

tried to replace "player" with the objects name but it doesn't work...

thanks!

sariel

Share this post


Link to post
Share on other sites
{ 
_x setHit ["light_1_hitpoint", 0.97]; 
_x setHit ["light_2_hitpoint", 0.97]; 
_x setHit ["light_3_hitpoint", 0.97]; 
_x setHit ["light_4_hitpoint", 0.97]; 
} forEach nearestObjects [someObjectName, [ "Lamps_base_F", "PowerLines_base_F", "PowerLines_Small_base_F" ], 500];

  • Like 1

Share this post


Link to post
Share on other sites

It should work with the objects variable name, I don't know about if you use the classname, but if that fails try: (getPos objectName).

Share this post


Link to post
Share on other sites

Place a trigger size 0,0,0 and position it where you want the lights off. Then put this in the CONDITION:

isServer;

then in the ON ACT:

blowlights = ["Lamps_base_F","PowerLines_base_F","PowerLines_Small_base_F"];{_x setHit ["light_1_hitpoint", 0.97];_x setHit ["light_2_hitpoint", 0.97];_x setHit ["light_3_hitpoint", 0.97];_x setHit ["light_4_hitpoint", 0.97];} forEach nearestObjects [thisTrigger, blowlights, 500];

Share this post


Link to post
Share on other sites

i use this Beerkan code although its not the same case

http://forums.bistudio.com/showthread.php?183529-Power-outage/page3

THE FOLLOWING METHOD DOES NOT REQUIRE A SCRIPT. (But can call one if required)

In the Editor place a trigger

Name:Transformer1

Axis A=0

Axis B=0

ANGLE=0

Activation = Once

Not Present.

Now in the Condition put this.

Code:

damage (nearestObject [getposATL thisTrigger,"Land_dp_transformer_F"]) >= 1; //

And in the Activation field put this

Code:

titletext[format["Small Transformer Destroyed."],"PLAIN"];blowlights = ["Lamps_base_F","PowerLines_base_F","PowerLines_Small_base_F"];{_x setHit ["light_1_hitpoint", 0.97];_x setHit ["light_2_hitpoint", 0.97];_x setHit ["light_3_hitpoint", 0.97];_x setHit ["light_4_hitpoint", 0.97];} forEach nearestObjects [thisTrigger, blowlights, 500];

Edited by Rapax

Share this post


Link to post
Share on other sites

@Beerkan thanks that helped!

@Rapax ok thanks

Share this post


Link to post
Share on other sites

Is there a way to make a smaller area withing the affected are still have active lights, like a building is on a generator while the rest of the city is without power?

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  

×