Skip to content

Mark Buildings

Mike-MF edited this page Oct 18, 2023 · 4 revisions

This page will explain the usage of the Mark Buildings function.


/*
 * Author: Mike
 * Creates map markers for building outlines with an optional filter for only objects that inherit from buildings.
 * Function should not be ran at any point after mission start.
 * This is mainly designed around houses and custom structures being marked on the map, if using a layer ensure only buildings or walls are inside it.
 *
 * Call from initServer.sqf on mission start.
 *
 * Arguments:
 * 0: Objects <ARRAY>
 * 1: Filter to only buildings <BOOL> (default: true)
 *
 * Return Value:
 * None
 *
 * Examples:
 * [[MyObject, MyObject2]] call MFUNC(markBuildings);
 * [(getMissionLayerEntities "Test Layer" select 0)] call MFUNC(markBuildings);
*/

This function will not be run mid-mission, ever.

Usage

The mark buildings function will create a map marker that cannot be edited exactly on the position and direction of any buildings you run it for, for all intents and purposes most people will see it as a map object.

The function does have its limits, i.e curved objects will still show as blocks, hence why it's better to only run this function on buildings and walls.

This function should only ever be called from the server.

Usage with Layers

It is significantly easier to run this using layers. (see alternate example, replace the "Test Layer" with whatever you named your layer.), when creating this layer try and ensure only buildings and walls are inside of it, even if using the filter argument it will not filter out many objects as most things inherit from Building (including things like fire barrels)

Deleting the markers

If at any point the markers created would need to be deleted, you can run this on the server to do so. (Note, this is a nuclear option, it will delete ALL markers created by this function.)

{
    private _string = _x select [0, 12];
    if ((toLower _string) isEqualTo "tac_mission_") then {
        deleteMarker _x;
    };
} forEach allMapMarkers;

Example:

[[MyObject, MyObject2]] call MFUNC(markBuildings);

Alternate Example:

[(getMissionLayerEntities "Test Layer" select 0)] call MFUNC(markBuildings);
Clone this wiki locally