2019-03-14 18:32:09 +00:00
|
|
|
---
|
|
|
|
layout: wiki
|
|
|
|
title: Field Rations Framework
|
2021-10-21 16:27:25 +00:00
|
|
|
description: Explains how to set-up ACE Field Rations.
|
2019-03-14 18:32:09 +00:00
|
|
|
group: framework
|
|
|
|
parent: wiki
|
|
|
|
mod: acex
|
|
|
|
version:
|
|
|
|
major: 3
|
|
|
|
minor: 4
|
|
|
|
patch: 0
|
2021-10-21 16:27:25 +00:00
|
|
|
redirect_from: "/wiki/frameworkx/field-rations-framework.html"
|
2019-03-14 18:32:09 +00:00
|
|
|
---
|
|
|
|
|
|
|
|
## 1. Config Values
|
|
|
|
|
|
|
|
### 1.1 Consumable Items
|
|
|
|
|
|
|
|
Config Name | Type | Description
|
|
|
|
----------- | ---- | -----------
|
|
|
|
`acex_field_rations_thirstQuenched` | Number | Amount of thirst quenched when item is consumed*
|
|
|
|
`acex_field_rations_hungerSatiated` | Number | Amount of hunger satiated when item is consumed*
|
|
|
|
`acex_field_rations_consumeTime` | Number | Time required to consume the item (in seconds)
|
|
|
|
`acex_field_rations_consumeText` | String | Progress bar text (OPTIONAL)
|
|
|
|
`acex_field_rations_consumeAnims` | Array | Animations to play when consuming item** (OPTIONAL)
|
|
|
|
`acex_field_rations_consumeSounds` | Array | Sounds to play when consuming item** (OPTIONAL)
|
|
|
|
`acex_field_rations_replacementItem` | String | Class name of replacement item to add on consumption (OPTIONAL)
|
|
|
|
`acex_field_rations_refillItem` | String | Makes an item refillable, class name of item added when refilled (OPTIONAL)
|
|
|
|
`acex_field_rations_refillAmount` | Number | Amount of water required to refill item (OPTIONAL)
|
|
|
|
`acex_field_rations_refillTime` | Number | Time required to refill item (in seconds) (OPTIONAL)
|
|
|
|
|
|
|
|
|
|
|
|
_* Value range is 0 to 100 and can be modified by the corresponding coefficient setting._
|
|
|
|
|
|
|
|
_** Array is in format: STAND, CROUCH, PRONE. If player is in vehicle, the first element is used._
|
|
|
|
|
|
|
|
### 1.2 Water Sources
|
|
|
|
|
|
|
|
Config Name | Type | Description
|
|
|
|
----------- | ---- | -----------
|
|
|
|
`acex_field_rations_waterSupply` | Number | Amount of water inside the object (-1 - disabled, -10 - infinite) (OPTIONAL)
|
|
|
|
`acex_field_rations_offset` | Array | Refill action offset relative to model (OPTIONAL)
|
|
|
|
|
|
|
|
## 2. Events
|
|
|
|
|
|
|
|
Event Name | Passed Parameter(s) | Locality | Description
|
|
|
|
---------- | ------------------- | -------- | -----------
|
|
|
|
`acex_rationConsumed` | [_player, _consumeItem, _replacementItem, _thirstQuenched, _hungerSatiated] | Local | Item consumed
|
|
|
|
`acex_rationRefilled` | [_source, _player, _item, _refillItem, _refillAmount] | Local | Item refilled
|
|
|
|
|
|
|
|
## 3. Scripting
|
|
|
|
|
|
|
|
### 3.1 Getting water supply
|
|
|
|
|
2021-10-21 16:27:25 +00:00
|
|
|
`ace_field_rations_fnc_getRemainingWater`
|
2019-03-14 18:32:09 +00:00
|
|
|
|
2021-10-31 19:48:47 +00:00
|
|
|
```sqf
|
2019-03-14 18:32:09 +00:00
|
|
|
* Returns the remaining water in a source.
|
|
|
|
*
|
|
|
|
* Arguments:
|
|
|
|
* 0: Water source <OBJECT>
|
|
|
|
*
|
|
|
|
* Return Value:
|
|
|
|
* Remaining water <NUMBER>
|
|
|
|
*
|
|
|
|
* Example:
|
2021-10-21 16:27:25 +00:00
|
|
|
* [_source] call ace_field_rations_fnc_getRemainingWater
|
2019-03-14 18:32:09 +00:00
|
|
|
```
|
|
|
|
|
|
|
|
### 3.2 Setting water supply
|
|
|
|
|
2021-10-21 16:27:25 +00:00
|
|
|
`ace_field_rations_fnc_setRemainingWater`
|
2019-03-14 18:32:09 +00:00
|
|
|
|
2021-10-31 19:48:47 +00:00
|
|
|
```sqf
|
2019-03-14 18:32:09 +00:00
|
|
|
* Sets the remaining water supply for given water source.
|
|
|
|
*
|
|
|
|
* Arguments:
|
|
|
|
* 0: Water source <OBJECT>
|
|
|
|
* 1: Amount (-10 - Infinite, -1 - Disabled) <NUMBER>
|
|
|
|
*
|
|
|
|
* Return Value:
|
|
|
|
* None
|
|
|
|
*
|
|
|
|
* Example:
|
2021-10-21 16:27:25 +00:00
|
|
|
* [_source, 1000] call ace_field_rations_fnc_setRemainingWater
|
2019-03-14 18:32:09 +00:00
|
|
|
```
|
|
|
|
|
|
|
|
### 3.3 Adding a status modifier
|
|
|
|
|
2021-10-21 16:27:25 +00:00
|
|
|
`ace_field_rations_fnc_addStatusModifier`
|
2019-03-14 18:32:09 +00:00
|
|
|
|
2021-10-31 19:48:47 +00:00
|
|
|
```sqf
|
2019-03-14 18:32:09 +00:00
|
|
|
* Adds a status modifier. Should be called on all machines.
|
|
|
|
* Code must return a NUMBER which will be applied additively with other status changes.
|
|
|
|
*
|
|
|
|
* Arguments:
|
|
|
|
* 0: Status to modify (0 - Thirst, 1 - Hunger, 2 - Both) <NUMBER>
|
|
|
|
* 1: Code (is passed the unit <OBJECT>) <CODE>
|
|
|
|
*
|
|
|
|
* Return Value:
|
|
|
|
* None
|
|
|
|
*
|
|
|
|
* Example:
|
2021-10-21 16:27:25 +00:00
|
|
|
* [0, {random 1}] call ace_field_rations_fnc_addStatusModifier
|
2019-03-14 18:32:09 +00:00
|
|
|
```
|