OFPEC Forum
Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: Doc Ho on 17 Sep 2005, 18:08:44
-
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
-
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.
-
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
-
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.
-
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:
_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:
~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
-
The 2.5 is a safety and clarity measure as THobson suggested. It is nothing to do with zombies.
-
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"
-
Try playing around with some brackets, so:
({alive _x} count thislist < 2.5)
-
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