Jump to content
acoustic

Destroy almost all buildings on the map?

Recommended Posts

I've searched and searched to find something and came up short. I've messed around with the fnc_destroyCity but it does not destroy nearly enough buildings. I am really going for a war torn look. Any ideas?

Share this post


Link to post
Share on other sites
Guest

I've searched and searched to find something and came up short. I've messed around with the fnc_destroyCity but it does not destroy nearly enough buildings. I am really going for a war torn look. Any ideas?

 

You may try somthing like

_houses = nearestTerrainObjects [player, ["House"], 200]; //You may replace player with any object or location
{ _x setDamage 1 } count _houses;

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

Share this post


Link to post
Share on other sites

Beware though, for maps with a lot of objects it will cause stability issues - and forget SP with this, you won't be able to save so many modifications.

Share this post


Link to post
Share on other sites
/*
	Author: 
	BNAE
	
	Description:
	Destroy selected buildings on the start
*/
B_types = [			
			"Land_Chapel_V1_F",
			"Land_Chapel_V2_F",
			"Land_i_House_Big_01_V1_F",
			"Land_i_House_Big_01_V2_F",
			"Land_i_House_Big_01_V3_F",
			"Land_i_House_Big_02_V1_F",
			"Land_i_House_Big_02_V2_F",
			"Land_i_House_Big_02_V3_F",
			"Land_i_Shop_01_V1_F",
			"Land_i_Shop_01_V2_F",
			"Land_i_Shop_01_V3_F",
			"Land_i_Shop_02_V1_F",
			"Land_i_Shop_02_V2_F",
			"Land_i_Shop_02_V3_F",
			"Land_i_House_Small_01_V1_F",
			"Land_i_House_Small_01_V2_F",
			"Land_i_House_Small_01_V3_F",
			"Land_i_House_Small_02_V1_F",
			"Land_i_House_Small_02_V2_F",
			"Land_i_House_Small_02_V3_F"
];

fn_destroyall_sofia = {
[] spawn{

systemChat "Starting to destroy Sofia..";

for [{_i=0},{_i < (count B_types)},{_i=_i+1}] do {
		_building = getMarkerPos "DESTROYALL_SOFIA" nearObjects [B_types select _i, 300];
		sleep 7;
		{_x setDamage 1} forEach _building;
};
systemChat "Sofia - Ready";

call fn_destroyall_paros;
};
};

fn_destroyall_paros = {
[] spawn{

systemChat "Starting to destroy Paros..";
for [{_i=0},{_i < (count B_types)},{_i=_i+1}] do {
		_building = getMarkerPos "DESTROYALL_PAROS" nearObjects [B_types select _i, 500];
		sleep 7;
		{_x setDamage 1} forEach _building;
};
systemChat "Paros - Ready";
};
};

Add more buildings to the list, increase radius, enjoy low FPS

Share this post


Link to post
Share on other sites
Guest

Would it be better using hide object and make the destroyed building spawn in place of the first one ?

Share this post


Link to post
Share on other sites

btw, why it causes low fps?
I can understand it during the script running it can reduce fps due to animations but after all destroyed fps should be normal or am I missing a point?

  • Like 1

Share this post


Link to post
Share on other sites

Would it be better using hide object and make the destroyed building spawn in place of the first one ?

 

I don't think so; you're basically doubling the amount of objects on the map.

Share this post


Link to post
Share on other sites
Guest

I don't think so; you're basically doubling the amount of objects on the map.

 

Could be better than running a destruction animation.

Share this post


Link to post
Share on other sites

Wasn't the issue with destoyed buildings reducing FPS solved long ago? At least I haven't heard any complaints about that in a while.

Share this post


Link to post
Share on other sites

Messed around with BNAe's script and others. Any time you go over a significant amount of radius, it crashes. And that's just buildings, not even other objects as well (which I forgot to add in the OP). 

 

Does Eden not have a feature that makes this simple and doesn't cause crashes? Simply just want a war torn look on the map. Buildings, objects ect. 

 

Gonna mess around with Eden and see what I come up with.

Share this post


Link to post
Share on other sites

Destroy the towns when needed (player approaches). Don't destroy them all at once

Share this post


Link to post
Share on other sites

As you can see in my example you can destroy one city at a time with one building type at a time to avoid any minor issues. Should work just fine if you're trying to create "immersive" cities. It'll take awhile but it works like a charm for the purpose.

Share this post


Link to post
Share on other sites

Seems somewhat complicated but if its the best way, then Ill give it a go. Appreciate it.

Share this post


Link to post
Share on other sites

Hmmm can't get this to work.

 

Tested it just on the town of Sofia..

 

Trigger activated by blufor with... 

 

Quote

_null = [] execVM "destruction.sqf";

 

A marker in the middle of Sofia called 

 

Quote

DESTROYALL_SOFIA

 

 

then this in a 'destruction.sqf' file in the mission folder..

 

Quote

