Home   Help Search Login Register  

Author Topic: Trigger activates when only a couple are still alive  (Read 789 times)

0 Members and 3 Guests are viewing this topic.

Doc Ho

  • Guest
Hi all...

I have a very basic question...and I did try the search functuion but to no avail...

Here goes...

I want a trigger that goes off when only a couple of people are still alive...side specific and it has to count soldiers only...something like "counttype man thislist" or "counttype man trigger1".

I had the correct syntax but than I had to reformat and everything is gone. I do remember that it was a 2 trigger system, both were on repeatedly...the rest is a blur.

Thanks a lot for your help.

Bye

Offline macguba

  • Former Staff
  • ****
    • macguba's operation flashpoint page
Re:Trigger activates when only a couple are still alive
« Reply #1 on: 17 Sep 2005, 18:11:01 »
Trigger

Area:  whole  map
Activation box:  East present
Condition:   "alive _x" count thislist < 2.5

Not guaranteed.    And it will count a vehicle as 1, I think.
Plenty of reviewed ArmA missions for you to play

Doc Ho

  • Guest
Re:Trigger activates when only a couple are still alive
« Reply #2 on: 17 Sep 2005, 18:15:46 »
Thx very much on the fast reply...but I might be a stupid lame ass for asking this but why 2,5...there can't be 2,5 alive soldiers or can they ???

and yes vehicles count as 1
« Last Edit: 17 Sep 2005, 18:16:21 by Doc Ho »

bored_onion

  • Guest
Re:Trigger activates when only a couple are still alive
« Reply #3 on: 17 Sep 2005, 18:40:40 »
is it a zombie mission? if so, the half of a unit could count as one of the "undead." other than that, its probably an easy way of getting around the bug that sometimes occurs when using "less than or equal to" (<=) signs. since in this case the value will never be anything but an integer (whole number) it doesn't matter if you use a half.

Offline THobson

  • OFPEC Patron
  • Former Staff
  • ****
Re:Trigger activates when only a couple are still alive
« Reply #4 on: 17 Sep 2005, 18:55:19 »
The reason for the 0.5 is a safety measure when using computer numbers.  Not all numbers are exact whole numbers (integers) 3 might be 3.0000000001 or 2.9999999999.  If you put < 3 then you would get different answers for each of these.  In my experience OFP is pretty good at returning integer values ( that is whole numbers only) from count, so in your case I would use < 3, but < 2.5 is not wrong and probably safer.

I know nothing about zombies.

I started this reply with the intention of giving a simple solution to the point macguba mentions that the code will count 1 for each vehicle that has units in it, irrespective of how many units there are inside it.  There is a solution - I use it myself, but not with triggers.  If you are okay using scripts then:
1. create a trigger that covers the map set to detect East present.
2. in the activation field of the trigger put: [thislist] exec "createEastList.sqs";[] exec "CheckTwoEastLeft.sqs"

createEastList.sqs looks like:

Code: [Select]
_list = _this select 0
e_loons  = []
{{if ((alive _x) and not (_x in e_loons)) then {e_loons = e_loons +[_x]} } forEach crew _x} forEach _list
exit

CheckTwoEastLeft.sqs looks like:

Code: [Select]
~10
@({alive _x} count e_loons < 2.5)
here put what you want to happen when only 2 east unit are left alive

exit

I have written this from memory so the syntax might need a bit of tweaking

Make the obvious changes if you want it to work for west, resistance or civis


« Last Edit: 18 Sep 2005, 06:13:39 by THobson »

Offline macguba

  • Former Staff
  • ****
    • macguba's operation flashpoint page
Re:Trigger activates when only a couple are still alive
« Reply #5 on: 18 Sep 2005, 02:09:37 »
The 2.5 is a safety and clarity measure as THobson suggested.   It is nothing to do with zombies.
Plenty of reviewed ArmA missions for you to play

Doc Ho

  • Guest
Re:Trigger activates when only a couple are still alive
« Reply #6 on: 18 Sep 2005, 15:51:14 »
Trigger

Area:  whole  map
Activation box:  East present
Condition:   "alive _x" count thislist < 2.5

Not guaranteed.    And it will count a vehicle as 1, I think.

That don't work...it says "type bool expected nothing"

Offline THobson

  • OFPEC Patron
  • Former Staff
  • ****
Re:Trigger activates when only a couple are still alive
« Reply #7 on: 18 Sep 2005, 19:55:26 »
Try playing around with some brackets, so:

({alive _x} count thislist < 2.5)

Offline Triggerhappy

  • Contributing Member
  • **
  • Llama, it's what's for dinner.
Re:Trigger activates when only a couple are still alive
« Reply #8 on: 18 Sep 2005, 23:14:06 »
i would think it should be:
({alive _x} count thislist) < 2.5

because alive _x is the only thing there that could be a boolean when its not looking for a boolean