Skip to content

Commit

Permalink
Mission - Add Battlefield Memorial Function (#697)
Browse files Browse the repository at this point in the history
* Add Battlefield Memorial Function

* Disable damage / sim
  • Loading branch information
Mike-MF authored Jun 13, 2024
1 parent e01fa75 commit a1c0216
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 0 deletions.
1 change: 1 addition & 0 deletions addons/mission/XEH_PREP.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ PREP(reinforcements);
PREP(unconscious);

// Extra
PREP(battlefieldMemorial);
PREP(blacklistHeadless);
PREP(bomber);
PREP(carAlarm);
Expand Down
55 changes: 55 additions & 0 deletions addons/mission/functions/fnc_battlefieldMemorial.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
#include "..\script_component.hpp"
/*
* Author: Mike
* Creates a battlefield memorial with chosen helmet and weapon. Redone with global commands as BI didn't bother.
* Position can be an object or a position array (posATL)
* Helmet and Weapon should be classnames as strings.
*
* Call on the server only.
*
* Arguments
* 0: Position <OBJECT / ARRAY>
* 1: Direction <NUMBER>
* 2: Helmet <STRING>
* 3: Weapon <STRING>
*
* Return Value:
* None
*
* Example:
* [] call MFUNC(battlefieldMemorial)
*/

params ["_position", "_direction", "_helmet", "_weapon"];

if (!isServer) exitWith {};

// Handle Object or Array for position.
if (_position isEqualType "OBJECT") then {
_position = getPosATL _position;
};

// Error checking
if (!_helmet isEqualType "STRING") exitWith {
ERROR_MSG_1("Invalid input (%1) expected classname as string.",_helmet)
};
if (!_weapon isEqualType "STRING") exitWith {
ERROR_MSG_1("Invalid input (%1) expected classname as string.",_weapon)
};

private _memorial = createVehicle ["Land_BattlefieldCross_01_NATO_F", _position, [], 0, "CAN_COLLIDE"];
_memorial setDir _direction;

clearItemCargoGlobal _memorial;
clearWeaponCargoGlobal _memorial;

// Disable Actions globally
_memorial setVariable ["bin_battlefieldCross_disableAction", true, true];

// Add Objects
_memorial addItemCargoGlobal [_helmet, 1];
_memorial addWeaponCargoGlobal [_weapon, 1];

// Disable simulation and damage
_memorial enableSimulationGlobal false;
_memorial allowDamage false;

0 comments on commit a1c0216

Please sign in to comment.