Home   Help Search Login Register  

Author Topic: Target filter  (Read 1036 times)

0 Members and 1 Guest are viewing this topic.

Offline Scrub

  • Members
  • *
Target filter
« on: 10 Nov 2007, 06:30:22 »
Hi all, 

I'm currently trying to write a script to filter out targets of a particular type.  I'm aware of the TypeOf command and have few worries for selecting the appropriate target.. My biggest trouble is cycling targets either natively by somehow activating the "locktargets" key (value gained by the ActionKeys command), or by updating and indexing through an array of known targets using the NearTargets (which I have not been able to extract any information from at all), and doing a DoTarget command when I've found the appropriate type.  Any tips by the gurus on any aspect of this endeavor would be appreciated beyond measure.  Thank you.  :)

Offline LCD

  • Former Staff
  • ****
    • Everon Cartel
Re: Target filter
« Reply #1 on: 10 Nov 2007, 07:30:21 »
actualy ive did somin close 2 dat for my newest mision... (check out my sig line :P ;))

nywayz... on how 2 work it... u got da right guess... usin da neartargets :D and da iskindof command heres a small snippet dat will have all da target of certain type in distance of 1000 m of da vehicle in an array... :D

Code: [Select]

_type = _this select 0;
_un = _this select 1;

_tars = _un neartargets 1000;
_targets = [];

for [{_i = 0},{_i < count _tars },{_i = _i + 1}] do
{
      _target = _tars  select _i;
     
      if ((_target select 1) iskindof _type) then {_targets = _targets + [_target select 4]}
};

rest of code....

u exec dif function like dat....

["typeYouAreLookingFor",UnitDaTargetIsNear] execVM "functionname.sqf"

now wat u do after da loop finishes u can use da _targets variables dat will have all da targets wanted

LCD OUT

[edit]

WELCOME 2 OFPEC M8
"guess being the community has downsides .." - cheetah
Help Perfecting Da Next Best Thing - O-Team Beta

Offline Scrub

  • Members
  • *
Re: Target filter
« Reply #2 on: 11 Nov 2007, 00:05:49 »
Thanks much for the insight and the exact snippet I needed.   If I am successful, you shall get the credit for it. (especially because I'll be asking more questions since ArmA scripting syntax kills this noob!!)

Thanks again.  :good: