OFPEC Forum

Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: GI-YO on 07 Jun 2005, 12:04:00

Title: faster
Post by: GI-YO on 07 Jun 2005, 12:04:00
Hi i'm making an assanation mission, im using this line of code at the moment and it works but it takes about a minute to go off which is way too slow, heres the code (count units gen1 == 0) and (count units gen2 == 0) and (count units gen3 == 0) and (count units gen4 == 0) .

Does anyone know of any script which is faster than this which detects when all the four enemy loons are dead? Thanks in advance

GI-YO
Title: Re:faster
Post by: bedges on 07 Jun 2005, 12:12:20
i would have thought a count is needed only if they're groups?

assuming all four 'gens' are not going to be offed simultaneously, why not set up a variable count? when one of them is killed, add 1 to number_offed. use a trigger to fire if number_offed is equal to 4.

that or modify the condition to read

Code: [Select]
not (alive gen1) and not (alive gen2) and not (alive gen3) and not (alive gen4)
Title: Re:faster
Post by: Franksie86 on 07 Jun 2005, 12:14:09
I think if u use East count units gen1 == 0 it works faster, im not sure tho - I will go test it myself
Title: Re:faster
Post by: Blanco on 07 Jun 2005, 12:15:24
Try :

Code: [Select]
("alive _x" count units gen1 <= 0 && "alive _x" count units gen2 <= 0 && "alive _x" count units gen3 <= 0 && "alive _x" count units gen4 <= 0)
Quote
...four enemy loons


Are these 4 groups or 4 units?
If those are 4 individual units, use bedges method.

Title: Re:faster
Post by: MrN on 07 Jun 2005, 22:18:00
==0 seems to misbehave sometimes.

any of the above should work or:

!alive gen1 && !alive gen2 && !alive gen3 && !alive gen4

No idea which one is quicker though.
Title: Re:faster
Post by: Sui on 08 Jun 2005, 07:31:42
The count command will still count dead units as being alive until the groups leader knows that they're dead. (Think "Oh no, 2 is down).

If the leader is the last one left in the group (as in your situation GI YO), it can takes aaaages before OFP registers the unit as dead using the count command.

If you were counting a group I'd suggest using countside, but in this case (counting four individuals in different groups) you probably want to use the previous not (alive) solutions ;)
Title: Re:faster
Post by: GI-YO on 08 Jun 2005, 12:04:44
Thanks for all the response guys, to clarify the loons are NOT in a group, but they are all in one room (so grouping them might be simpler). I'll re read and test all the different methods provided and post back with the best one. Thanks again

GI-YO