Skip to content

Multiplayer Ending Controller

shadow-fa edited this page Jan 28, 2018 · 3 revisions
File location f\mpEnd
Enabled by default? N/A
Enable/Disable in N/A
Runs on Server

The Multiplayer Ending Controller provides a locality-safe method of nicely ending multiplayer missions. It runs the ending on all client's computers, and lets you run custom code based on ending type if needed.

Usage

To end a mission using the Multiplayer Ending Controller, use the function f_fnc_mpEnd. This function takes two arguments; an ending number corresponding to an ending in description.ext, and a true/false flag for whether the ending should be a success or a failure. For example:

[1] call f_fnc_mpEnd;       // End the mission as a success using ending 1
[3,false] call f_fnc_mpEnd; // End the mission as a failure using ending 3

f_fnc_mpEnd will only run on the server. This means that you can put it in a trigger without locality protection without any issues. However, if you are calling it from a script, make sure that that script runs on the server or uses remoteExec.

Changing Debriefing Text

The text that shows up in the debriefing screen can be changed in description.ext. By default, F3 has six ending templates that can be customized to fit your needs under CfgDebriefings. A customized mission success ending might look like this:

class End1
{
  title = "MISSION SUCCESS";
  subtitle = "All enemies defeated";
  description = "We did it!";
  // pictureBackground = "";
  // picture = "";
  // pictureColor[] = {0.0,0.3,0.6,1};
};

Because this is End1, this ending would play if f_fnc_mpEnd was called the parameter [1] (ie. [1] call f_fnc_mpEnd). Multiple possible endings can be created by customizing End1, End2, etc.

Calling Custom Code On Ending

Custom code can be added to endings by editing f/mpEnd/fc_mpEndReciever.sqf. For example, the following code will make the player fly up into the air if ending #1 is called:

switch (_ending) do
{
  // Ending #1
  case 1:
  {
    // Place any custom code for ending #1 after this line:

    player setVelocity [0,0,100];

    // Do not allow custom code for ending #1 to continue after this comment.
  };
  ...
};
Clone this wiki locally