OFPEC Forum
Editors Depot - Mission Editing and Scripting => Arma2 - Editing/Scripting General => Topic started by: sharkattack 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:
-
{ _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.
-
thanks a million mate ...
just tried it ... works a treat .. :good:
-
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'?
-
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
-
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?
-
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:
-
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 ?
{ _x addEventHandler ["KILLED", { _this execVM "somethingWentBoom.sqf" }] } forEach nearestObjects [this, ["CheeseFactory", "BigHouse"], 1000];
many thanks and best wishes and long live ofpec
-
Easiest to deal with this in the handler script:
if (isNil "boomCounter") then { boomCounter = 0 };
boomCounter = boomCounter + 1;
// <-- Do stuff every time.
if (boomCounter == 5) then
{
// <-- Do stuff on 5th destroyed.
};
-
thank you works a charm ! :good: