Jump to content
tizzo

Cant get Coop Mission to end properly on Dedicated Server

Recommended Posts

Hello everyone!

 

I´ve tried to research for a solution, opened dozens of pbo files and watched hrs and hrs of youtube videos, but i simply need help!!!

 

I like to create small coop missions for our dedicated server. Among a few other problems, I cant figure out, how to make sure, that all clients get their task updates and mission endings at the same time.

 

From what I understand, I have to define global Variables in the init on mission start up.  (<- Here is the first problem for me, not sure how to do it right!)

 

Like this?

 

if (!isServer) exitWith {};

 

missionNameSpace setVariable ["myfirsttask", 0];
publicVariable "myfirsttask";

 

sleep 1;

 

 

Ok, found a nice video on youtube on how to get tasks updated  within a mission. How EXACTLY to get a trigger on firing the publicVariable "myfirsttask" to achieved?

 

inside trigger on activation:

missionNameSpace setVariable ["myfirsttask", 1];    <--- like this ???

 

 

Ok, so now how to i trigger the endmission for everyone at the same time?

 

I know I have to use following: "end1" call BIS_fnc_endMission; but how exactly?

 

Do I set up another trigger with publicVariable "myfirsttask" as condition ???

 

 

In that regard, I have another issue! I like the endtrigger to fire ONLY when all alive players are within the trigger area AND "myfirsttask" is done! Is that even possible, while revive is enabled?

 

({ alive _x } count thislist) == 0;  <-- This should be part of the trigger?!?? Or do i simply go into editor and sync the whole player group with the last trigger?

 

 

Last but not least, even though revival is enabled, how to I end the missions, once all players are down at the same time???

 

 

I´ve seen many videos and tutorials to most of above topics, but most if not all of them, dont account for the mission being run a dedicated server!!!

 

Do I need and initserver.sqf? If yes, does it mean I also need a initplayerlocal.sqf and an init.sqf?  

 

I really really hope to find some help here, thanks for taking the time to read this!!!

 

 

Share this post


Link to post
Share on other sites
2 hours ago, tizzo said:

From what I understand, I have to define global Variables in the init on mission start up.  (<- Here is the first problem for me, not sure how to do it right!)

Like this?

if (!isServer) exitWith {};

missionNameSpace setVariable ["myfirsttask", 0];
publicVariable "myfirsttask";

 

 

 

in initServer.sqf  (this way you don't need to exit for clients)

 

myFirstTask = 0;

publicVariable "myFirstTask";

same as:

missionNameSpace setVariable ["myFirstTask",0,TRUE];

 

2 hours ago, tizzo said:

inside trigger on activation:

missionNameSpace setVariable ["myfirsttask", 1];    <--- like this ???

 

 

If trigger is server only:

missionNameSpace setVariable ["myFirstTask", 1,TRUE];

if not (preferable):
missionNameSpace setVariable ["myFirstTask", 1];
or even:
myFirstTask =1;

 

2 hours ago, tizzo said:

I have another issue! I like the endtrigger to fire ONLY when all alive players are within the trigger area AND "myfirsttask" is done! Is that even possible, while revive is enabled?

 

({ alive _x } count thislist) == 0;  <-- This should be part of the trigger?!?? Or do i simply go into editor and sync the whole player group with the last trigger?

 

Last but not least, even though revival is enabled, how to I end the missions, once all players are down at the same time???

I´ve seen many videos and tutorials to most of above topics, but most if not all of them, dont account for the mission being run a dedicated server!!!

Do I need and initserver.sqf? If yes, does it mean I also need a initplayerlocal.sqf and an init.sqf?  

I really really hope to find some help here, thanks for taking the time to read this!!!

 

 

thisList refers to the preset condition of the trigger (and only preset one). So I guess your trigger is preset by ANY PLAYER PRESENT.

Problem: { alive _x } count thisList) == 0 fires when thisList is empty ( []  because no player is present in the area)

If you want a trigger firing for all players dead or unconscious, don't use the preset condition, the area of trigger... let it NONE NONE, no area needed and write the condition:
 

allPlayers isNotEqualTo [] && ({!alive _x or lifeState _x == "incapacitated"} count allPlayers == count allPlayers)

 

 

 

 

 

  • Like 1

Share this post


