OFPEC Forum

Editors Depot - Mission Editing and Scripting => Arma2 - Editing/Scripting General => Topic started by: ual002 on 16 Sep 2010, 23:22:34

Title: Destroying buildings in trigger area.
Post by: ual002 on 16 Sep 2010, 23:22:34
Is it somehow possible to set up a trigger to destroy all buildings in that trigger area?  And then copy trigger and put somewhere else on the map for more pre-destroyed buildings, quickly allowing the mission designer to proagate battlefield destruction.
Title: Re: Destroying builings in trigger area.
Post by: SaOk on 16 Sep 2010, 23:28:35
You could create named invisible helipads and then use this to give random damage to every house in the radius:

Code: [Select]
buildings = nearestObjects [helipad1,["Static"], 100];
{_x setDamage (random 2)+1/3;} foreach buildings - [helipad1];

If you have important objects in the area, you can also name them and avoid damageing them by placing in the array that is removed from variable buildings.

Example
Code: [Select]
{_x setDamage (random 2)+1/3;} foreach buildings - [helipad1,objectname1,objectname2];
Title: Re: Destroying builings in trigger area.
Post by: ual002 on 17 Sep 2010, 03:26:13
Im rather confused about the helipads but ill try it. Thanks

Edit: ok i see now, the trig radius isnt doing it, its the arguments in the nearestobj command
Title: Re: Destroying buildings in trigger area.
Post by: haroon1992 on 17 Sep 2010, 09:37:03
Put a gamelogic
put the following in init of logic

Code: [Select]
{_x setDammage (0.2+random 0.8)} foreach (nearestObjects [this,["STATIC"],100])
The radius in this case is 100m.

You can now copy & paste that gamelogic to other places where you want destruction.

To exclude objects,just do what SaOk have described.

Also : i'm not sure that the brackets ( and ) are required for  nearestobj.......IC"],100]
remove them if you get errors.

Just showing a simpler way in which you don't need to have names.

For timed destruction, just put the code in On Act box of the first waypoint of the logic.
(Adjust time in the waypoint)

Regards,
Haroon1992
Title: Re: Destroying buildings in trigger area.
Post by: ual002 on 17 Sep 2010, 15:36:26
excellent, what about walls? Im assuming walls dont fall under the static category...
Title: Re: Destroying buildings in trigger area.
Post by: F2kSel on 17 Sep 2010, 18:27:15
Code: [Select]
{_x setDammage 1} foreach (nearestObjects [this,[],100])  will destroy everything that can be destroyed.

You can't simply copy a wrecked building and transport to another location, you can do that with editor placed objects only.

I don't know if it's possible to even spawn a wrecked building, I would think not.

The best you could do is write a script to find the objects name and spawn that at a new location and then destroy it but that defeats the object.

Also you can't spawn roads,OA has the ability to create towns any way.


  
Title: Re: Destroying buildings in trigger area.
Post by: ual002 on 17 Sep 2010, 21:32:21
I played with the town generator. Its pretty neat.  Just gotta figure out how to create a chernarus building and object set for it.