Skip to content

Force Shooting

Mike-MF edited this page Dec 30, 2022 · 3 revisions

This page will explain the usage of the Force Shooting function.


/*
 * Author: Jonpas, Rory, Mike
 * Orders a unit to target an object and begin firing until either the shooter or target is dead or the timer elapses.
 * Firemode types Single (0) and Full auto (1)
 * Set firing timer to 0.1 for full auto
 * Designed ONLY for infantry, using with vehicles will result in undefined behaviour.
 *
 * Arguments:
 * 0: AI Shooter <OBJECT>
 * 1: Target <OBJECT>
 * 2: Firemode <NUMBER> (default: 0)
 * 3: Timer <NUMBER> (default: 10)
 * 4: Time between shots <NUMBER> (default: 1)
 *
 * Return Value:
 * None
 *
 * Example:
 * [shooter, target] call MFUNC(forceShooting)
 * [shooter, target, 20] call MFUNC(forceShooting)
 * [shooter, target, 30, 0.5] call MFUNC(forceShooting)
*/

Usage

This function is designed for INFANTRY ONLY. Usage on vehicles is not supported.

It will force a unit to target an object of your choosing and fire at it in your selected firemode, time between shots can also be specified along with the amount of time the "firing" will go on for.

Called Globally from a trigger or via init.sqf

Example:

[My_Unit, My_Target] call TAC_Mission_fnc_forceShooting;

Example without defaults:

[My_Unit, My_Target, 1, 10, 0.4] call MFUNC(forceShooting);
Clone this wiki locally