Home   Help Search Login Register  

Author Topic: CountType/Enemy  (Read 1231 times)

0 Members and 1 Guest are viewing this topic.

Bremmer

  • Guest
CountType/Enemy
« on: 07 Oct 2002, 14:21:35 »
Hmm ... mabey a difficult one this  :-\

I can count the number of units from an array that any particular unit considers an enemy using the countenemy command.

I can also count the number of any particular vehicle type from the array using the counttype command.

Question is how can I count the number of any particular vehicle type that a unit considers an enemy?

Any ideas are welcome.

Cheers

Offline Tomb

  • Contributing Member
  • **
  • in2 Metal? Go 2 my sig
Re:CountType/Enemy
« Reply #1 on: 07 Oct 2002, 15:49:49 »
wassup, goldie  8) ;)

 Tried a "vehicle" condition  :D like "vehicle _x != bla-bla"  ???

pure fantasy here, I just remembered this way (used on a single unit),
and maybe it's possible to use together w/ the countenemy?!

on a single unit it would be the "veh. Bob !=Bob" but used on
counted hostile cattle I just dunno  :-\ ???

The hard work & scientific titzs...TESTS ( ::) ) must be your part  ;D


 (¤#"Â'spelling) Oh well, laterz m8  :-*
« Last Edit: 07 Oct 2002, 16:02:08 by Tomb »

Offline Chris Death

  • Former Staff
  • ****
  • Finally Death's gonna get ya
    • OFPEC
Re:CountType/Enemy
« Reply #2 on: 07 Oct 2002, 16:00:32 »
Put all the enemy units, you got by countenemy into an arry, and count your "type" vehicle from that array.

The result should be all vehicles of your type seen as enemy
to the unit.

:edit

Or do it the other way:

put the vehicles you want into an arry and countenemy from
this array.

~S~ CD
« Last Edit: 07 Oct 2002, 16:02:53 by Chris Death »
Dont argue with idiots....they will bring you down to their level and beat you there with experience.

How to use Waypoint type Scripted

Bremmer

  • Guest
Re:CountType/Enemy
« Reply #3 on: 07 Oct 2002, 17:21:47 »
Thanks for the ideas so far - keep them coming ...

Tomb - I have a work around just now using this sort of idea, but it requires looping through each unit in turn and checking its type. If it is the correct type then I assign it to a new array that I can countenemy with.

Chris - Unfortunately the countenemy/type doesnt return an array - just a number - so no dice  :(

Cheers

PS. Heres my work-around solution, I really hope there is a better way to do this:

_enemy = _this select 0 {this comes from thislist on an enemy present trigger}
_armour = []
_i = (count _enemy) - 1

#count_armour
;select the next unit
_unit = _enemy select _i
;add the unit to the armour array if it is a tank, APC or ship
? ("tank" CountType [_unit] == 1) : _armour = _armour + [_unit]
? ("APC" CountType [_unit] == 1) : _armour = _armour + [_unit]
? ("ship" CountType [_unit] == 1) : _armour = _armour + [_unit]
;select the next enemy unit
_i = _i - 1
? (_i >= 0) : goto "count_armour"

#main
;how many armoured units does _bloke perceive as a threat
_howmany = _bloke countenemy _armour


Offline Chris Death

  • Former Staff
  • ****
  • Finally Death's gonna get ya
    • OFPEC
Re:CountType/Enemy
« Reply #4 on: 07 Oct 2002, 23:22:02 »
Quote
Chris - Unfortunately the countenemy/type doesnt return an array - just a number - so no dice  

Yeah, that's why i also suggested to try it the other way.
Capture the vehicles of given types with an array and do
the countenemy on this array.

~S~ CD
Dont argue with idiots....they will bring you down to their level and beat you there with experience.

How to use Waypoint type Scripted

Offline Tomb

  • Contributing Member
  • **
  • in2 Metal? Go 2 my sig
Re:CountType/Enemy
« Reply #5 on: 07 Oct 2002, 23:35:11 »
Tomb - I have a work around just now using this sort of idea,


----------------

lol, ya dirty rat - I knew you'd say this, goldie.  ::) ;D I'll just grab the
final sample coming outta this - DO post one
when you have it sorted, m8  :-* :) I'd love that