Home   Help Search Login Register  

Author Topic: Destroying all buildings in an area  (Read 1916 times)

0 Members and 1 Guest are viewing this topic.

Offline punisher

  • Members
  • *
Destroying all buildings in an area
« on: 12 Jul 2011, 17:43:42 »
Hi , im looking for a way to have all the buildings in a city start off in their destroyed state. I have encountered this in a mission before i think. The obvious way is to use a large bomb like a nuke but i want it to start of destroyed not in the process of being..
Thanks
The Gimp clan- pushing the limits of OFP
http://www.youtube.com/user/Pigdogmeat

Re: Destroying all buildings in an area
« Reply #1 on: 12 Jul 2011, 18:34:38 »
Yeah using a large bomb would work but if you turn on IDs, the button just above or below Show Textures then all the buildings, trees and objects on the island will show an ID then in a trigger or your init.sqf file you can use

Code: [Select]
(object ID) setdamage 1
Just replace "ID" with the number of the building you want destroyed. I'm not entirely sure if there is an easier way destroy multiple buildings other than just typing the above code out and adding all of the IDs in it.

Edit - Just checked and apparantly this doesn't work in ArmA any more, so instead create a gamelogic and place it next to/on the building you want destroyed, give it a name. And then in a trigger or script use

Code: [Select]
((position gamelogic) nearestObject objectID) setDamage 1
Then just replace gamelogic with the name of your game logic and objectID with the ID of what you want destroyed.
« Last Edit: 12 Jul 2011, 18:39:33 by aLlamaWithARifle »

Offline Wolfrug

  • Addons Depot
  • Former Staff
  • ****
  • Official OFPEC Old Timer
Re: Destroying all buildings in an area
« Reply #2 on: 13 Jul 2011, 15:19:31 »
Actually, BIS also has a function for this. I haven't tried it myself, but here's the BIKI page for it:

http://community.bistudio.com/wiki/BIS_fnc_destroyCity

You need to place down the Functions module (via F7), and then you need to make sure it's loaded before you run it, by using waituntil {!isnil "bis_fnc_init"}; So, something like this in your init.sqf might work:

Code: [Select]
waituntil {!isnil "bis_fnc_init"};
["destroyCity",500,42,[]] call bis_fnc_destroyCity;

Some notes: "destroyCity" is the name of a marker, which is at the center of the town to be destroyed. 500 is the area in meters around the marker that will be affected. 42 is seed number - this means that the same buildings will be destroyed in the same way as long as you use the same number; you can try different numbers for different effects. The empty array [] can be used to add exceptions, if you for instance don't want a certain building to be destroyed, you'd put its class name in there.

Right! Hopefully this works for you. Remember to place down the Functions module first though, or nothing will happen ;)

Wolfrug out.

"When 900 years YOU reach, look as good you will not!"

Offline punisher

  • Members
  • *
Re: Destroying all buildings in an area
« Reply #3 on: 13 Jul 2011, 22:38:22 »
maybe im not doing it right, or some buildings in arma cannot be reduced to rubble? But it only seems to affect around about 1/4 buildings
The Gimp clan- pushing the limits of OFP
http://www.youtube.com/user/Pigdogmeat

Offline h-

  • OFPEC Site
  • Administrator
  • *****
  • Formerly HateR_Kint
    • OFPEC
Re: Destroying all buildings in an area
« Reply #4 on: 14 Jul 2011, 10:22:06 »
That module is a bit sucky, I was about to suggest it myself but it wouldn't destroy all buildings, just some random ones regardless of what seed number used.
Tried using a random seed number and running it several times in a row but then it would actually "fix" some buildings it destroyed earlier.. So it's a bit "BIS'd" as usual ::)

It doesn't destroy all buildings into a pile of rubble because if the building has different destruction states it may "activate" one those instead so the large buildings that can have pieces blown off of them may only get one of those blown off.

Oh, and
Quote
["destroyCity",500,42,[]]
There is no need for the empty array there, it's optional so the function will only run through some extra hoops in vain if you add it there. Same with the seed value, it's also optional so you can add a value if you wish. Dunno what exactly it does, I guess it's some randomness thingy..
Project MCAR   ---   Northern Fronts   ---   Emitter 3Ditor
INFORMATIVE THREAD TITLES PLEASE. "PLEASE HELP" IS NOT ONE..
Chuck Norris can divide by zero.

Offline mr_book.PXS.Pvt

  • Members
  • *
Re: Destroying all buildings in an area
« Reply #5 on: 15 Jul 2011, 00:28:14 »
Hiya,
how about this approach?
Code: [Select]
_buildings = [getmarkerpos "destroyCity"] nearObjects ["house", 500];
{_x setdamage 1} foreach _buildings;
Modules? Mules! Don't trust BIS!