Ambient Civilians – Arma 2
Jump to navigation
Jump to search
Lou Montana (talk | contribs) m (Text replacement - "bis_fnc_" to "BIS_fnc_") |
Lou Montana (talk | contribs) m (Some wiki formatting) |
||
Line 1: | Line 1: | ||
{{ | {{TOC|side}} | ||
'''Ambient Life In Civilian Environment (ALICE)''' is a system for populating towns with civilian units and simulating their common life. | |||
== Initialization == | |||
=== Paths === | === Paths === | ||
Editor: | Editor: | ||
Modules (F7) > Ambient Civilians | Modules (F7) > Ambient Civilians | ||
Line 10: | Line 13: | ||
=== Startup === | === Startup === | ||
Place ALICE manager on map. No additional synchronizing needed. | Place ALICE manager on map. No additional synchronizing needed. | ||
=== Optional parameters === | === Optional parameters === | ||
*'''respectModifyCoef = <number>;''' - artificial coeficient to set how much will be town's respect decreased once some civilian is hit or killed. The higher the number is, the more is respect towards killer's faction decreased. | ==== General Variables ==== | ||
::Example: | * '''townlist = <array>;''' - list of places where civilians will be spawned. Can be location logic (created by [[BIS_fnc_locations]]), array in format [center, distance] or trigger. | ||
::Default value: | :: Example: <sqf>this setVariable ["townlist", [bis_loc_acityc_mogilevka, [position this, 3000], trigger1]];</sqf> | ||
:: Default value: Whole island. | |||
*'''threatDecay = <number>;''' - value which is removed from town threat every 5 seconds (until threat reaches 0) | * '''spawnDistance = <number>;''' - distance of player(s) to town logic (in metres) in which system is starting to spawn civilians. | ||
::Example: | :: Example: <sqf>BIS_alice_mainscope setVariable ["spawnDistance", 800];</sqf> | ||
::Default value: | :: Default value: 1000 | ||
* '''civilianRarity = <array>;''' - Changing civilian rarity numbers (e.g. to have villagers spawned in cities, or to disable spawning of given class completely with unusual number like 10). Default rarity numbers are set in config under ''rarityUrban'' value (in range from 0/village to 1/city) | |||
*'''ALICE_civilianinit = <array>;''' - array of codes which is executed upon every civilian unit created. | :: Example: <sqf>BIS_alice_mainscope setVariable ["vehicleRarity", ["Citizen1", 10, "Worker2", 0.8]];</sqf> | ||
::Example: | :: Default value: [] | ||
* '''civilianCount = <string>;''' - formula on which basis system calculates number of civilians for locations. %1 is number of buildings with door (memory points called "AIDoor1", "AIDoor2", ...) in 500 metres from location. | |||
:: Example: <sqf>BIS_alice_mainscope setVariable ["civilianCount", "round (%1 / 10)"];</sqf> | |||
::Default value (and recommended): "round (2 * (sqrt %1))" | |||
* '''civilianActions = <array>;''' - list of action categories from CfgCivilianActions | |||
:: Example: <sqf>BIS_alice_mainscope setVariable ["civilianActions", ["BIS", "CSLA"]];</sqf> | |||
:: Default value: ["BIS"] | |||
* '''respectModifyCoef = <number>;''' - artificial coeficient to set how much will be town's respect decreased once some civilian is hit or killed. The higher the number is, the more is respect towards killer's faction decreased. | |||
:: Example: <sqf>BIS_alice_mainscope setVariable ["respectModifyCoef", 0.2];</sqf> | |||
:: Default value: 0.7 | |||
* '''threatDecay = <number>;''' - value which is removed from town threat every 5 seconds (until threat reaches 0) | |||
:: Example: <sqf>BIS_alice_mainscope setVariable ["threatDecay", 0.05];</sqf> | |||
:: Default value: 0.033 | |||
* '''ALICE_civilianinit = <array>;''' - array of codes which is executed upon every civilian unit created. | |||
:: Example: <sqf>[BIS_alice_mainscope, "ALICE_civilianinit", [{ _this addweapon "Mk_48" }]] call BIS_fnc_variableSpaceAdd;</sqf> | |||
::'''(use function [[BIS_fnc_variableSpaceAdd]] to prevent replacing currently existing codes)''' | ::'''(use function [[BIS_fnc_variableSpaceAdd]] to prevent replacing currently existing codes)''' | ||
::Default value: | :: Default value: none | ||
==== | ==== Location Variables ==== | ||
*'''ALICE_forcePopulation = <boolean>;''' - set to true if you want to populate town even without players' presence. | * '''ALICE_forcePopulation = <boolean>;''' - set to true if you want to populate town even without players' presence. | ||
::Example: | :: Example: <sqf>BIS_loc_acityc_kozlovka setVariable ["ALICE_forcePopulation", true];</sqf> | ||
::Default value: | :: Default value: false | ||
* '''ALICE_populationCoef = <number>;''' - coeficient to tell system what amount of civilians will be outside doing some action. 0.5 means 50% of civilians will be outside. | |||
*'''ALICE_populationCoef = <number>;''' - coeficient to tell system what amount of civilians will be outside doing some action. 0.5 means 50% of civilians will be outside. | :: Example: <sqf>BIS_loc_acityc_kozlovka setVariable ["ALICE_populationCoef", 1];</sqf> | ||
::Example: | :: Default value: around 0.6 | ||
::Default value: | * '''ALICE_civilianinit = <array>;''' - array of codes which is executed upon every civilian unit created. | ||
:: Example: <sqf>[bis_loc_acityc_kozlovka, "ALICE_civilianinit", [{ _this addweapon "Mk_48" }]] call BIS_fnc_variableSpaceAdd;</sqf> | |||
*'''ALICE_civilianinit = <array>;''' - array of codes which is executed upon every civilian unit created. | |||
::Example: | |||
::'''(use function [[BIS_fnc_variableSpaceAdd]] to prevent replacing currently existing codes)''' | ::'''(use function [[BIS_fnc_variableSpaceAdd]] to prevent replacing currently existing codes)''' | ||
::Default value: | :: Default value: none | ||
=== Stored variables === | === Stored variables === | ||
==== Variables stored in town logics ==== | ==== Variables stored in town logics ==== | ||
*'''"ALICE_population" = <array>;''' - list of all civilians in town | * '''"ALICE_population" = <array>;''' - list of all civilians in town | ||
*'''"ALICE_populationActive" = <array>;''' - list of all active civilians in town (e.g. civilians who are outside) | * '''"ALICE_populationActive" = <array>;''' - list of all active civilians in town (e.g. civilians who are outside) | ||
*'''"ALICE_populationCountDef" = <number>;''' - initial number of civilians (is reset when someone leaves the town) | * '''"ALICE_populationCountDef" = <number>;''' - initial number of civilians (is reset when someone leaves the town) | ||
*'''"ALICE_threat" = <number>;''' - threat level of town (-1 = not yet populated; 0 = safe; >0 = danger, where 0-1 is just suspicion and values higher than 10 are beginning to be extreme). | * '''"ALICE_threat" = <number>;''' - threat level of town (-1 = not yet populated; 0 = safe; >0 = danger, where 0-1 is just suspicion and values higher than 10 are beginning to be extreme). | ||
It seems that threat refers to how threatened the civilians feel by troops. Civilian behaviour changes when the fear increases (for example, I think they don't drive cars when they are fearful) | It seems that threat refers to how threatened the civilians feel by troops. Civilian behaviour changes when the fear increases (for example, I think they don't drive cars when they are fearful) | ||
*'''"ALICE_status" = <string>;''' - status category ("black" = inactive, "green" = threat on 0, "red" = threat > 0) | * '''"ALICE_status" = <string>;''' - status category ("black" = inactive, "green" = threat on 0, "red" = threat > 0) | ||
== Functions == | == Functions == | ||
==== BIS_ALICE_fnc_civilianSet ==== | ==== BIS_ALICE_fnc_civilianSet ==== | ||
'''Description:''' Sets basic ALICE values for civilian unit. Since then, unit will start to behave according to ALICE behavior pattern. | '''Description:''' Sets basic ALICE values for civilian unit. Since then, unit will start to behave according to ALICE behavior pattern. | ||
'''Params:''' | '''Params:''' | ||
*_this select 0 - OBJECT or ARRAY - Civilian or [group,class] to create new unit | * _this select 0 - OBJECT or ARRAY - Civilian or [group, class] to create new unit | ||
*_this select 1 - OBJECT (Optional) - Town logic (if nothing is set, nearest one is found) | * _this select 1 - OBJECT (Optional) - Town logic (if nothing is set, nearest one is found) | ||
*_this select 2 - OBJECT (Optional) - Invisible door (if nothing is set, random one in town are selected) | * _this select 2 - OBJECT (Optional) - Invisible door (if nothing is set, random one in town are selected) | ||
'''Returned value:''' true | '''Returned value:''' true | ||
== Good simple things == | == Good simple things == | ||
==== More civilians driving ==== | ==== More civilians driving ==== | ||
'''In your mission you will need:''' | '''In your mission you will need:''' | ||
*'''''CUSTOM_NAMED_Civil_Actions.HPP''''' | * '''''CUSTOM_NAMED_Civil_Actions.HPP''''' | ||
*'''''description.ext''''' | * '''''description.ext''''' | ||
< | <syntaxhighlight lang="cpp"> | ||
// On top of description file include your custom civilian actions | // On top of description file include your custom civilian actions | ||
// Note that file name must be correct or your PC will CTD on mission start! | // Note that file name must be correct or your PC will CTD on mission start! | ||
#include "CUSTOM_NAMED_Civil_Actions.HPP" | #include "CUSTOM_NAMED_Civil_Actions.HPP" | ||
</ | </syntaxhighlight> | ||
*'''''Alice Module''''' | * '''''Alice Module''''' | ||
< | <sqf> | ||
// Note that you need bigger spawn distance... Why? That cars can drive around from village to village... | // Note that you need bigger spawn distance... Why? That cars can drive around from village to village... | ||
// We need to call your custom civilian actions... In sample file new actions are named Mc_CA | // We need to call your custom civilian actions... In sample file new actions are named Mc_CA | ||
// init window of module: | |||
</ | this setVariable ["spawnDistance", 2000]; this setVariable ["civilianActions", ["Mc_CA"]]; | ||
</sqf> | |||
{{GameCategory|arma2|Editor Modules}} |
Revision as of 14:21, 31 January 2023
Ambient Life In Civilian Environment (ALICE) is a system for populating towns with civilian units and simulating their common life.
Initialization
Paths
Editor:
Modules (F7) > Ambient Civilians
Data:
ca\modules\alice
Startup
Place ALICE manager on map. No additional synchronizing needed.
Optional parameters
General Variables
- townlist = <array>; - list of places where civilians will be spawned. Can be location logic (created by BIS_fnc_locations), array in format [center, distance] or trigger.
- Example:
- Default value: Whole island.
- Example:
- spawnDistance = <number>; - distance of player(s) to town logic (in metres) in which system is starting to spawn civilians.
- Example:
- Default value: 1000
- Example:
- civilianRarity = <array>; - Changing civilian rarity numbers (e.g. to have villagers spawned in cities, or to disable spawning of given class completely with unusual number like 10). Default rarity numbers are set in config under rarityUrban value (in range from 0/village to 1/city)
- Example:
- Default value: []
- Example:
- civilianCount = <string>; - formula on which basis system calculates number of civilians for locations. %1 is number of buildings with door (memory points called "AIDoor1", "AIDoor2", ...) in 500 metres from location.
- Example:
- Default value (and recommended): "round (2 * (sqrt %1))"
- Example:
- civilianActions = <array>; - list of action categories from CfgCivilianActions
- Example:
- Default value: ["BIS"]
- Example:
- respectModifyCoef = <number>; - artificial coeficient to set how much will be town's respect decreased once some civilian is hit or killed. The higher the number is, the more is respect towards killer's faction decreased.
- Example:
- Default value: 0.7
- Example:
- threatDecay = <number>; - value which is removed from town threat every 5 seconds (until threat reaches 0)
- Example:
- Default value: 0.033
- Example:
- ALICE_civilianinit = <array>; - array of codes which is executed upon every civilian unit created.
- Example: [BIS_alice_mainscope, "ALICE_civilianinit", [{ _this addweapon "Mk_48" }]] call BIS_fnc_variableSpaceAdd;
- (use function BIS_fnc_variableSpaceAdd to prevent replacing currently existing codes)
- Default value: none
- Example:
Location Variables
- ALICE_forcePopulation = <boolean>; - set to true if you want to populate town even without players' presence.
- Example:
- Default value: false
- Example:
- ALICE_populationCoef = <number>; - coeficient to tell system what amount of civilians will be outside doing some action. 0.5 means 50% of civilians will be outside.
- Example:
- Default value: around 0.6
- Example:
- ALICE_civilianinit = <array>; - array of codes which is executed upon every civilian unit created.
- Example: [bis_loc_acityc_kozlovka, "ALICE_civilianinit", [{ _this addweapon "Mk_48" }]] call BIS_fnc_variableSpaceAdd;
- (use function BIS_fnc_variableSpaceAdd to prevent replacing currently existing codes)
- Default value: none
- Example:
Stored variables
Variables stored in town logics
- "ALICE_population" = <array>; - list of all civilians in town
- "ALICE_populationActive" = <array>; - list of all active civilians in town (e.g. civilians who are outside)
- "ALICE_populationCountDef" = <number>; - initial number of civilians (is reset when someone leaves the town)
- "ALICE_threat" = <number>; - threat level of town (-1 = not yet populated; 0 = safe; >0 = danger, where 0-1 is just suspicion and values higher than 10 are beginning to be extreme).
It seems that threat refers to how threatened the civilians feel by troops. Civilian behaviour changes when the fear increases (for example, I think they don't drive cars when they are fearful)
- "ALICE_status" = <string>; - status category ("black" = inactive, "green" = threat on 0, "red" = threat > 0)
Functions
BIS_ALICE_fnc_civilianSet
Description: Sets basic ALICE values for civilian unit. Since then, unit will start to behave according to ALICE behavior pattern.
Params:
- _this select 0 - OBJECT or ARRAY - Civilian or [group, class] to create new unit
- _this select 1 - OBJECT (Optional) - Town logic (if nothing is set, nearest one is found)
- _this select 2 - OBJECT (Optional) - Invisible door (if nothing is set, random one in town are selected)
Returned value: true
Good simple things
More civilians driving
In your mission you will need:
- CUSTOM_NAMED_Civil_Actions.HPP
- description.ext
// On top of description file include your custom civilian actions
// Note that file name must be correct or your PC will CTD on mission start!
#include "CUSTOM_NAMED_Civil_Actions.HPP"
- Alice Module
// Note that you need bigger spawn distance... Why? That cars can drive around from village to village...
// We need to call your custom civilian actions... In sample file new actions are named Mc_CA
// init window of module:
this setVariable ["spawnDistance", 2000]; this setVariable ["civilianActions", ["Mc_CA"]];