Home   Help Search Login Register  

Author Topic: object destruction  (Read 2006 times)

0 Members and 1 Guest are viewing this topic.

Offline sharkattack

  • Former Staff
  • ****
object destruction
« on: 11 Jun 2009, 21:40:31 »
hi lads

how could i set up a trigger/ script  to detect if a certain building class  has been destroyed

only way i can do it at the min is to list all possible object ids ... ???

any tips on an easier way  would be much appreciated

best wishes  :good:
"HOLY SARDINE" - see Shark-Attack meet his match

Offline Spooner

  • Members
  • *
  • Mostly useless
    • Community Base Addons
Re: object destruction
« Reply #1 on: 12 Jun 2009, 02:54:44 »
Code: (init line for a logic in the middle of the map area you are using) [Select]
{ _x addEventHandler ["KILLED", { _this execVM "somethingWentBoom.sqf" }] } forEach nearestObjects [this, ["CheeseFactory", "BigHouse"], 1000];
I made up the classnames (you didn't specify what you were searching for), but this would mean that it would add killed handlers to all objects that inherited from CheeseFactory or BigHouse within 1000m of the logic.

[Arma 2] CBA: Community Base Addons
[Arma 1] SPON Core (including links to my other scripts)

Offline sharkattack

  • Former Staff
  • ****
Re: object destruction
« Reply #2 on: 12 Jun 2009, 18:06:46 »
thanks a million mate ...
just tried it ... works a treat ..  :good:

« Last Edit: 12 Jun 2009, 18:31:34 by sharkattack »
"HOLY SARDINE" - see Shark-Attack meet his match

Offline Kessler

  • Members
  • *
Re: object destruction
« Reply #3 on: 25 Jun 2009, 05:43:47 »
is it possible to say, make a seek and destroy waypoint, use this script and blow up.. 'said barracks' and waypoint complete? Also, use this same method to triggered victory for killing 'units'?

Offline sharkattack

  • Former Staff
  • ****
Re: object destruction
« Reply #4 on: 26 Jun 2009, 17:53:05 »
having similar trouble  trying to  setdamage 1 to  work on certain buildings within a set area
statues in this example

{_x setDamage 1} foreach (position target1 nearObjects ["Land_A_statue01", "Land_A_statue01", 500]);


anyone tell me where im going wrong  with the code  cant get it to work

many thanks  and best wishes
"HOLY SARDINE" - see Shark-Attack meet his match

Offline mikey

  • Former Staff
  • ****
  • Whitespace Whore
Re: object destruction
« Reply #5 on: 26 Jun 2009, 19:48:13 »
from what I see in my rpt-file, nearObjects only accepts 1 or 2 arguments (while you give it 3). If you want to check for multiple types, use nearestObjects.

btw, you're using the same object type twice?

Offline sharkattack

  • Former Staff
  • ****
Re: object destruction
« Reply #6 on: 26 Jun 2009, 23:54:36 »
oops should of read

{_x setDamage 1} foreach (position target1 nearObjects ["Land_A_statue01", "Land_A_statue02", 500]);

thanks mikey 
will try nearestObjects

nice one mate   :good:
"HOLY SARDINE" - see Shark-Attack meet his match

Offline sharkattack

  • Former Staff
  • ****
Re: object destruction
« Reply #7 on: 08 Jul 2009, 14:31:59 »
both codes work perfectly thanks a million lads .

however ... would it be possible to include a count to spooners code so that the somethingwentboom.sqf was only fired when say 5 of the "cheesefactorys" were destroyed ?

Code: [Select]
{ _x addEventHandler ["KILLED", { _this execVM "somethingWentBoom.sqf" }] } forEach nearestObjects [this, ["CheeseFactory", "BigHouse"], 1000];


many thanks and best wishes and  long live ofpec

"HOLY SARDINE" - see Shark-Attack meet his match

Offline Spooner

  • Members
  • *
  • Mostly useless
    • Community Base Addons
Re: object destruction
« Reply #8 on: 08 Jul 2009, 16:19:49 »
Easiest to deal with this in the handler script:
Code: (somethingWentBoom.sqf) [Select]
if (isNil "boomCounter") then { boomCounter = 0 };

boomCounter = boomCounter + 1;

// <-- Do stuff every time.

if (boomCounter == 5) then
{
  // <-- Do stuff on 5th destroyed.
};
[Arma 2] CBA: Community Base Addons
[Arma 1] SPON Core (including links to my other scripts)

Offline sharkattack

  • Former Staff
  • ****
Re: object destruction
« Reply #9 on: 13 Jul 2009, 17:54:05 »
thank you works a charm !   :good:
"HOLY SARDINE" - see Shark-Attack meet his match