OFPEC Forum

Editors Depot - Mission Editing and Scripting => ArmA - Editing/Scripting General => Topic started by: greg147 on 11 Jul 2007, 22:21:53

Title: Destroying Map Objects
Post by: greg147 on 11 Jul 2007, 22:21:53
Hi all,

I've noticed that the command seems to have changed from OFP. 'object XXXXXX setdamage 1' doesn't work any more.

Does anyone know what the new code is?

Thanks
Title: Re: Destroying Map Objects
Post by: Mandoble on 11 Jul 2007, 22:28:14
In ArmA you need first to get the object:
Code: [Select]
_object = _position nearestObject objectId
Title: Re: Destroying Map Objects
Post by: greg147 on 11 Jul 2007, 23:00:18
Ah, thanks.

Having a bit of trouble getting it to work though, havn't used nearestObject before. How would that fit into a script file with the setdamage line?
Title: Re: Destroying Map Objects
Post by: Mandoble on 11 Jul 2007, 23:15:50
You need the position closest to the map building or object you want to destroy, so you should place a gamelogic or a marker quite close to it, lets suppose your logic is name "log_target" and the map object is 112234:

Code: [Select]
// SQF code
_object = (getPos log_target) nearestObject 112234;
if (!isNull _object) then
{
   _object setDamage 1;
};

Code: [Select]
// SQS code
_object = (getPos log_target) nearestObject 112234
? !isNull _object: _object setDamage 1
Title: Re: Destroying Map Objects
Post by: greg147 on 11 Jul 2007, 23:25:22
Thanks a lot, got it working.