Jump to content
Sign in to follow this  
reaply

Force Players to Lobby

Recommended Posts

I am currently deconstructing a mission that has some issues that I'm trying to fix. I am fairly new with the scripting for Arma so please bare with me. In the script, there is an endgame call. But if one player stays in the continue screen players will load into the continue screen because the mission doesn't restart. I'm trying to add on a section to the script that forces players into the lobby after the win screen pops up to avoid this hassle. How would I go about creating the script to force players into the lobby?

Share this post


Link to post
Share on other sites

My train of thought would be to end the mission on all clients using BIS_fnc_endMission. This will then take them to the debriefing screen. This debriefing screen has its own display (a quick look through the config will reveal it), after mission end I would execute this (you will need to find a way of executing this code, as i dont believe there is a way to do that after the mission has ended. Maybe look at the event scripts present in arma):

(for the example I will say that the RscDisplayDebriefing IDD is "_i"

waitUntil {isNull (findDisplay _i)};
(findDisplay _i) closeDisplay 1;

If this is the problem you are facing, I believe this should do the trick. Needs testing though. However, i'm sure there is a more suitable way to do this so that you don't mess with the engine UI flow.

Another way to do it could be to add a mission event handler server-side. You can then call serverCommand and pass the #restart command to restart the mission

_nul = addMissionEventHandler ["Ended",{
  _password = "password1"; // Defined in the server.cfg
  serverCommand [_password,"#restart"];
};

Kind regards,

Bull

Edited by Bull_A

Share this post


Link to post
Share on other sites
I am currently deconstructing a mission that has some issues that I'm trying to fix. I am fairly new with the scripting for Arma so please bare with me. In the script, there is an endgame call. But if one player stays in the continue screen players will load into the continue screen because the mission doesn't restart. I'm trying to add on a section to the script that forces players into the lobby after the win screen pops up to avoid this hassle. How would I go about creating the script to force players into the lobby?

you need to do it serverside...

"END1" call BIS_fnc_endMissionServer;

will end the mission for everyone and restart it after the timeout or start the next one if you have more than one in your maprotation

Share this post


Link to post
Share on other sites
you need to do it serverside...

"END1" call BIS_fnc_endMissionServer;

will end the mission for everyone and restart it after the timeout or start the next one if you have more than one in your maprotation

The problem is that I do have another map in the rotation via:

// MISSIONS CYCLE (see below)
class Missions {
class Mission_01 // name for mission can be anything
{
template = dm28_dm4-complex.stratis; // don't put .pbo
difficulty = "mercenary";
};
class Mission_02
{
template = dm28_dm4-airstation.stratis;
difficulty = "mercenary";
};             // An empty Missions class means there will be no mission rotation

};
missionWhitelist[] = {  //an empty whitelist means there is no restriction on what missions' available
"dm28_dm4-airstation.stratis",
"dm28_dm4-complex.stratis",
};

Another way to do it could be to add a mission event handler server-side. You can then call serverCommand and pass the #restart command to restart the mission

Thank you, I will add it to the script and see the result.

EDIT: The server script works wonderful, thank you! I was a little worried about where to place it, but it was just a matter of tral and error. But without any error :).

EDIT 2: Actually, it still doesn't work. The mission still never ends.

I placed the script in this script (dm_manager.sqf) here located at the bottom:

http://pastebin.com/GsFkhtSA

Edited by reaply

Share this post


Link to post
Share on other sites

Sorry to bump but I just seem to not be able to get it working and I just want to know what I'm doing wrong.

Win system (end mission is at bottom):

http://pastebin.com/4Y6SmE2S

Init.sqf (Line 27):

http://pastebin.com/L7rsAi0U

Server Script:

http://pastebin.com/2C7hN4t7

I am really having a hard time understanding what is wrong and what I need to fix. If someone could please just saying I'm doing something wrong, please tell me.

Edited by reaply

Share this post


Link to post
Share on other sites

I have this same problem on a mission rotation im runnng : (

Share this post


Link to post
Share on other sites

Sorry to bump but I just seem to not be able to get it working and I just want to know what I'm doing wrong.

Win system (end mission is at bottom):

http://pastebin.com/4Y6SmE2S

Init.sqf (Line 27):

http://pastebin.com/L7rsAi0U

Server Script:

http://pastebin.com/2C7hN4t7

I am really having a hard time understanding what is wrong and what I need to fix. If someone could please just saying I'm doing something wrong, please tell me.

 

The event handler code is wrong - USE IT like this.

_nul = addMissionEventHandler ["Ended",
{
   _password = "somepasswordhere"; 
   _password serverCommand "#restart";
}];

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  

×