mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Wiki - Add documentation for ace_interact_menu_newControllableObject (#6797)
This commit is contained in:
parent
a06086f33c
commit
9d5b936d7c
@ -46,6 +46,7 @@ MenuType: 0 = Interaction, 1 = Self Interaction
|
||||
|----------|---------|---------|---------|---------|---------|
|
||||
|`ace_interactMenuOpened` | [_menuType] | Local | Listen | Interaction Menu Opened
|
||||
|`ace_interactMenuClosed` | [_menuType] | Local | Listen | Interaction Menu Closed
|
||||
|`ace_interact_menu_newControllableObject` | [_typeOf] | Local | Listen | New controlable object, only fires once per type (add self interactions)
|
||||
|
||||
### 2.4 Cargo (`ace_cargo`)
|
||||
|
||||
|
@ -70,7 +70,7 @@ class CAManBase: Man {
|
||||
Two steps, creating an action (array) and then adding it to either a class or object.
|
||||
Important: `ace_common_fnc_canInteractWith` is not automatically checked and needs to be explicitly called.
|
||||
|
||||
### 2.1 fnc_createAction
|
||||
### 3.1 fnc_createAction
|
||||
|
||||
`ace_interact_menu_fnc_createAction`
|
||||
|
||||
@ -91,7 +91,7 @@ Important: `ace_common_fnc_canInteractWith` is not automatically checked and nee
|
||||
*/
|
||||
```
|
||||
|
||||
### 2.2 fnc_addActionToClass
|
||||
### 3.2 fnc_addActionToClass
|
||||
|
||||
`ace_interact_menu_fnc_addActionToClass`
|
||||
|
||||
@ -107,7 +107,7 @@ Important: `ace_common_fnc_canInteractWith` is not automatically checked and nee
|
||||
```
|
||||
By default this function will not use inheritance, so actions will only be added to the specific class.
|
||||
|
||||
### 2.3 fnc_addActionToObject
|
||||
### 3.3 fnc_addActionToObject
|
||||
|
||||
`ace_interact_menu_fnc_addActionToObject`
|
||||
|
||||
@ -121,7 +121,7 @@ By default this function will not use inheritance, so actions will only be added
|
||||
*/
|
||||
```
|
||||
|
||||
### 2.4 fnc_addActionToZeus
|
||||
### 3.4 fnc_addActionToZeus
|
||||
|
||||
`ace_interact_menu_fnc_addActionToZeus`
|
||||
|
||||
@ -133,7 +133,7 @@ By default this function will not use inheritance, so actions will only be added
|
||||
*/
|
||||
```
|
||||
|
||||
### 2.5 Examples
|
||||
### 3.5 Examples
|
||||
|
||||
External:
|
||||
|
||||
@ -177,7 +177,7 @@ _action = ["myMissionEvent1","Mission Event: Play Base Alarm","",_statement,{tru
|
||||
[["ACE_ZeusActions"], _action] call ace_interact_menu_fnc_addActionToZeus;
|
||||
```
|
||||
|
||||
### 2.6 Advanced Example
|
||||
### 3.6 Advanced Example
|
||||
|
||||
This adds an interaction to a unit that allows passing items that the player is carrying.
|
||||
|
||||
@ -221,3 +221,20 @@ _modifierFunc = {
|
||||
_action = ["GiveItems", "?","",_statement,_condition,_insertChildren,[123],"",4,[false, false, false, true, false], _modifierFunc] call ace_interact_menu_fnc_createAction;
|
||||
[q3, 0, ["ACE_MainActions"], _action] call ace_interact_menu_fnc_addActionToObject;
|
||||
```
|
||||
|
||||
### 3.7 Using `ace_interact_menu_newControllableObject` event
|
||||
|
||||
CBA event `ace_interact_menu_newControllableObject` fires only once the first time the player controls a new object (new man, vehicle or controlled UAV)
|
||||
This is the ideal way to add self interaction actions, as adding them via `addActionToClass` will force self interaction actions to be compiled for classes that may never be used.
|
||||
|
||||
```cpp
|
||||
// Example: Add radio self-action to all civilian cars
|
||||
["ace_interact_menu_newControllableObject", {
|
||||
params ["_type"]; // string of the object's classname
|
||||
if (!(_type isKindOf "Car")) exitWith {};
|
||||
if ((getNumber (configFile >> "CfgVehicles" >> _type >> "side")) != 3) exitWith {};
|
||||
|
||||
private _action = ["playRadio","Play Radio","",{playMusic "NeverGonnaGiveYouUp"},{true}] call ace_interact_menu_fnc_createAction;
|
||||
[_type, 1, ["ACE_SelfActions"], _action, true] call ace_interact_menu_fnc_addActionToClass;
|
||||
}] call CBA_fnc_addEventHandler;
|
||||
```
|
||||
|
Loading…
Reference in New Issue
Block a user