Skip to content

Public Functions

Hypoxic edited this page Nov 28, 2026 · 1 revision

Public Functions

These are the mission-maker APIs exported as PREP_PUBLIC in addons/modules/XEH_PREP.hpp. Call them from SQF with an argument array:

[_vehicle, 0.25] call meh_modules_fnc_vehicleRefuel_refuel;

Modules Enhanced and CBA_A3 must be loaded. Server only means call the function on the server (for example, in initServer.sqf); it does not automatically forward client calls. Any machine means the function sends the operation to the object's owner. A returned script handle can be stopped with terminate _handle; scriptNull indicates a rejected call. Optional arguments must be supplied in order; use the listed defaults when skipping earlier arguments.

Ambient artillery

meh_modules_fnc_ambientArtilleryVirtual_callArtillery

[positionATL, ammoClass] — server only. Fires one virtual artillery round at an ATL position. ammoClass defaults to "Sh_82mm_AMOS" and must exist in CfgAmmo. Returns the projectile, or objNull for invalid input or an off-server call.

private _round = [getPosATL targetLogic, "Sh_82mm_AMOS"] call meh_modules_fnc_ambientArtilleryVirtual_callArtillery;

meh_modules_fnc_ambientArtilleryVirtual_startArtillery

[area, ammoClass, salvoSize, salvoInterval, salvoVariation, shotInterval, shotVariation, lifetimeObject] — server only. Repeatedly fires salvos at random positions in area. Defaults after area: "Sh_82mm_AMOS", 6, 10, 5, 1, 1, objNull. Intervals and variations are in seconds; salvoSize must be at least 1. Returns a script handle or scriptNull for invalid input. Stop it with terminate, or pass a lifetimeObject to stop when that object is no longer alive. With no lifetime object it continues until terminated.

private _area = [getPosATL artilleryLogic, 200, 200, 0, false, -1];
private _handle = [_area, "Sh_82mm_AMOS", 4, 20, 5, 1, 0, artilleryLogic]
    call meh_modules_fnc_ambientArtilleryVirtual_startArtillery;

Anti-Troll

meh_modules_fnc_antiTroll_punish

[unit, punishmentType] — server only. Applies a punishment and sends the target player the punishment message. Types: 0 kill, 1 prison (not implemented; only the message is sent), 2 lightning, 3 throw, 4 launch. Invalid inputs and off-server calls do nothing. Returns nothing.

[playerToPunish, 2] call meh_modules_fnc_antiTroll_punish;

Map locations

meh_modules_fnc_createMapLocation_createLocation

[area, name, locationType, importance] — call where the location should be created. area is [centerPositionASL, radiusX, radiusY, direction, isRectangle]; locationType defaults to "NameLocal", importance to 0. Returns the created Location, or locationNull if the area has fewer than five elements. A location made on one machine is not automatically made on others.

private _location = [[getPosASL townLogic, 150, 100, 0, false], "Camp", "NameLocal", 1]
    call meh_modules_fnc_createMapLocation_createLocation;

meh_modules_fnc_clearMapLocationNames_clearLocations

[locations] — call on each client whose map should change. Temporarily sets the supplied Location values' types to "Invisible". Returns an array of [location, originalType] pairs; retain it for restoration.

meh_modules_fnc_clearMapLocationNames_restoreLocations

[savedLocations] — call on the same machine that hid the locations. Restores the types from clearMapLocationNames_clearLocations; returns nothing.

private _saved = [[nearestLocation [player, "NameCity"]]]
    call meh_modules_fnc_clearMapLocationNames_clearLocations;
// Later, on this same client:
[_saved] call meh_modules_fnc_clearMapLocationNames_restoreLocations;

Datalink and respawn

meh_modules_fnc_createRemoteTarget_reportTarget

[target, side, durationSeconds] — server only. Reports an object as a remote target to a side, including clients who join later. Duration defaults to 900 seconds. A null target, sideUnknown, or a negative duration does nothing. Returns nothing.

[enemyVehicle, west, 120] call meh_modules_fnc_createRemoteTarget_reportTarget;

meh_modules_fnc_deleteRespawnPosition_delete

[respawnModuleOrModules] — server only. Accepts one ModuleRespawnPosition_F object or an array of them. Removes positions registered by those vanilla modules and deletes the corresponding modules when their respawn data is present. Other objects are ignored; returns nothing.

[[respawnModuleA, respawnModuleB]] call meh_modules_fnc_deleteRespawnPosition_delete;

Flares and lightning

meh_modules_fnc_effectFlareLauncher_startLaunching

[origin, flareClasses, cycleClasses, randomClass, minDeployHeight, maxDeployHeight, launchInterval, launchRandomness, launchDispersion, lifetimeObject] — server only. origin is an object or an ATL position; flareClasses is a nonempty array of ammo class names. Defaults after these two arguments: false, false, 100, 250, 30, 0.1, 30, objNull. Height is in meters, interval in seconds, dispersion in degrees. cycleClasses cycles through the array; randomClass picks randomly (and takes precedence when both are true). Returns a script handle or scriptNull for invalid input. The loop stops when the origin object or optional lifetime object dies, or when its handle is terminated.

private _handle = [flareLogic, ["F_40mm_White"], false, false, 100, 250, 30]
    call meh_modules_fnc_effectFlareLauncher_startLaunching;

meh_modules_fnc_lightningStorm_strike

[positionATL, damageRadius] — server only. Makes one lightning strike and damages nearby objects and terrain objects within damageRadius meters (default 15). Returns the lightning-bolt object, or objNull for invalid input or an off-server call.