Link to post
Share on other sites

Hi pierremgi, than you so much for your answer!!!

 

Very curious to try it out!!

 

Regarding the last point / allPlayers isNotEqualTo [] && ({!alive _x or lifeState _x == "incapacitated"} count allPlayers == count allPlayers) / can I set myFirstTask =1; as condition?

 

 

Share this post


Link to post
Share on other sites

hello again,

 

so the trigger with allPlayers isNotEqualTo [] && ({!alive _x or lifeState _x == "incapacitated"} count allPlayers == count allPlayers) didn´t do anything. Not in the editor and nor on the dedicated server.

 

i did leave the trigger at none, none, but it seems that it needs some kind of activation.

 

any ideas please???

 

Share this post


Link to post
Share on other sites
4 hours ago, tizzo said:

Regarding the last point / allPlayers isNotEqualTo [] && ({!alive _x or lifeState _x == "incapacitated"} count allPlayers == count allPlayers) / can I set myFirstTask =1; as condition?

 

33 minutes ago, tizzo said:

so the trigger with allPlayers isNotEqualTo [] && ({!alive _x or lifeState _x == "incapacitated"} count allPlayers == count allPlayers) didn´t do anything. Not in the editor and nor on the dedicated server.

i did leave the trigger at none, none, but it seems that it needs some kind of activation.

any ideas please???

 

Yes you can add any condition you want:

allPlayers isNotEqualTo [] && ({!alive _x or lifeState _x == "incapacitated"} count allPlayers == count allPlayers) && myFirstTask == 1

 

This condition works for all players dead (or dead-respawn, state before respawning) or unconscious (that means the revive system is set). I can't say what you're doing with that, and how are you testing!

Remember ALL players must be unable to play. Test with something easy to check: in on activation field: player setPos [0,0,0]   (or equivalent)

Share this post


Link to post
Share on other sites

Just realizing a misunderstanding. The above code requires all players to be unable to play. THIS is actually a Loose condition, which is actually also important for my mission. This i can test only tomorrow with  some mates.

 

What I´m currently trying to achieve is winning the mission. Since my tasks are chained, I dont even need to set a condition, except following:

 

All alive players have to be within the trigger area! Only then, the trigger is to fire either

 

"end1" call BIS_fnc_endMission;

 

or

 

["MissionCompleted",true,true,true,true]call BIS_fnc_endMission;

 

 

how to i do this??

 

type: none??

activation: blufor

 

condition:

allPlayers isEqualTo [] && ({alive _x} count allPlayers == count allPlayers)  ?????

 

 

^ i just made that up...

 

Share this post


Link to post
Share on other sites

So set an area for the trigger,

(none none is ok)

({alive _x && lifeState _x != "incapacitated" && _x inArea thisTrigger} count allPlayers == count allPlayers) && myFirstTask == 1

Share this post


Link to post
Share on other sites

it says: condition missing )  

 

cant figure out where to put it, sorry for stressing your helpfulness...

 

Share this post


Link to post
Share on other sites
2 hours ago, tizzo said:

it says: condition missing )  

cant figure out where to put it, sorry for stressing your helpfulness...

Erf, just because there is a f..king hidden character inside this stupid editor.

Corrected above.

Always copy/paste here in the editor, place the lines in editor code:  <> , and watch for red dot(s) inside code. Remove them.
 

Share this post


Link to post
Share on other sites

ha, i got lucky, found an old post from 6 years ago, where pierremgi pointed out a piece of code, which works fine!

 

if (!isNil "groupName") then { ({group _x == groupName} count thislist) == count units groupName }

 

here is the link:

 

 

@pierremgi thank you sooo sooo much for help and input!!!!!!!!!

Share this post


Link to post
Share on other sites
2 minutes ago, tizzo said:

ha, i got lucky, found an old post from 6 years ago, where pierremgi pointed out a piece of code, which works fine!

 

if (!isNil "groupName") then { ({group _x == groupName} count thislist) == count units groupName }

 

here is the link:

 

 

@pierremgi thank you sooo sooo much for help and input!!!!!!!!!

 

Follow my post above. The code is corrected. You don't understand what you're doing with this new condition.

Share this post


Link to post
Share on other sites

i´ve seen your post above, after i did released my last post. i will give that a go!!!!

 

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

×