Jump to content
Sign in to follow this  
rekrul

End trigger when all playableUnits are dead

Recommended Posts

I'm trying to make an End trigger that kicks in when there are no more playableUnits alive, but when I enter this into the Condition Field, it gives me a blank error message:

((isServer) and ({!alive} forEach playableUnits))

I guess that's because !alive is a check and not a command (?) but what should I enter into the Cond. field?

Also, I guess if all are in agonized state (or dead) it should end as well, but I'm guess that's way too complex for me.

Share this post


Link to post
Share on other sites

{alive _x} count playableUnits == 0

If that is the trigger by which you end the mission. Through endMission or similar then you don't want the server check since endMission is local.

Oh and add a timeout if you do it that way so it doesn't end immediately.

Share this post


Link to post
Share on other sites

Thanks, but when I test this in the editor, it ends immediately. Is that because they're not counted as playable units in the editor? They're set to playable though...

Edit: Shouldn't there be a forEach in there somewhere, otherwise _x isn't defined...

Share this post


Link to post
Share on other sites

That's why I suggested setting the time out values. Another way instead would be:

{!alive _x} count playableUnits == count playableUnits

Edit: Shouldn't there be a forEach in there somewhere, otherwise _x isn't defined...

Nope. Read the BIKI: http://community.bistudio.com/wiki/count

Share this post


Link to post
Share on other sites

I have a timeout of 15 on min, mid and max but both of your suggestions fires the trigger (in the editor at least).

I changed it to

count [{alive _x} foreach playableUnits] == 0 

so now it doesn't fires, but I don't know if it actually works.

Share this post


Link to post
Share on other sites

count [{alive _x} foreach playableUnits] == 0

Will not work because forEach does not create an array. Even if it did it would be no different from my first post:

{alive _x} count playableUnits == 0

playableUnits only work in multiplayer that's why it triggers. Read description and comments on http://community.bistudio.com/wiki/playableUnits.

So in the editor playableUnits = [] is an empty array which has 0 elements thus it always triggered.

Scripting in Arma can be interesting in the most annoying ways :)

Share this post


Link to post
Share on other sites

Aha! :) Ok, I'll try to export it then, thanks for your help!

Share this post


Link to post
Share on other sites

Well it worked, so as soon as I'm a seagull/crow, the mission ends but there's no debriefing. The trigger is End #2 and this is my briefing.html. It works with End #1.

<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1250">

<title>Title</title>
</head>

<body bgcolor="#FFFFFF">
<! -----DEBRIEFING----->
<hr>
<br>
<h2><a name="Debriefing:End1">Bastam is under US control!</a></h2>
<br>
<p>
<! ------victory------>
Well done! The airport siege was just a decoy to ambush US troops in Bastam. Although casualties were high and a lot of extra resources were deployed to the area, we managed to kill or capture the Takis that were controlling Bastam and re-take control in the area. CivAid should start up again soon and the area surrounding the airport will be heavily patrolled.
</p>
<br>

<hr>
<br>
<h2><a name="Debriefing:End2">Bastam is lost to the Takis</a></h2>
<br>
<p>
<! ------KIA------>
Takis used the airport siege as a decoy to ambush US troops in Bastam. Not only did they maintain control of the area but they served a major blow to our operation. Casualties are huge despite all the resources we pushed into the area. This is unacceptable and they now have a major stronghold in the north. Retaking control will take time and costs lives.
</p>
<br>

<! -----DEBRIEFING END----->

</body>
</html> 

Share this post


Link to post
Share on other sites

Does anyone know why end2 isn't working or can point me to somewhere where I can read up on this? I just re-wrote the text from an example and didn't do anything with the html-tags.

Share this post


Link to post
Share on other sites

Probably a little late on this, but for future reference...Did you name the End#2 trigger End2 like it is in the debrief?

<h2><a name="Debriefing:End2">Bastam is lost to the Takis</a></h2>

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  

×