Jump to content
Sign in to follow this  
Ice_Rhino

Trigger Question - !alive units that did not spawn

Recommended Posts

I have 10 vehicles on the map which the player has to destroy. However, 7 of these 10 are on a 50% Probability of Presence. All targets are named opf_target_1 to opf_target_10. I have placed this code in my trigger

(!alive opf_target_1 AND !alive opf_target_2 AND !alive opf_target_3 AND !alive opf_target_4 AND !alive opf_target_5 AND !alive opf_target_6 AND !alive opf_target_7 AND !alive opf_target_8 AND !alive opf_target_9 AND !alive opf_target_10)

However, when all the units of this get destroyed, the hint I have in place does not display. Just for testing I am using a script that KYL provided linked to a Radio Alpha trigger to ensure they all blow up. The code for that is

{_x setDamage 1} forEach [opf_target_1, opf_target_2, opf_target_3, opf_target_4, opf_target_5, opf_target_6, opf_target_7, opf_target_8, opf_target_9, opf_target_10];

Is it not displaying the hint because some of the units did not spawn hence they are !alive?? they were just not there at all ever?

Thanks

Share this post


Link to post
Share on other sites

I don't know what to tell you I also had problems with the alive command. You can try this

(!(alive opf_target_1)

I used that in a mission before but if all the vehicles were destroyed or deleted by trigger I wouldn't get anything so I had to settle with OR in between to get what I wanted. You're not alone on this problem sorry I couldn't be any help.

Share this post


Link to post
Share on other sites

I appreciate the help anyway. Must be a way around it. I will see if I can get what you suggested working.

Thanks

Share this post


Link to post
Share on other sites

Instead of specific soldiers check for groups or OPFOR in general.

Share this post


Link to post
Share on other sites

Understand what you are saying KYL, my only concern is that it would only take one rogue OPFOR soldier in the area and the OPFOR Not Present trigger would not fire. The target area of this mission is 500 by 500 metres and would be easy to miss one, or even a squad for that matter

I don't mean to be argumentative, that is not the intent

Share this post


Link to post
Share on other sites

That's almost always the case. You get around that by things like:

Trigger condition of:

 {side _x == opfor && alive _x} count allUnits < 3

So once you're down to 2 opfor units left you count it as "done".

Share this post


Link to post
Share on other sites

I don't mean to be awkward here and drag this thread out, but the problem is the armour laid out is 'Empty'. With your suggestion should I make them all OPFOR with no fuel or ammo so they are the equivalent of empty? Plus, how would the trigger distinguish between footsoldiers remaining and armour. I want the play to hunt the armour and destroy them all. Not bothered about the foot soldiers, the player has to deal with them.

Share this post


Link to post
Share on other sites

You wouldn't bother with armor you focus on infantry. Infantry in armor is picked up as 'alive' so there's your 'alive armor' check. If they aren't in the armor it's not alive, even if it's pristine, it's still not going to attack you without infantry in it.

If all you care about is destroying the specific armored vehicles, by all means ignore infantry and test for the vehicles being killed.

{canMove _x && canFire _x} count [tank1, tank2, tank3] == 0

Could also use !alive since you're starting out Empty, canMove and canFire just feels more 'tanky' :)

Share this post


Link to post
Share on other sites

Just place unit 1 till 10 on the map. Then place this in the init.sqf

waitUntil {!(isNull (findDisplay 46))};
MYOPFORUNITS = [opf_target_1, opf_target_2, opf_target_3, opf_target_4, opf_target_5, opf_target_6, opf_target_7, opf_target_8, opf_target_9, opf_target_10];

Then to kill them all:

{_x setDamage 1} foreach MYOPFORUNITS; 

and trigger condition:

{!(alive _x)} count MYOPFORUNITS == 0

Share this post


Link to post
Share on other sites

More is the pity I am at the office today working on VBA code so won't be able to try this till I get home. Although I might get swamp fever around lunchtime and have to shoot off early :) Chance would be a fine thing :)

Thanks KYL & Mind for your continued assistance.

Share this post


Link to post
Share on other sites
You wouldn't bother with armor you focus on infantry. Infantry in armor is picked up as 'alive' so there's your 'alive armor' check. If they aren't in the armor it's not alive, even if it's pristine, it's still not going to attack you without infantry in it.

If all you care about is destroying the specific armored vehicles, by all means ignore infantry and test for the vehicles being killed.

{canMove _x && canFire _x} count [tank1, tank2, tank3] == 0

Could also use !alive since you're starting out Empty, canMove and canFire just feels more 'tanky' :)

Works perfectly thank you

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×