Jump to content
Sign in to follow this  
vostov

Power outage

Recommended Posts

Then again, if you are using a script, AND using it in multiplayer, it would be a good idea to add

if (!isServer) exitWith {};

to the script's first line to prevent resources from being wasted needlessly.

The condition should be:

[color="#FF8040"][color="#191970"][b]if[/b][/color] [color="#8B3E2F"][b]([/b][/color][color="#8B3E2F"][b]![/b][/color][color="#191970"][b]hasInterface[/b][/color][color="#8B3E2F"][b])[/b][/color] [color="#191970"][b]exitWith[/b][/color] [color="#8B3E2F"][b]{[/b][/color][color="#8B3E2F"][b]}[/b][/color][color="#8B3E2F"][b];[/b][/color] [/color]

That will take care of dedicated server and headless clients.

Edited by Killzone_Kid

Share this post


Link to post
Share on other sites
The condition should be:

[color="#FF8040"][color="#191970"][b]if[/b][/color] [color="#8B3E2F"][b]([/b][/color][color="#8B3E2F"][b]![/b][/color][color="#191970"][b]hasInterface[/b][/color][color="#8B3E2F"][b])[/b][/color] [color="#191970"][b]exitWith[/b][/color] [color="#8B3E2F"][b]{[/b][/color][color="#8B3E2F"][b]}[/b][/color][color="#8B3E2F"][b];[/b][/color] [/color]

That will take care of dedicated server and headless clients.

Wait, doesn't !isServer already exclude headless clients, since they're not counted as servers? In this case it's to make sure that only one machine, the server, runs setHit, which doesn't require local executions.

If you use "exit if !hasInterface", it should run for the dedicated server and headless clients, even though the latter aren't needed - also if it's hosted from the multiplayer menu with no headless clients, with the server being a player with an interface, it doesn't get run for anyone. I've usually seen hasInterface used together with an isServer check to avoid this possibility.

^ erm, I don't know what I was thinking/reading.

The thread is just getting more and more of a mess. D: If Vostov's head hurts at this point, I still recommend simply copy-pasting this into a trigger activation.

Edited by Magirot

Share this post


Link to post
Share on other sites

You are right about it getting complex. In case with turning off lights on static map placed objects you need to execute setHit on every client, minus dedicated and headless for obvious reasons. Static map objects are local everywhere, so if you turn light off on one client it won't turn it off on every client.

Share this post


Link to post
Share on other sites
Static map objects are local everywhere, so if you turn light off on one client it won't turn it off on every client.

Ohhh, that's very good to know.

Share this post


Link to post
Share on other sites

hey guys,

how can I get this working on a coop mission I am making?

do i have to place the transformer or can i just place it over one on the map?

Share this post


Link to post
Share on other sites
_objectArray = ["Lamps_Base_F", "PowerLines_base_F", "Land_PowerPoleWooden_F", "Land_LampHarbour_F", "Land_LampShabby_F", "Land_PowerPoleWooden_L_F", "Land_PowerPoleWooden_small_F", "Land_LampDecor_F", "Land_LampHalogen_F", "Land_LampSolar_F", "Land_LampStreet_small_F", "Land_LampStreet_F", "Land_LampAirport_F", "Land_PowerPoleWooden_L_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, _objectArray, 500];

I tried to put this in a trigger within the activation field and it said local variable global space?

Sorry for the delayed response. I've been gone for a while.

edit: (oh wow, uh just saw the rest of the posts) Anywho, I just kinda want to keep it simple. All lights OFF. In a warzone where shit had hit the fan for a while... guess what you don't see often at night?

Lights.

Q: Know what light attracts at night during a war?

Bullets, rockets, people with knives, hate, attention.....

I think I just want all the lights out.

By default. I've noticed this threat evolved amazingly. The intelligent and gifted people here spotted a transformer. Made a script to run around it.

I just want stuff to look dead. (really then you can put a few functional vehicles per city on Altis stock with some patrols... then you have the base area to make large missions. The lack of functioning vehicles/lights reflects the chaos beset upon the region)

Blah, blah, blah....

Thanks guys. I'm always coming here for help. I always get some. This is a great community. (I wish I knew the ass end of a script line myself - but I don't)

edit 2:

{

_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, [

"Lamps_base_F",

"PowerLines_base_F",

"PowerLines_Small_base_F"

], 5000];

This worked perfectly. I put in 50,000 to make sure to get all of Altis. (it lagged me out for 15 seconds but then it works just fine)

VERY cool. Thanks guys. Will link a mission soon once I've taken advantage of this.

I'm thinking like an irregular infantry unit 3-11 soldiers hitting a variety of targets across a large battlefield. (the biggest choices to make will be do you engage spotted enemies or bypass - I'm trying to setup good enemy QRFs with reliable intercept vectors to suppress the amateurish players desire to just mow down any target of opportunity)

Thanks so much. This was a big missing element.

It also helps with immersion. Sadly, for whatever reason, I can't handle all the lighting sources all at once. So, the lighting changes as I close in on certain things. Being able to keep most of the lights off is a big deal.

Campfires in cities now make much more sense.

This was worth the wait. Thanks!

Edited by Vostov
Rethinking.

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  

×