Home   Help Search Login Register  

Author Topic: Destroying Map Objects  (Read 1587 times)

0 Members and 2 Guests are viewing this topic.

Offline greg147

  • Contributing Member
  • **
    • Royal Air Assault Battalion
Destroying Map Objects
« 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
Royal Air Assault Battalion - [L/Cpl] Greg
RAAB

Offline Mandoble

  • Former Staff
  • ****
    • Grunt ONE and MandoMissile suite
Re: Destroying Map Objects
« Reply #1 on: 11 Jul 2007, 22:28:14 »
In ArmA you need first to get the object:
Code: [Select]
_object = _position nearestObject objectId

Offline greg147

  • Contributing Member
  • **
    • Royal Air Assault Battalion
Re: Destroying Map Objects
« Reply #2 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?
Royal Air Assault Battalion - [L/Cpl] Greg
RAAB

Offline Mandoble

  • Former Staff
  • ****
    • Grunt ONE and MandoMissile suite
Re: Destroying Map Objects
« Reply #3 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

Offline greg147

  • Contributing Member
  • **
    • Royal Air Assault Battalion
Re: Destroying Map Objects
« Reply #4 on: 11 Jul 2007, 23:25:22 »
Thanks a lot, got it working.
Royal Air Assault Battalion - [L/Cpl] Greg
RAAB