Jump to content
rekkless

How to damage all buildings on mission start?

Recommended Posts

So after watching Frankies latest ArmA 3 video based on Tanoa I noticed when he and his mate head into George Town the place looks smashed and all the buildings look damaged.

 

Does anyone know how you can do this in the editor?


Keep in mind I don't want the buildings destroyed, I know in MCC there is the war torn mode but that levels the buildings.

I don't want to make all cities flat but making so many of them if not all of them with a trigger or some for of scripting look damaged from the mission get go really help with the immersion and makes it look like you are part of a war zone.

 

Video for reference:
https://youtu.be/f8bMDZrfOwo?t=20m12s

  • Like 1

Share this post


Link to post
Share on other sites

There was a destroy city function that was used on Zargabad in the Arma 2 PMC campaign. Maybe it still works?

 

Yup, BIS_fnc_destroyCity.

 

Place an invisible helipad, call it groundZero.

 

Place a trigger, condition true, activation [groundZero, 1000, 40] call BIS_fnc_destroyCity

  • Like 1

Share this post


Link to post
Share on other sites

Otherwise (and to have more control) place a trigger/logic with

{_x setdammage ((random 0.5)+0.4)} foreach ((getpos this) nearObjects ["House", 500]); 

This will damage all houses in a radius of 500 between 40-90%. You may want to repeat that command with "Building" instead of "House".

 

Also keep in mind that massdamaging of objects may cause a drop of framerate and stutter on the clients, so exec this at init and before missionstart.

  • Like 2

Share this post


Link to post
Share on other sites

IIRC the Ravage addon is doing that, probably some kind of texture replacement. Not really sure. You should check it.

Share this post


Link to post
Share on other sites

Otherwise (and to have more control) place a trigger/logic with

{_x setdammage ((random 0.5)+0.4)} foreach ((getpos this) nearObjects ["House", 500]); 

This will damage all houses in a radius of 500 between 40-90%. You may want to repeat that command with "Building" instead of "House".

 

Also keep in mind that massdamaging of objects may cause a drop of framerate and stutter on the clients, so exec this at init and before missionstart.

I can't seem to get this to work. I'm pretty new to triggers and I don't know how to activate it. I've tried using condition 'this' and having an area set to trigger the event when someone's in it but that won't work.

Share this post


Link to post
Share on other sites

You can also run this from the init of a gamelogic/player/invisible helih/whatever.

How would I do this from the init and/or with game logic, as not to have to much frame rate issues. I would only need houses and buildings of smaller areas and not the entire city. More of a war torn or fighting path through an area. Any way to allow this server side and/or with headless client?

 

Humble Thank you,

Share this post


Link to post
Share on other sites

Put this in to your initServer.sqf

{ _x setdamage 1;} foreach ( nearestobjects [[5755.24,10215.7,0], [], 700 ] );

This will damage all buildings in Georgetown in a 700 meter radius.

 

This is the location of the center of the damage radius, just place a can or something and then right-click and navigate to the Log option and click position to clipboard.

[5755.24,10215.7,0]

Not all of the buildings are flattened by this anyway, so this will give you what you want.

Share this post


Link to post
Share on other sites

Or directly add my code to the can's init without the (unelegant) need of hardcoding positions.

@Jnr4817 You add the script only to one object in the center of the city. It marks the center of distruction. You DON'T add it to all objects that you want damaged

Share this post


Link to post
Share on other sites
On 9/14/2016 at 4:00 AM, jakeplissken said:

Put this in to your initServer.sqf


{ _x setdamage 1;} foreach ( nearestobjects [[5755.24,10215.7,0], [], 700 ] );

This will damage all buildings in Georgetown in a 700 meter radius.

 

This is the location of the center of the damage radius, just place a can or something and then right-click and navigate to the Log option and click position to clipboard.


[5755.24,10215.7,0]

Not all of the buildings are flattened by this anyway, so this will give you what you want.

What goes in the middle set of brackets? Is there a way to blacklist, say, vehicles that are in the city so that only buildings get destroyed?

Share this post


Link to post
Share on other sites
27 minutes ago, SkyNT19ht02 said:

What goes in the middle set of brackets? Is there a way to blacklist, say, vehicles that are in the city so that only buildings get destroyed?

 

You exactly answered your question yourself. :P
As you can see here the function looks like this "nearestObjects [position, types, radius, 2Dmode]" that means the middle set of brackets here lets you specify what type of object should be affected. Try it with "house" (With the " ") inside the bracket.

BTW, the reason that "2DMode" is missing here: When something at the end is unused it can be dropped!  Edit: I think only if its (Optional). Sorry for the misinformation.

Share this post


Link to post
Share on other sites
On 9/11/2017 at 10:24 PM, Moon_chilD said:

 

You exactly answered your question yourself. :P
As you can see here the function looks like this "nearestObjects [position, types, radius, 2Dmode]" that means the middle set of brackets here lets you specify what type of object should be affected. Try it with "house" (With the " ") inside the bracket.

BTW, the reason that "2DMode" is missing here: When something at the end is unused it can be dropped!  Edit: I think only if its (Optional). Sorry for the misinformation.

Works like a charm, thank you!

Share this post


Link to post
Share on other sites
On 9.9.2016 at 5:38 AM, rekkless said:

So after watching Frankies latest ArmA 3 video based on Tanoa I noticed when he and his mate head into George Town the place looks smashed and all the buildings look damaged.

 

Does anyone know how you can do this in the editor?


Keep in mind I don't want the buildings destroyed, I know in MCC there is the war torn mode but that levels the buildings.

I don't want to make all cities flat but making so many of them if not all of them with a trigger or some for of scripting look damaged from the mission get go really help with the immersion and makes it look like you are part of a war zone.

 

Video for reference:
https://youtu.be/f8bMDZrfOwo?t=20m12s

thanks for the hint with MCC. 
does MCC level everything on the map or can you choose certain areas?
- For example one city is completely messed up, but the nearby villages are untouched? 

Or can you even set damage properties for each building?
- e.g. all leveled but 1 single structure untouched

Share this post


Link to post
Share on other sites
On 9/14/2016 at 6:08 AM, NeoArmageddon said:

Or directly add my code to the can's init without the (unelegant) need of hardcoding positions.

@Jnr4817 You add the script only to one object in the center of the city. It marks the center of distruction. You DON'T add it to all objects that you want damaged

Works brilliantly, thanks.

Questions:

1. Is there are functional difference between "House" and "Building"? I've been reading the Bohemia docs and it's confusing. e.g. Inference that they're different object classes here: https://community.bistudio.com/wiki/nearestBuilding

2. Assuming I want to damage both, is this syntax correct? 

{_x setdammage ((random 0.5)+0.4)} foreach ((getpos this) nearObjects ["House","Building" 500]);

3. Could I run your code from the init of a marker instead of an entity (using a can, like you suggested)?

 

Thanks.

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

×