Jump to content
Sign in to follow this  
MaxRiga

Discussion: Elecricity

Recommended Posts

Just wondering, is it possible to make ELECTRICITY in Arma !? I mean, there are wires all over the island and some electrical stations, so, it would so cool to make electricity from the stations to cities so electricity would became very strategically resource. During the night time you can blow up electricity station and 3-4 cities would be out of power .. sounds nice, eh? smile_o.gif

Share this post


Link to post
Share on other sites

In Ofp all lights had I.D numbers so you can scritpt them off .. possible to set them all to off on a scripted trigger maybe ?

Share this post


Link to post
Share on other sites

I agree, this could be a very cool thing to see. smile_o.gif

Share this post


Link to post
Share on other sites

it is possible, i hav seen it in a mission and it does look really sweet, u just have to script it so that if a power station is destroyed, then the various lights will go out as they all have names or something like that.

Share this post


Link to post
Share on other sites

As it just happens today I was looking to create a script that blacks out a city and was happy to find that there is already a script to do the job courtesy of Mandoble at OFPEC:

Street Lights need to be turned off

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

// lightsoff.sqf

_pos = _this select 0;

_range = _this select 1;

// Add more types if needed

_types = ["Land_lampa_vysoka", "Land_lampa_ind", "Land_lampa_ind_b", "Land_lampa_sidl", "Land_lampa_ind_zebr"];

for [{_i=0},{_i < (count _types)},{_i=_i+1}] do

{

_lamps = _pos nearObjects [_types select _i, _range];

Sleep 1;

{_x switchLight "OFF"} forEach _lamps;

};

and the way to call it from a trigger or other script:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

res=[getPos player, 3000]execVM"lightsoff.sqf"

I am working on a mission with this included except I am using the position of a specific powerstation instead of the player and altering the range as appropriate to only black out that specific city.

Share this post


Link to post
Share on other sites

Mando´s script works like a charm. I have already included it in a mission where I disable all streetlights in a town at once when I blow up a relais module.

The script is very easy to customize ( I am no scripter and it took me about 5 minutes ), so it shouldn´t be a problem to link it to your desired objects or circumstances.

Share this post


Link to post
Share on other sites

How did you execute the script? huh.gif

What line did you use in the trigger?

Share this post


Link to post
Share on other sites

allways been wondering. Theres all these power lines but wheres the power plant?

Share this post


Link to post
Share on other sites

if I remember correctly there is one guy planning to release a nuclear power plant.

dunno if it's WIP or abandoned whistle.gif

Share this post


Link to post
Share on other sites
How did you execute the script? huh.gif

What line did you use in the trigger?

I think you were asking Balschoiw, so I don't want to speak for him, but, I just finished my demo mission and here is how it is triggered (using the guidance in this OFPEC thread: Obj Complete when bridge destroyed - NOTE: I used a power station in Corazol instead of a bridge and a game logic names as such)

In the condition field enter:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">(getDammage (position powerGL nearestObject 489499) > 0.8)

In the activation field:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">res=[getPos player, 3000]execVM""lightsoff.sqf"

And of course make sure to include the lightsoff.sqf as posted above in the mission folder.

What this does is when the powerstation is destroyed (in my case by multiple satchel charges) the trigger activates the lightsoff script and every lamppost within 3000m is switched off!

Here is a demo video:

Blackout! on YouTube

Share this post


Link to post
Share on other sites
allways been wondering. Theres all these power lines but wheres the power plant?

the powerplant is in the factory complex where all the POW's ride a bicycle to get the energy going tounge2.giftounge2.giftounge2.giftounge2.gif

It would be cool to be able to shootout street lights. U can shoot vehicle lights so why not streetlights.

Share this post


Link to post
Share on other sites

I remember this from OFP, particularly a main power switch which could be activated from the action menu. So for instance you could crawl into an enemy base and hit the switch at the generator or power relay hut and black-out the entire base. Any way to implement that sort of switch?

Share this post


Link to post
Share on other sites

I thought this was in Arma already, taking out a power station will take out the power in a nearby town...was shown with a video but I can't remember, best test for yourself.

Share this post


Link to post
Share on other sites
Quote[/b] ]Any way to implement that sort of switch?

Sure.

Add an action to player when he is near the object you want to have a switch at via trigger or distance command.

The action should set a variable = true and remove the action from the player once it´s fired.

Example:

Add action to player once he is near the object

Look at the example here.

Now setup a Game Logic inside the the camp in wich you want to deactivate the light and have the script executed like this:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">res=[getPos NameofyourGameLogic, 300 ]execVM""lightsoff.sqf"

where NameofyourGameLogic is the name of the Game Logic you place in the camp and 300 is the radius in wich the lights will be shut down. Change that value so it fits your scenario.

Once the script has been called from the action menu entry, remove the action from the player with

removeAction.

As this thread is not really mod-related I guess it should be moved to Mission Editing.

Share this post


Link to post
Share on other sites

the switch thingy came with mapfact baracken pack that had barack objects, and one was a small house with a light switch , i used in once or twice in mission as a light switch to switch off power to lights. smile_o.gif but thats for ofp, i hope they convert all or many of their great stuff to arma. smile_o.gif

