Construction Interface – Arma 2

From Bohemia Interactive Community
Jump to navigation Jump to search
m (Text replacement - "<code>" to "<code style="display: block">")
m (Some wiki formatting)
 
Line 1: Line 1:
{{GameCategory|arma2|Editor Modules}}
{{TOC|side}}
'''Construction Interface (CoIn)''' is universal system for base construction primarily made for Warfare 2.


'''Construction Interface (CoIn)''' is universal system for base construction primarily made for Warfare 2.
== Initialisation ==


== Initialization==
=== Paths ===
=== Paths ===
Editor:
Editor:
  Modules (F7) > Construction Interface
  Modules (F7) > Construction Interface
Data:
Data:
  ca\modules\coin
  ca\modules\coin


=== Startup ===
=== Startup ===
Place CoIn module manager where you want to have base center (you can change this position dynamically during the game). You can place as many construction sites as you want.
Place CoIn module manager where you want to have base center (you can change this position dynamically during the game). You can place as many construction sites as you want.


Line 16: Line 19:




=== Using synchronization (F5) ===
=== Using synchronisation (F5) ===
Units with access to given construction site can now be defined using synchronization (F5) and [[synchronizeObjectsAdd]] command.


=== Optional parameters ===
Units with access to given construction site can now be defined using synchronisation {{Controls|F5}} and [[synchronizeObjectsAdd]] command.
==== Set variables to BIS_coin_# with desired values ====


*'''BIS_COIN_name = <string>;''' - Name of construction (displayed in action menu and GUI)
=== Optional Parameters ===
::Example: ''BIS_coin_0 setvariable ["BIS_COIN_name","Base"];''
::Default value:  "" (no name)


*'''BIS_COIN_rules = <array> or <side>;''' - Rules which defines which units have access to construction. Can be either list of specific units or whole side.
==== Set Variables to BIS_coin_# with Desired Values ====
::Example: ''BIS_coin_0 setvariable ["BIS_COIN_rules",[west,guer_commander]];''
* '''BIS_COIN_name = <string>;''' - Name of construction (displayed in action menu and GUI)
::Default value: []
:: Example: <sqf inline>BIS_coin_0 setVariable ["BIS_COIN_name", "Base"];</sqf>
:: Default value: <sqf inline>""</sqf> (no name)


*'''BIS_COIN_categories = <array>;''' - List of categories
* '''BIS_COIN_rules = <array> or <side>;''' - Rules which defines which units have access to construction. Can be either list of specific units or whole side.
::Example: ''BIS_coin_0 setvariable ["BIS_COIN_categories",["Base","Defence"]];''
:: Example: <sqf inline>BIS_coin_0 setVariable ["BIS_COIN_rules", [west, guer_commander]];</sqf>
::Default value: []
:: Default value: <sqf inline>[]</sqf>


*'''BIS_COIN_items = <array>;''' - List of items to buy. Preview class (green transparent building) have to be named ''buildingclass_preview''.<br>
* '''BIS_COIN_categories = <array>;''' - List of categories
Array cointains building class, it' price in array (first element is funds' ID - see below, second is actual price; if only price is set, funds' ID will be 0) and display name
:: Example: <sqf inline>BIS_coin_0 setVariable ["BIS_COIN_categories", ["Base","Defence"]];</sqf>
::Example:  
:: Default value: <sqf inline>[]</sqf>
bis_coin_0 setvariable ["BIS_COIN_items",
[
//--- Class, Category, Cost or [fundsID,Cost], (display name)
["USMC_WarfareBBarracks","Base",200],
["USMC_WarfareBLightFactory","Base",[0,300],"Chocolate factory"]
]
];
::Default value: []


*'''BIS_COIN_funds = <string> or <array>;''' - Variable(s) which stores amount of funds.
* '''BIS_COIN_items = <array>;''' - List of items to buy. Preview class (green transparent building) have to be named ''buildingclass_preview''.<br><!--
::Example 1: ''BIS_coin_0 setvariable ["BIS_COIN_funds","money_account"];''
--> Array contains building class, it' price in array (first element is funds' ID - see below, second is actual price; if only price is set, funds' ID will be 0) and display name
::Example 2: ''BIS_coin_0 setvariable ["BIS_COIN_funds",["supply_account","money_account"]];''
:: Example: <sqf>
::Default value: 0
bis_coin_0 setVariable ["BIS_COIN_items",
[
//--- Class, Category, Cost or [fundsID, Cost], (display name)
["USMC_WarfareBBarracks", "Base", 200],
["USMC_WarfareBLightFactory", "Base", [0, 300], "Chocolate factory"]
]
];
</sqf>
:: Default value: <sqf inline>[]</sqf>


