2017-10-26 16:22:31 +00:00
---
layout: wiki
title: Fortify Framework
description: Explains how to set-up the Fortify component.
group: framework
order: 6
parent: wiki
mod: acex
version:
major: 3
minor: 3
patch: 0
2021-10-21 16:27:25 +00:00
redirect_from: "/wiki/frameworkx/fortify-framework.html"
2017-10-26 16:22:31 +00:00
---
## 1. Overview
The Fortify framework allows server admins or mission makers to give players the ability to place fortifications through self-interaction, using the `Fortify Tool` .
### 1.1 Chat commands
If the Fortify module is present in the mission, server admins can use chat commands to set-up or change the different parameters. Useful to give players additional resources based on progress on the mission for example.
- `#ace-fortify on` turns fortify mode on
- `#ace-fortify off` turns fortify mode off
- `#ace-fortify west small 500` registers the "small" preset for the west side with a budget of 500
- `#ace-fortify west medium` registers the "medium" preset for the west side with no budget
- `#ace-fortify o big` registers the "big" preset for the east side with no budget
## 1.2 Adding custom presets
2022-12-03 01:08:00 +00:00
There are three ways of adding custom presets to your mission, either via code, through desciption.ext or through config.
2017-10-26 16:22:31 +00:00
2021-10-21 16:27:25 +00:00
To add a preset via code you use the function `call ace_fortify_fnc_registerObjects` . Also enables Fortify.
2017-10-26 16:22:31 +00:00
2021-10-31 19:48:47 +00:00
```sqf
2017-10-26 16:22:31 +00:00
* Registers the given objects in the given side's player interaction menu.
* Players on that side must have the `Fortify Tool` item in their inventory to access the menu.
2023-03-19 00:23:20 +00:00
* Classnames must be in the format [< classname > , < cost > , < category ( optional ) > ]
2017-10-26 16:22:31 +00:00
* MUST BE CALLED ON SERVER!
*
* Arguments:
* 0: Side < SIDE >
* 1: Budget < NUMBER >
* 2: Object Classnames < ARRAY >
*
* Return Value:
* None
*
* Example:
2021-10-21 16:27:25 +00:00
* [west, 5000, [["Land_BagFence_Long_F", 5], ["Land_BagBunker_Small_F", 50]]] call ace_fortify_fnc_registerObjects
2023-03-19 00:23:20 +00:00
* [west, 5000, [["Land_BagFence_Long_F", 5, "tan"], ["Land_BagFence_01_long_green_F", 5, "green"]]] call ace_fortify_fnc_registerObjects
2017-10-26 16:22:31 +00:00
```
2022-12-03 01:08:00 +00:00
Adding it through `description.ext` or config you use:
2017-10-26 16:22:31 +00:00
2019-08-28 14:30:53 +00:00
```cpp
2017-10-26 16:22:31 +00:00
class ACEX_Fortify_Presets {
2022-12-03 01:08:00 +00:00
class TAG_MyPreset {
2020-06-30 14:32:52 +00:00
displayName = "My Preset";
2017-10-26 16:22:31 +00:00
objects[] = {
{"Sandbag", 5},
{"Bunker", 50}
};
};
2023-03-19 00:23:20 +00:00
class TAG_categories {
displayName = "My Categories";
objects[] = {
{"Sandbag", 5, "A Category"},
{"Bunker", 50, "TAG_MyPreset"} // will use the localized displayName of that preset ("My Preset")
};
};
2020-06-30 14:32:52 +00:00
};
2017-10-26 16:22:31 +00:00
```
2022-12-03 01:08:00 +00:00
Then you will have to set the mission preset to `TAG_MyPreset` by either using the Fortify editor module or the chat command: `#ace-fortify blufor TAG_MyPreset` .
2022-09-04 21:38:53 +00:00
2018-08-09 16:01:35 +00:00
## 1.3 Adding custom deploy handlers
A custom deploy handler allows missions makers to decide if an object can be placed or not.
2019-08-28 14:30:53 +00:00
To verify that an object isn't above a certain terrain height we can check the height of the object before it is confirmed as placed. Returning `false` from the code block means that placement is not allowed.
2018-08-09 16:01:35 +00:00
2021-10-31 19:48:47 +00:00
```sqf
2018-08-09 16:01:35 +00:00
[{
params ["_unit", "_object", "_cost"];
private _return = (getPosATL _object) select 2 < 1 ;
_return
2021-10-21 16:27:25 +00:00
}] call ace_fortify_fnc_addDeployHandler;
2018-08-09 16:01:35 +00:00
```
2022-09-04 21:38:53 +00:00
## 1.4 Updating budget
The Fortify budget can be updated for any side using the function.
```sqf
* Updates the given sides budget.
*
* Arguments:
* 0: Side < SIDE >
* 1: Change < NUMBER > (default: 0)
* 2: Display hint < BOOL > (default: true)
*
* Return Value:
* None
*
* Example:
* [west, -250, false] call ace_fortify_fnc_updateBudget
```
2018-02-18 01:33:08 +00:00
## 2. Events
### 2.1 Listenable
Event Name | Passed Parameter(s) | Locality | Description
---------- | ----------- | ------------------- | --------
2024-03-19 07:57:09 +00:00
`acex_fortify_objectPlaced` | [player, side, objectPlaced] | Global | Fortify object placed
`acex_fortify_objectDeleted` | [player, side, objectDeleted] | Global | Fortify object deleted
2018-08-09 16:01:35 +00:00
`acex_fortify_onDeployStart` | [player, object, cost] | Local | Player starts placing object
2024-03-19 07:57:09 +00:00
`ace_fortify_deployFinished` | [[player, side, configName, posASL, vectorDir, vectorUp, cost], elapsedTime, totalTime, errorCode] | Local | Player successfully finishes building object
`ace_fortify_deployCanceled` | [[player, side, configName, posASL, vectorDir, vectorUp, cost], elapsedTime, totalTime, errorCode] | Local | Player cancels building object