Share this post


Link to post
Share on other sites

To switch off city lights upon the destruction of settlements power grid/transformer station is pretty quick and easy, once you know how.

Create a gamelogic (the unit) and name it whatever you want, but make sure you reference it correctly in the trigger. Here ive named my gamelogic, logicone. Place this gamelogic in the middle of the urban area you want effected.

Now create a trigger

Condition:

Quote:

not alive Transformer

On Activation:

Quote:

{_x switchlight "off"} foreach (position logicone nearObjects ["streetlamp",400]);

The "400" means that lights within a 400m radius of the gamelogic will be turned off. You can change this value to suit your needs.

Now place an empty cobra down in the editor (or anything really, but use a cobra since we know where it'll be in the mission.sqm file. Save your mission. Open the mission.sqm file with a word processor (notepad will do). Then try to find that lone cobra, it should be the last entry under "Class vehicles", listed in descending order with the most recently added vehicle at the bottom of the list of vehicles (there are other lists).

Once youve found it change the vehicle entry to this new classname which just so happens to be part of a transformer station:

Quote:

vehicle="Land_trafostanica_mala";

You can also use:

Quote:

"Land_trafostanica_velka"

While your there name the object:

Quote:

text="Transformer";

So it should look something like this, plus or minus a few lines:

Quote:

class Item403

{

position[]={14233.919922,49.894604,12290.136719};

azimut=-47.348370;

special="NONE";

id=940;

side="EMPTY";

vehicle="Land_trafostanica_mala";

leader=1;

skill=1.000000;

text="Transformer";

};

Save the file and load up your mission. The cobra is now a tranformer station named Transformer. Place it so it fits in with the pre-existing objects and your good to go.

We use an editor placed object rather than calling the ID of a map placed one in the triggers condition field because currently theres a bug with Arma in that it wont work for players if they join a game in progress after said map object has been destroyed.

If you want to get rid of other lightpoints you mightve created yourself, just setpos

Quote:

lightone setpos (getpos objectname)

them to a remote location on the map, ive found trying to delete them doesnt seem to work (for lights created in the init fields of gamelogics at least).

Share this post


Link to post
Share on other sites

Since AI boys can see in the dark just as well as during daylight hours (even if they ain't got no NV goggles), the player actually should save lampposts & stuff like that, not blow `em up smile_o.gif

Share this post


Link to post
Share on other sites
We use an editor placed object rather than calling the ID of a map placed one in the triggers condition field because currently theres a bug with Arma in that it wont work for players if they join a game in progress after said map object has been destroyed.

Nice work on the activation code!

Regarding using the editor placed object, just to make sure I understand, you use this method because if you use a map object ID transformer a JIP-ed player can see the ruins of the destroyed builiding. Is that correct or does it have something to do with the lights not properly switching off? If it is only to see the ruins, might the latest dedicated server beta release fix that based on the changelog?

Quote[/b] ]5164 - Fixed: Building ruins were not visible for JIP-ed players.

Share this post


Link to post
Share on other sites

the script itself was done by our mission\script maker,       [KH]Misinformed

but yea if a JIP-ED player joins i believe the powerstation wont looked like it been destroyed, but the dedi patch as sorted that, so it works fine for all.

if you have any probs with it, just pop in and ask at www.kellys-heroes.eu

Share this post


Link to post
Share on other sites

I just gave an idea, i can't script.

There is also one more silly thing, if car hits electricity post then some towns can be out of electricity too smile_o.gif)

Share this post


Link to post
Share on other sites
Since AI boys can see in the dark just as well as during daylight hours (even if they ain't got no NV goggles), the player actually should save lampposts & stuff like that, not blow `em up smile_o.gif

yeh but if your playing a match where one player side is attacking and another player side is defending then it would make a diffrence.

Share this post


Link to post
Share on other sites

Inspired by this thread and similar discussions elsewhere, I have begun working on a script that will as accurately as possible simulate an electrical power grid for the entire Island of Sahrani (North and South). By simulate I mean if one of the seven electrical substations on the Island has its "power" cut, it will switch off the lights for all the cities and towns that the substation services.

Power will be able to be cut by damaging/destroying the substation. I don't plan on including posts, poles, or towers(pylons) at this time because it far too many objects to manipulate and not as sporting as the substations (although I will outline a framework for mission makers to include this if they so desire as well as a way to stealthily cut the power.).

To activate these features, all a mission maker will have to do is include the script in the mission folder and execute it once. If you don't want to activate the "grid" on the whole island it will be easy to remove unwanted sectors.

More details to follow and no projected release date yet but I am about 25% done so far and it works perfectly!

Share this post


Link to post
Share on other sites

yea sounds good mate, just thought this up, maybe someone could make a script for the engineers, so they can repair the substations,so if its (coop\PvP) if say carazol loses its electricity, we could use the engineers to repair it,

but not instanstly maybe if there is just one engineer it would take 10 mins to repair, but if there is two it would take 5 mins,so there is a stategic part where u would need to keep the engineers alive or set up a defence perimter so they can do there job, dunno just an idea for you to work around

wink_o.gif

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  

×