Jump to content
DPM

Exclude units from check

Recommended Posts

Can anybody please explain to me how to either exclude "B_crew_F" and  "B_T_Pilot_F", or side west from this check....
 

(({(alive _x)&&(!isPlayer _x)} count allUnits)==0)&&(({alive _x} count allPlayers)==1)

Share this post


Link to post
Share on other sites

Tested, both "B_crew_F" , "B_T_Pilot_F" and west sides are being excluded:

 

(allUnits findIf {alive _x && !(isPlayer _x) && !(typeOf _x in ["B_crew_F", "B_T_Pilot_F"]) && side _x != west}) isEqualTo -1 && (allPlayers findIf {alive _x && !(typeOf _x in ["B_crew_F", "B_T_Pilot_F"]) && side _x != west}) isEqualTo 0

 

Share this post


Link to post
Share on other sites

It crashed the server with this error '/mission/Entities/Item6/Attributes.B_crew_F':"" encountered instead of '='. I tried deleting the units from inside the brackets and it didn't crash, but it didn't have the desired effect I was looking for either.  The check is for a win condition in a BR style coop mission.  (That I didn't make but the author is awol) I'm trying to get it to end when all AI 'players' and all but the last playable unit are dead (it was designed to end when just the AI are dead so if there's more than one player left it still ends the mission). When I run that check and kill all the AI playing the BR part of the game it doesn't end because there are still blufor artillery tanks and vtols alive in the mission, when I kill all AI in the console the win condition works. What I'm trying to do is exclude the blufor units and get the same result.

Share this post


Link to post
Share on other sites

Multiplayer only, one or no last player standing:

Quote

playableUnits findIf {alive _x && isPlayer _x} <= 0

 

Single player only, one or no last player standing:

Quote

switchableUnits findIf {alive _x && isPlayer _x} <= 0

 

No alive units on east and guerilla side (use one side only if you don't need both):

Quote

(allUnits findIf {alive _x && (side _x isEqualTo east || side _x isEqualTo resistance)}) isEqualTo -1

 

Try combine both if you need (with && ofcourse).

Share this post


Link to post
Share on other sites

I sort of got it working by including the blufor units in the unit count, but if arma does it's thing and kills any of them for arma reasons that'll probably break it. playableUnits findIf {alive _x && isPlayer _x} <= 0 seemed to just be ignored, but I'll give it another go tomorrow, been at this for 14 hours....melted. Thanks for the help .

Share this post


Link to post
Share on other sites

Let us know if you succeeded or not. If I can't help you someone else will. Cheers.

Share this post


Link to post
Share on other sites
On 7/24/2019 at 10:11 PM, RCA3 said:

Let us know if you succeeded or not. If I can't help you someone else will. Cheers.

 

Sorry, only saw your reply now. I didn't get  it to work exactly how I wanted it to. Whatever way  I tried to include the pilots and crew into the count it seemed to just ignore them.(though that could totally be down to my lack of coding knowledge).  Eventually I just counted them as a total and included that total in the all units count as less than their number. However while it seems to work, the mission is counting players in the lobby in player slots that aren't actually in the mission and incorporating them into the Kill counter total in the actual mission and that then gives a false number. The win condition still activates when only one player is alive and fails when all players are dead, but it doesn't line up with the kill counter. Ideally, I'd like to do it the most effective and eloquent way, but how  the the mission counts AI and players is intertwined to include AI as part of your team (as it's made to be a 5 player coop with real players or AI squad) and the codes seems to be in a few places with mission specific titles like, allPlayersmy, MyPlayersCount that don't give any applicable information when searching on google for them. I can sort of see how they work (to a degree) but changing them would we beyond my capabilities. I think my alternative option would be to lock all player slots while the mission is running, as being on the right side of the lobby doesn't seem to affect the kill count the way being in a player slot does. However when searching how to do that the best I can come up with is locking class based slots or reserving white listed GUID slots. Is it possible to keep the server open for players to join while the mission is running, but to have the player slots locked, so they have to wait on the right side until it restarts and they open again?

Share this post


Link to post
Share on other sites

Hi, I'd suggest you slowly explain each step you're trying to accomplish because you seem to have too much going on at once.

Tackle one problem at a time (with our help); use paragraphs on your description (not a wall of text) so it's more readable.

allPlayersmy, MyPlayersCount <- these are variables the author designated himself.

Always start from here: https://community.bistudio.com/wiki/Category:Scripting_Commands_Arma_3

As for your question I don't think it's possible.

Share this post


Link to post
Share on other sites
On 8/16/2019 at 11:43 AM, DPM said:

However when searching how to do that the best I can come up with is locking class based slots or reserving white listed GUID slots. Is it possible to keep the server open for players to join while the mission is running, but to have the player slots locked, so they have to wait on the right side until it restarts and they open again? 

 

Not sure it's related to your situation but I just found this:

 

Share this post


Link to post
Share on other sites

For some reason I got this notification but not your last, even with them turned on....

 

Yeah, that's what I'd been seeing, it's more geared towards specific slots. I was just wanting to lock all slots while the mission was running, but keep the ability to join the server lobby (right side) open. I think it might actually be the kill counter itself that has the problem

 

_unit addEventHandler ["killed", "MyPlayersCount = MyPlayersCount -1; plalive = MyPlayersCount; publicVariable 'MyPlayersCount'; if (isPlayer (_this select 1)) then {remoteExec ['addKillCounter',(_this select 1)]}; chatMsg = format ['%1 was killed by %2. Players alive: %3', (name (_this select 0)), (name (_this select 1)), MyPlayersCount]; [(_this select 0),chatMsg] remoteExec ['globalChat'];  remoteExec ['updateUI']; call test_logger;"];

 

updateUI = {
if (EnableCustomHudMode>0) then {
disableSerialization;

_display = uiNamespace getVariable "hudScrDisplay";
_textPlayersAlive = _display displayCtrl 1905;
_textPlayersAlive ctrlSetText format["%1",MyPlayersCount];
//[_textPlayersAlive,"format['%1',MyPlayersCount]" ] remoteExec["ctrlSetText"];

_textKillsCounter = _display displayCtrl 1908;
_textKillsCounter ctrlSetText format["%1",KillsCounter];

 

I think If this was done using normal alternatives to the author's MyPlayersCount it might solve the issue, because somehow what the author has done is counting players in playable slots, that are not actually playing in the mission itself. I believe the variables MyPlayersCount and AllMyPlayers were made because the mission was originally intended to be a coop with an AI team preferably over 5 human coop players....and hosted locally. What I'm trying to do is make it for up to 25 human pvp players on dedicated....and for the most part, it's working. Just this issue and a regular error concerning another author variable "mymortarrs" getting thrown in the rpt to sort out.

 

For example the win condition had to be changed from this first line to the second to get it to work. (which is what I was asking about first)

condition="allPlayersmy = [];  " \n "if (EnableSquad < 1) then { " \n "{   " \n " if (isPlayer _x) then   " \n " {   " \n "  allPlayersmy pushBack _x;   " \n " };   " \n "} forEach playableUnits;  " \n "} " \n "else { " \n "allPlayersmy = units MyTeamSquad; " \n "}; " \n "plalive == count allPlayersmy; " \n "";

 

condition="{sleep 45};(({(alive _x)&&(!isPlayer _x)} count allUnits)<23)&&(({alive _x} count allPlayers)==1);" \n "";

Anyway, thanks for the reply.

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

×