Casualties Cap (Advanced)

From F2 EN
Jump to: navigation, search

Description

The Casualties Cap (Advanced) component automatically senses the percentage of casualties taken by a group (or several groups), and then executes custom code (written by the mission designer) when that threshold is reached.

Required files

All the code associated with this component is found in:

  • init.sqf
  • f\server\f_casualtiesCapAdv.sqf

How to activate

Open the file init.sqf and look for the code segment entitled:

// F2 - Casualties Cap (Advanced)

Edit the following line, removing the // at the start:

// [[GroupName],100] execVM "f\server\f_casualtiesCapAdv.sqf";

Now see instructions below on how to configure the component.

How to use

Configuring the component

Assuming you have already activated this component (see above), open the file init.sqf and look for the code segment entitled:

// F2 - Casualties Cap (Advanced) 

Edit the folowing line, replacing GroupName with the name of the group you want to monitor. For example, if the group you want to monitor is is called MyGrp1, the line would be:

// [[MyGrp1],100] execVM "f\server\f_casualtiesCapAdv.sqf";

If you want to monitor more than one group, ensure they are separated by a comma, for example:

// [[MyGrp1,MyGrp2],100] execVM "f\server\f_casualtiesCapAdv.sqf";

On the same line, replace 100 with the percentage of casualties the group (or groups) will take in order to trigger the desired custom code. For example, if you want the custom code to be triggered when the group MyGrp1 takes 30% casualties the line would be:

// [[MyGrp1],30] execVM "f\server\f_casualtiesCapAdv.sqf";

Open the file f\server\f_casualtiesCapAdv.sqf and look for the code segment entitled:

// CUSTOM CODE

Replace the following line with your custom code, removing the // at the start:

// Replace me with your custom code (remember to delete the "//" characters).;

Your custom code can be one or more lines. For example, if you wanted to set some variables and trigger another script, your custom code might be:

_myVariableA = 1;
_myVariableB = 0;
[] execVM "anotherScript.sqf";

Rather than forcing a specific ending (like the Casualties Cap component), this component allows the mission designer to accomplish other tasks when the casualties threshold is met – such as setting variables, or triggering other scripts.

Monitoring the ShackTactical Platoons

For the blocks of code containing all the group names for each of the ShackTactical Platoons please see the Casualties Cap component.

Tips

  • This component only runs on the server, not on the clients, which means the mission designer's custom code is only executed on the server.

Credits

  • Xiathorn
  • Headspace
  • Fer