Jump to content

Recommended Posts

Hi guys,

 

I made a lot of missions in ArmA and ArmA 2, but this is my first post on BIS forums.

 

Im making my secong mission for ArmA 3 (the first one was a small test), where you play as partisan sharpshooter and your task is to provide fire support for attacking forces, that are too few to assault a village on their own.

its almost finished but, I would like to use a script, that counts remaining friendly units percentage and, when it gets to 30-20% the mission will fail.

 

I found a tutorial on how to count units, but none that considers percentage counting. Is there any way to achive this, and if, how?

 

PS: Im not a big scripter, so please try to explain with care :)

Share this post


Link to post
Share on other sites

Remaining units of side / all units from one side = percentage of remaining units of one side.

Condition:

{alive _x && {side _x == "side"}} count playableUnits / ("side" countSide playableUnits) < 0.3 // or 0.2 whatever you want
I think that's the right condition. Probably. Don't know . Try it. I'm drunk lol
  • Like 1

Share this post


Link to post
Share on other sites

Seems good, just note that playableUnits doesn't count regular AI and doesn't work in SP at all. Just use allUnits instead.

  • Like 1

Share this post


Link to post
Share on other sites

Hmmm... Does not seem to work for me. Ive tryed alsow replaceing allUnits with WEST and FRIEND, but same error poped up: Condition: countSide: Type String, Expected Side.

 

What is _x ?? is it just name of variable, or what?

 

Im making only SP missions by the way.

Share this post


Link to post
Share on other sites

Try WEST<- without quotation marks, sorry if my post was misleading , shouldn't have put it in quotaion marks. I thought you knew the required data type.

What _x is would exceed the purpose the the thread I think. Try googling for "magic variables arma"

Share this post


Link to post
Share on other sites
null = (west countSide allUnits) spawn {
   waitUntil {(west countSide allUnits) < (0.3 * _this)};
   ["end1",false,true,true,true] spawn BIS_fnc_endMission;
};

Throw that into init.sqf and it should end the mission when about 70% of all bluFor units have been killed.  

 

Note that this will NOT work if you spawn any units during the mission with scripts, as it will not take those units into account properly.

Share this post


Link to post
Share on other sites
null = (west countSide allUnits) spawn {
   waitUntil {(west countSide allUnits) < (0.3 * _this)};
   ["end1",false,true,true,true] spawn BIS_fnc_endMission;
};

That worked thanks! B)

 

The previos condition from donelsarjo still didnt thought. Probably just becouse I was doing something wrong.

 

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

×