B_types = [            
            "Land_Chapel_V1_F",
            "Land_Chapel_V2_F",
            "Land_i_House_Big_01_V1_F",
            "Land_i_House_Big_01_V2_F",
            "Land_i_House_Big_01_V3_F",
            "Land_i_House_Big_02_V1_F",
            "Land_i_House_Big_02_V2_F",
            "Land_i_House_Big_02_V3_F",
            "Land_i_Shop_01_V1_F",
            "Land_i_Shop_01_V2_F",
            "Land_i_Shop_01_V3_F",
            "Land_i_Shop_02_V1_F",
            "Land_i_Shop_02_V2_F",
            "Land_i_Shop_02_V3_F",
            "Land_i_House_Small_01_V1_F",
            "Land_i_House_Small_01_V2_F",
            "Land_i_House_Small_01_V3_F",
            "Land_i_House_Small_02_V1_F",
            "Land_i_House_Small_02_V2_F",
            "Land_i_House_Small_02_V3_F"
];

fn_destroyall_sofia = {
[] spawn{

systemChat "Starting to destroy Sofia..";

for [{_i=0},{_i < (count B_types)},{_i=_i+1}] do {
        _building = getMarkerPos "DESTROYALL_SOFIA" nearObjects [B_types select _i, 300];
        sleep 7;
        {_x setDamage 1} forEach _building;
};
systemChat "Sofia - Ready";

 

 

Nothing happens at all. 

 

Any ideas what I've done incorrectly?

Share this post


Link to post
Share on other sites

First, you're missing two };
You're not closing the fn_destroyall_sofia = {  nor   [] spawn{

Second, even if that is fixed the script doesn't do what you want because what your script does is it defines a function called fn_destroyall_sofia, that's all.

Calling that function would destroy the buildings..
EDIT:
Also, since you execute the script with execVM it's already in scheduled environment so you don't need the spawn there either..
 

So, change your script to this (should work):
 

B_types = [            
            "Land_Chapel_V1_F",
            "Land_Chapel_V2_F",
            "Land_i_House_Big_01_V1_F",
            "Land_i_House_Big_01_V2_F",
            "Land_i_House_Big_01_V3_F",
            "Land_i_House_Big_02_V1_F",
            "Land_i_House_Big_02_V2_F",
            "Land_i_House_Big_02_V3_F",
            "Land_i_Shop_01_V1_F",
            "Land_i_Shop_01_V2_F",
            "Land_i_Shop_01_V3_F",
            "Land_i_Shop_02_V1_F",
            "Land_i_Shop_02_V2_F",
            "Land_i_Shop_02_V3_F",
            "Land_i_House_Small_01_V1_F",
            "Land_i_House_Small_01_V2_F",
            "Land_i_House_Small_01_V3_F",
            "Land_i_House_Small_02_V1_F",
            "Land_i_House_Small_02_V2_F",
            "Land_i_House_Small_02_V3_F"
]; 

systemChat "Starting to destroy Sofia.."; 
    
for [{_i = 0}, {_i < (count B_types)}, {_i = _i + 1}] do { 
        private _building = getMarkerPos "destroyall_sofia" nearObjects [B_types select _i, 300];
        sleep 7; 
        {_x setDamage 1} forEach _building; 
}; 
systemChat "Sofia - Ready";

 

Edited by h -

Share this post


Link to post
Share on other sites

There is also a new module on devbranch which allows you to destroy buildings in its area.

  • Like 1

Share this post


Link to post
Share on other sites
On 8/24/2017 at 2:22 PM, R3vo said:

There is also a new module on devbranch which allows you to destroy buildings in its area.

Is that the environment module(edit terrain object)in Eden?If so how do you use it if you want the entire city leveled,instead of just one object?Haleks Ravage mod does a good job as far as damage but I want to level the entire city

Share this post


Link to post
Share on other sites
59 minutes ago, miasdad said:

Is that the environment module(edit terrain object)in Eden?If so how do you use it if you want the entire city leveled,instead of just one object?Haleks Ravage mod does a good job as far as damage but I want to level the entire city

 

Always happy to help destroying stuff! Here's a ready-to-use function :

//example : [getpos somelogic, 1000, 1] call myFunction to level everything, or :
//[getpos somelogic, 1000, 0.75] call myFunction to damage everything
myFunction = {
	params ["_pos", "_radius", "_dam"];
	_arr = [
	"BUILDING",
	"HOUSE",
	"CHURCH",
	"CHAPEL",
	"BUNKER",
	"FORTRESS",
	"VIEW-TOWER",
	"LIGHTHOUSE",
	"FUELSTATION",
	"HOSPITAL",
	"WALL",
	"HIDE",
	"BUSSTOP",
	"STACK",
	"TOURISM",
	"WATERTOWER",
	"POWER LINES",
	"POWERSOLAR"
	];
	{
		_x setDamage [_dam, false]
	} forEach (nearestTerrainObjects [_pos, _arr, _radius,false]);
	true
};

I'm pretty sure nothing will survive that - although keep in mind that some buildings may not have a proper "damaged" model (mostly structures from Tanoa).

  • Like 4

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

×