OFPEC Forum
Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: Kaio23 on 28 Apr 2005, 20:54:57
-
This condition isn't working correctly:
"!Alive _x" count thislist >= 0.5 *Count thislist
Any ideas? It activates when all the enemies are dead.
And yes, I have the trigger set to "East Present"
-
thislist only contains the living unit in the trigger area. So the only time your condition can be true is when the list is empty.
To do what you want you would need to have a list of all those that were in the area at the start and then check thislist of your trigger against 50% of the list that was originally there.
-
:o
So I need to name all my units and put them into a notepad file in my mission directory?
-
I didn't say that.
Say you want to do this for all of the east units in your mission. Create a large trigger to cover them all set it to east present and in the activation field put
AllEast = + thislist
You have now created an array of all the east units at the start of the mission (neglect to put in the + sign and this list will constantly update as units die, with the + sign it is frozen for the duration of the mission.)
Then in the trigger you refer to above have the condition
({alive _x} count thislist) < 0.5* (count AllEast)
I have not tested this and when I want to do things like this I use scripts, but the above should give you some idea of the sort of thing to do.
NB:
If it works - do an experiment. Take out the + in + thislist, and I predict it will stop working.
-
That did it, thanks :)
-
WTH? +? How'd you know that?
:beat: *Gets Shot* :beat:
-
From comref:
Array assignment
Description:
Assignment used on arrays assigns only pointer to the same array to the target variable. When b is an array, after executing a = b both a and b represent the same array. When b is changed, a is changed as well. One particular situation that can lead to this behaviour is aList = list sensor_name. You can force creating a copy of array by using unary operator +Array
So without the + AllEast will just be a pointer to the list belonging to the trigger. With the + a whole new copy is made and AllEast points to that.
Ta da!
-
A classic example of why you must read the comref from cover to cover more than once.