*'''BIS_COIN_fundsDescription = <string> or <array>;''' - Variable(s) which stores description of funds types.
* '''BIS_COIN_funds = <string> or <array>;''' - Variable(s) which stores amount of funds.
::Example 1: ''BIS_coin_0 setvariable ["BIS_COIN_fundsDescription","CZK"];''
:: Example 1: <sqf inline>BIS_coin_0 setVariable ["BIS_COIN_funds", "money_account"];</sqf>
::Example 2: ''BIS_coin_0 setvariable ["BIS_COIN_fundsDescription",["","$"]];''
:: Example 2: <sqf inline>BIS_coin_0 setVariable ["BIS_COIN_funds", ["supply_account", "money_account"]];</sqf>
::Default value: "$"
:: Default value: <sqf inline>0</sqf>


*'''BIS_COIN_areasize = <array>;''' - Size of construction area (camera can't move outside of this circle and no building can be build there). Format of array is [radius,height]
* '''BIS_COIN_fundsDescription = <string> or <array>;''' - Variable(s) which stores description of funds types.
::Example: ''BIS_coin_0 setvariable ["BIS_COIN_areasize",[50,20]];''
:: Example 1: <sqf inline>BIS_coin_0 setVariable ["BIS_COIN_fundsDescription", "CZK"];</sqf>
::Default value: [150,50]
:: Example 2: <sqf inline>BIS_coin_0 setVariable ["BIS_COIN_fundsDescription", ["€", "$"]];</sqf>
:: Default value: <sqf inline>"$"</sqf>


*'''BIS_COIN_actionCondition = <string>;''' - String - condition for showing CoIn "Construction" action. If false, action never apperars. Can be changed on fly. Passed arguments: _this, _target.
* '''BIS_COIN_areaSize = <array>;''' - Size of construction area (camera can't move outside of this circle and no building can be build there). Format of array is [radius,height]
::Example: ''BIS_coin_0 setvariable ["BIS_COIN_actionCondition","(time < 30) && ((damage _this) < 0.5)"];'' - construction actions will be visible only till T 30 and to players not damaged too much
:: Example: <sqf inline>BIS_coin_0 setVariable ["BIS_COIN_areaSize", [50, 20]];</sqf>
::Default value: true
:: Default value: <sqf inline>[150, 50]</sqf>
::'''Note:''' Use with caution, because action is calculated every frame and complex condition on multiple construction sites can take large amount of reserved scripting time.


*'''BIS_COIN_onStart = <nowiki><code style="display: block"></nowiki>;''' - Code which is executed when CoIn interface is started. Can be used to update CoIn variables just in time. Passed arguments is [logic]
* '''BIS_COIN_actionCondition = <string>;''' - String - condition for showing CoIn "Construction" action. If false, action never apperars. Can be changed on fly. Passed arguments: _this, _target.
::Example: ''BIS_coin_0 setvariable ["BIS_COIN_onstart",{player globalchat "Starting CoIn view.}];''
:: Example: <sqf inline>BIS_coin_0 setVariable ["BIS_COIN_actionCondition", "(time < 30) && ((damage _this) < 0.5)"];</sqf> - construction actions will be visible only till T 30 and to players not damaged too much
::Default value: {}
:: Default value: <sqf inline>true</sqf>
::Note: <span style="color:#DF9300;">Warning! System starts only after code is finished.</span>
:: '''Note:''' Use with caution, because action is calculated every frame and complex condition on multiple construction sites can take large amount of reserved scripting time.


*'''BIS_COIN_onSelect = <nowiki><code style="display: block"></nowiki>;''' - Code which is executed when some building type is selected from menu. Passed arguments are [logic, class, preview building]
* '''BIS_COIN_onStart = <nowiki><code></nowiki>;''' - Code which is executed when CoIn interface is started. Can be used to update CoIn variables just in time. Passed arguments is [logic]
::Example: ''BIS_coin_0 setvariable ["BIS_COIN_onselect",{globalClass = _this select 0}];''
:: Example: <sqf inline>BIS_coin_0 setVariable ["BIS_COIN_onstart", { player globalChat "Starting CoIn view." }];</sqf>
::Default value: {}
:: Default value: <sqf inline>{}</sqf>
:: {{Feature|important|System starts only after code is finished.}}


*'''BIS_COIN_onPurchase = <nowiki><code style="display: block"></nowiki>;''' - Code which is executed when some building is purchased. Once code is completed, building is constructed. Passed argument is array in format [class,position,direction].
* '''BIS_COIN_onSelect = <nowiki><code></nowiki>;''' - Code which is executed when some building type is selected from menu. Passed arguments are [logic, class, preview building]
::Example: ''BIS_coin_0 setvariable ["BIS_COIN_onPurchase",{sleep 2}];'' - building appears after two seconds
:: Example: <sqf inline>BIS_coin_0 setVariable ["BIS_COIN_onselect",{globalClass = _this select 0}];</sqf>
::Default value: {}
:: Default value: <sqf inline>{}</sqf>
::Note: <span style="color:#DF9300;">Warning! System continues only after code is finished.</span>


*'''BIS_COIN_onConstruct = <nowiki><code style="display: block"></nowiki>;''' - Code which is executed when some building is created in the world. Passed argument is array in format [logic, object, class,position,direction].
* '''BIS_COIN_onPurchase = <nowiki><code></nowiki>;''' - Code which is executed when some building is purchased. Once code is completed, building is constructed. Passed argument is array in format [class,position,direction].
::Example: ''BIS_coin_0 setvariable ["BIS_COIN_onconstruct",{sleep 2; deleteVehicle (_this select 1);}];'' - building appears and is deleted after two seconds
:: Example: <sqf inline>BIS_coin_0 setVariable ["BIS_COIN_onPurchase",{sleep 2}];</sqf> - building appears after two seconds
::Default value: {}
:: Default value: <sqf inline>{}</sqf>
:: {{Feature|important|System continues only after code is finished.}}


*'''BIS_COIN_onRepair = <nowiki><code style="display: block"></nowiki>;''' - Code which is executed when some building is repaired. Once code is completed, building is repaired. Passed arguments are [logic, object].
* '''BIS_COIN_onConstruct = <nowiki><code></nowiki>;''' - Code which is executed when some building is created in the world. Passed argument is array in format [logic, object, class,position,direction].
::Example: ''BIS_coin_0 setvariable ["BIS_COIN_onrepair",{sleep 2}];'' - building is repaired after 2 seconds
:: Example: <sqf inline>BIS_coin_0 setVariable ["BIS_COIN_onconstruct",{sleep 2; deleteVehicle (_this select 1);}];</sqf> - building appears and is deleted after two seconds
::Default value: {} (Building is immediately repaired)
:: Default value: <sqf inline>{}</sqf>
::Note: <span style="color:#DF9300;">Warning! System continues only after code is finished.</span> Building can be repaired by pressing User 13 key.


*'''BIS_COIN_onSell = <nowiki><code style="display: block"></nowiki>;''' - Code which is executed when some building is sold. Once code is completed, building is deleted. Passed argument is [logic, object]
* '''BIS_COIN_onRepair = <nowiki><code></nowiki>;''' - Code which is executed when some building is repaired. Once code is completed, building is repaired. Passed arguments are [logic, object].
::Example: ''BIS_coin_0 setvariable ["BIS_COIN_onsell",{sleep 2}];'' - building is deleted after 2 seconds
:: Example: <sqf inline>BIS_coin_0 setVariable ["BIS_COIN_onrepair",{sleep 2}];</sqf> - building is repaired after 2 seconds
::Default value: {} (Building is immediately sold)
:: Default value: <sqf inline>{}</sqf> (Building is immediately repaired)
::Note: <span style="color:#DF9300;">Warning! System continues only after code is finished.</span> Building can be sold by pressing User 14 key.
:: {{Feature|important|System continues only after code is finished.}} Building can be repaired by pressing User 13 key.
 
* '''BIS_COIN_onSell = <nowiki><code></nowiki>;''' - Code which is executed when some building is sold. Once code is completed, building is deleted. Passed argument is [logic, object]
:: Example: <sqf inline>BIS_coin_0 setVariable ["BIS_COIN_onsell",{sleep 2}];</sqf> - building is deleted after 2 seconds
:: Default value: <sqf inline>{}</sqf> (Building is immediately sold)
:: {{Feature|important|System continues only after code is finished.}} Building can be sold by pressing User 14 key.
 
 
{{GameCategory|arma2|Editor Modules}}

Latest revision as of 23:30, 28 August 2023

Construction Interface (CoIn) is universal system for base construction primarily made for Warfare 2.

Initialisation

Paths

Editor:

Modules (F7) > Construction Interface

Data:

ca\modules\coin

Startup

Place CoIn module manager where you want to have base center (you can change this position dynamically during the game). You can place as many construction sites as you want.

Every logic is automatically named BIS_coin_#, where # is number starting from 0.


Using synchronisation (F5)

Units with access to given construction site can now be defined using synchronisation F5 and synchronizeObjectsAdd command.

Optional Parameters

Set Variables to BIS_coin_# with Desired Values

  • BIS_COIN_name = <string>; - Name of construction (displayed in action menu and GUI)
Example: BIS_coin_0 setVariable ["BIS_COIN_name", "Base"];
Default value: "" (no name)
  • BIS_COIN_rules = <array> or <side>; - Rules which defines which units have access to construction. Can be either list of specific units or whole side.
Example: BIS_coin_0 setVariable ["BIS_COIN_rules", [west, guer_commander]];
Default value: []
  • BIS_COIN_categories = <array>; - List of categories
Example: BIS_coin_0 setVariable ["BIS_COIN_categories", ["Base","Defence"]];
Default value: []
  • BIS_COIN_items = <array>; - List of items to buy. Preview class (green transparent building) have to be named buildingclass_preview.
    Array contains building class, it' price in array (first element is funds' ID - see below, second is actual price; if only price is set, funds' ID will be 0) and display name
Example:
bis_coin_0 setVariable ["BIS_COIN_items", [ //--- Class, Category, Cost or [fundsID, Cost], (display name) ["USMC_WarfareBBarracks", "Base", 200], ["USMC_WarfareBLightFactory", "Base", [0, 300], "Chocolate factory"] ] ];
Default value: []
  • BIS_COIN_funds = <string> or <array>; - Variable(s) which stores amount of funds.
Example 1: BIS_coin_0 setVariable ["BIS_COIN_funds", "money_account"];
Example 2: BIS_coin_0 setVariable ["BIS_COIN_funds", ["supply_account", "money_account"]];
Default value: 0
  • BIS_COIN_fundsDescription = <string> or <array>; - Variable(s) which stores description of funds types.
Example 1: BIS_coin_0 setVariable ["BIS_COIN_fundsDescription", "CZK"];
Example 2: BIS_coin_0 setVariable ["BIS_COIN_fundsDescription", ["€", "$"]];
Default value: "$"
  • BIS_COIN_areaSize = <array>; - Size of construction area (camera can't move outside of this circle and no building can be build there). Format of array is [radius,height]
Example: BIS_coin_0 setVariable ["BIS_COIN_areaSize", [50, 20]];
Default value: [150, 50]
  • BIS_COIN_actionCondition = <string>; - String - condition for showing CoIn "Construction" action. If false, action never apperars. Can be changed on fly. Passed arguments: _this, _target.
Example: BIS_coin_0 setVariable ["BIS_COIN_actionCondition", "(time < 30) && ((damage _this) < 0.5)"]; - construction actions will be visible only till T 30 and to players not damaged too much
Default value: true
Note: Use with caution, because action is calculated every frame and complex condition on multiple construction sites can take large amount of reserved scripting time.
  • BIS_COIN_onStart = <code>; - Code which is executed when CoIn interface is started. Can be used to update CoIn variables just in time. Passed arguments is [logic]
Example: BIS_coin_0 setVariable ["BIS_COIN_onstart", { player globalChat "Starting CoIn view." }];
Default value: {}
System starts only after code is finished.
  • BIS_COIN_onSelect = <code>; - Code which is executed when some building type is selected from menu. Passed arguments are [logic, class, preview building]
Example: BIS_coin_0 setVariable ["BIS_COIN_onselect",{globalClass = _this select 0}];
Default value: {}
  • BIS_COIN_onPurchase = <code>; - Code which is executed when some building is purchased. Once code is completed, building is constructed. Passed argument is array in format [class,position,direction].
Example: BIS_coin_0 setVariable ["BIS_COIN_onPurchase",{sleep 2}]; - building appears after two seconds
Default value: {}
System continues only after code is finished.
  • BIS_COIN_onConstruct = <code>; - Code which is executed when some building is created in the world. Passed argument is array in format [logic, object, class,position,direction].
Example: BIS_coin_0 setVariable ["BIS_COIN_onconstruct",{sleep 2; deleteVehicle (_this select 1);}]; - building appears and is deleted after two seconds
Default value: {}
  • BIS_COIN_onRepair = <code>; - Code which is executed when some building is repaired. Once code is completed, building is repaired. Passed arguments are [logic, object].
Example: BIS_coin_0 setVariable ["BIS_COIN_onrepair",{sleep 2}]; - building is repaired after 2 seconds
Default value: {} (Building is immediately repaired)
System continues only after code is finished.
Building can be repaired by pressing User 13 key.
  • BIS_COIN_onSell = <code>; - Code which is executed when some building is sold. Once code is completed, building is deleted. Passed argument is [logic, object]
Example: BIS_coin_0 setVariable ["BIS_COIN_onsell",{sleep 2}]; - building is deleted after 2 seconds
Default value: {} (Building is immediately sold)
System continues only after code is finished.
Building can be sold by pressing User 14 key.