Home   Help Search Login Register  

Author Topic: Counting empty vehicles, etc.  (Read 1251 times)

0 Members and 1 Guest are viewing this topic.

srk

  • Guest
Counting empty vehicles, etc.
« on: 22 Oct 2006, 21:14:21 »
Is it somehow possible to count all the empty, named vehicles (eg. t1, t2, t3) and then make a trigger which gets activated when 70% of them are destroyed? And if so, how?

Offline Mandoble

  • Former Staff
  • ****
    • Grunt ONE and MandoMissile suite
Re: Counting empty vehicles, etc.
« Reply #1 on: 22 Oct 2006, 21:34:10 »
Code: [Select]
;checkratio.sqs
;Pass the list of vehicles, ex. [[t1,t2,t3,t4,t5]]exec"checkratio.sqs"
_list = _this select 0
#check
_empty = "(count crew _x) == 0" count _list
_emptydestroyed = "((count crew _x) == 0)&&(damage _x > 0.8))" count _list
_ratio = _emptydestroyed*_empty
~4
?_ratio < 0.7:goto "check"
hint "RATIO 70%"
exit

srk

  • Guest
Re: Counting empty vehicles, etc.
« Reply #2 on: 23 Oct 2006, 17:56:49 »
Well it didn't work properly... I got the hint "RATIO 70%" after destroying 2-4 of the vehicles, and there were about 20 of them, and that isn't 70% of it, isn't it?

By the way, you forgot one ( on the "&&(damage _x > 0.8 ))" but I fixed it.

Offline Mandoble

  • Former Staff
  • ****
    • Grunt ONE and MandoMissile suite
Re: Counting empty vehicles, etc.
« Reply #3 on: 23 Oct 2006, 20:04:15 »
_ratio = _emptydestroyed * _empty should obviously be _ratio = _emptydestroyed / _empty

srk

  • Guest
Re: Counting empty vehicles, etc.
« Reply #4 on: 23 Oct 2006, 20:40:28 »
Ah, ok. :) Seems to work all fine now.

Thanks.