[getPosATL stormLogic, 20] call meh_modules_fnc_lightningStorm_strike;

meh_modules_fnc_lightningStorm_startStorm

[area, secondsBetweenStrikes, randomness, damageRadius, lifetimeObject] — server only. Defaults after area: 5, 1, 15, objNull. Creates repeated strikes at random positions in the area. The interval can vary by up to randomness of the interval; the storm occasionally produces two or three strikes at once. Returns a script handle or scriptNull for invalid input. Terminate the handle to stop, or supply a lifetime object.

private _area = [getPosATL stormLogic, 300, 300, 0, false, -1];
private _handle = [_area, 5, 0.5, 15, stormLogic]
    call meh_modules_fnc_lightningStorm_startStorm;

Healing and inventory

meh_modules_fnc_healingArea_startHealing

[area, amountPerTick, lifetimeObject] — server only. Heals infantry in the area once per second, applying amountPerTick to hit-point damage (not ACE Medical). Defaults: amountPerTick = 0, lifetimeObject = objNull. Returns a script handle or scriptNull for invalid input. Terminate the handle or pass a lifetime object to stop the loop.

private _area = [getPosATL hospitalLogic, 25, 25, 0, false, -1];
private _handle = [_area, 0.1, hospitalLogic]
    call meh_modules_fnc_healingArea_startHealing;

meh_modules_fnc_inventorySync_addInventory

[container, identifier, addContents] — server only. Registers a globally existing cargo container with an Inventory Sync identifier. addContents defaults to false (replace its cargo with saved inventory); true merges its current cargo first. Returns true if registered, false for an off-server call, invalid arguments, or an already registered container. Do not pass a locally created object. See Inventory Sync for the full setup.

[_crate, "myIdentifier", true] call meh_modules_fnc_inventorySync_addInventory;

Speed and fuel consumption

meh_modules_fnc_speedLimiter_setSpeed

[vehicleOrVehicles, speed, affectPlayers, affectAI] — server only. Accepts one vehicle or an array. Defaults: speed = 0, affectPlayers = true, affectAI = true. Sets player cruise control and/or AI speed limits; 0 removes the limit. Player cruise control is broadcast to joining clients. Invalid speed or both flags false does nothing; returns nothing.

[[truckA, truckB], 40, true, true] call meh_modules_fnc_speedLimiter_setSpeed;

meh_modules_fnc_vehicleFuelCoef_setCoef

[vehicle, coefficient] — any machine. Sends the fuel-consumption coefficient to the vehicle's owner. Defaults to 1; a negative coefficient or null vehicle does nothing. Returns nothing.

[truckA, 0.5] call meh_modules_fnc_vehicleFuelCoef_setCoef;

Vehicle service

The one-shot functions can be called from any machine; they dispatch to the vehicle's owner. They return nothing and ignore a null vehicle:

Function Arguments Effect
meh_modules_fnc_vehicleRearm_rearm [vehicle] Fully rearms the vehicle.
meh_modules_fnc_vehicleRefuel_refuel [vehicle, fractionToAdd] (default 1) Adds a fraction of fuel, capped at full; nonpositive amounts do nothing.
meh_modules_fnc_vehicleRepair_repair [vehicle, fractionToRepair] (default 1) Repairs vehicle hit points by a fraction; nonpositive amounts do nothing.
[truckA] call meh_modules_fnc_vehicleRearm_rearm;
[truckA, 0.25] call meh_modules_fnc_vehicleRefuel_refuel;
[truckA, 0.5] call meh_modules_fnc_vehicleRepair_repair;

The repeating functions are server only. All accept one vehicle or an array of vehicles, return a script handle (scriptNull when called off-server or given no valid vehicles), and can be stopped with terminate _handle or an optional lifetimeObject that is no longer alive. They also stop once no vehicles are alive. Each vehicle's service count is kept on the vehicle, so restarting a function does not reset its count. A runImmediately call performs one service immediately and records one use; otherwise the first service occurs after the interval. Counts below 1 are treated as 1 and negative intervals as 0 (with at least 0.1 seconds between loop passes).

Function Arguments and defaults after vehicleOrVehicles
meh_modules_fnc_vehicleRearm_startRearming [vehicleOrVehicles, intervalSeconds = 300, rearmCount = 1, runImmediately = false, lifetimeObject = objNull]
meh_modules_fnc_vehicleRefuel_startRefueling [vehicleOrVehicles, intervalSeconds = 300, refuelCount = 1, fractionPerTick = 1, runImmediately = false, lifetimeObject = objNull]
meh_modules_fnc_vehicleRepair_startRepairing [vehicleOrVehicles, intervalSeconds = 300, repairCount = 1, fractionPerTick = 1, runImmediately = false, lifetimeObject = objNull]
private _rearm = [[truckA, truckB], 300, 3, true]
    call meh_modules_fnc_vehicleRearm_startRearming;
private _refuel = [truckA, 60, 5, 0.2, true]
    call meh_modules_fnc_vehicleRefuel_startRefueling;
private _repair = [truckA, 60, 5, 0.25, true]
    call meh_modules_fnc_vehicleRepair_startRepairing;

// Later, on the server:
terminate _refuel;

Area argument

Artillery, lightning storms, and healing use an ATL area in the form [centerATL, radiusX, radiusY, direction, isRectangle, height]. direction is degrees; isRectangle is a boolean. Supply all six elements even if height is unused for your setup. The map-location creator instead expects a five-element area with an ASL center, as described above.

Clone this wiki locally