Anton Struyk edited this page Apr 6, 2015 · 18 revisions

There are some extra scripts provided to help with some advanced tasks when using Zeus.

Defining Custom Modules

As of 1.6.0 Ares allows mission designers to add custom modules to the Zeus menu that runs whatever code they want in a few lines of code. All they need to do is call a function that takes the module category, module name, and the code block to execute:

["My Category", "My Module", { hint "Hello World!"; }] call Ares_fnc_RegisterCustomModule;

The code block is passed two parameters:

  • An Array: The location that the module was created at when dropped in the world (e.g. [10,10,10])
  • An Object: The object that the module was dropped on (or objNull if it was dropped in empty space)

These parameters can be accessed by calling _this select 0 (for the position) or _this select 1 (for the object under the cursor) in the code block.

An example of how this might be done in the init.sqf file of a mission is:

if (isClass (configFile >> "CfgPatches" >> "Ares")) then
	// Ares is loaded, register the custom module.
	["My Category", "My Module", { hint "Hello World!"; }] call Ares_fnc_RegisterCustomModule;

The registration must happen locally on machines that you want to add the new module on.

Take a look at the scripts directory in the source tree for full shipping examples.

Defining custom reinforcement pools

Two example scripts are provided to illustrate how to define custom unit pools that will be added to Ares. As of 1.1.0 the only way to do this is by modifying the Ares_Reinforcement_Mission_Unit_Pools variable. The values here will be combined with the existing core unit pools and will be available (if the required mod is loaded) through the drop-down menu as normal.

Two examples are provided in the 'extras' folder in the mod download that each add two new unit pools for specific mods:

  • CFB_Skins
  • RHS

To define your own unit pools a minimal definition of a new unit pool that defines single custom vehicle and a single unit would be something like this:

// Prevent stomping on any other existing mission definitions
if (isNil "Ares_Reinforcement_Mission_Unit_Pools") then
	Ares_Reinforcement_Mission_Unit_Pools = [];

Ares_Reinforcement_Mission_Unit_Pools pushBack
		"My Custom Units", // Name of the faction
		west, // The side of the faction
		"My_Mod_CfgPatches_Classname", // The name of the root class for the addon that defines these units (must exist or the side will not show up). Use "" to always show.
		["MyLightTruck"], // Scouts and unarmed light vehicles
		[], // Armed light vehicles
		[], // Dedicated troop trucks
		[], // Armed + Armored Troop Transports
		[], // Unarmed helicopters
		[], // Armed helicopters
		[], // Unarmed boats
		[], // Armed boats
			// Squad setups to load into vehicles. Note - these may get truncated to fit into empty spaces or small vehicles.

This could technically be done any time during the mission, but must be executed locally on the machine running Ares. The example files are intended to be run from the init.sqf like this:

[] execVM "Ares_AddCfbReinforcementPools.sqf";
[] execVM "Ares_AddRhsReinforcementPools.sqf";

See the Reinforcements section for details on reinforcements.

Using the example reinforcement pools

If you just want to use the example reinforcement pools as-is all you need to do is:

  • Copy the Ares_AddRhsReinforcementPools.sqf file (or the file for whichever unit pools you want to add) into the root of your mission directory. This is the same directory that the mission.sqm file is located.
  • Open your init.sqf file for the mission (if none exists you can just create a new text file with that name) and add the following:
[] execVM "Ares_AddRhsReinforcementPools.sqf";

That's it! When you run Ares (with the necessary mod enabled of course) you should have the new units available.

Disabling 'Execute Code' modules

If there is a concern that the ability to execute arbitrary code on the client's machine will be misused (i.e. in a public unmoderated setting), it is possible to disable these modules by defining the following variable in the mission namespace (for example in the init.sqf for the mission):

Ares_Allow_Zeus_To_Execute_Code = false;
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.