Ambient Civilians

**Ambient Life In Civilian Environment (ALICE)** is 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

#### Set variables to BIS\_alice\_mainscope with desired values

* **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: *this setvariable ["townlist",[bis\_loc\_acityc\_mogilevka,[position this,3000],trigger1]];*
Default value: Whole island.
* **spawnDistance = <number>;** - distance of player(s) to town logic (in metres) in which system is starting to spawn civilians.

Example: *BIS\_alice\_mainscope setvariable ["spawnDistance",800];*
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)

Example: *BIS\_alice\_mainscope setvariable ["vehicleRarity",["Citizen1",10,"Worker2",0.8]];*
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: *BIS\_alice\_mainscope setvariable ["civilianCount","round (%1 / 10)"];*
Default value (and recommended): "round (2 \* (sqrt %1))"
* **civilianActions = <array>;** - list of action categories from CfgCivilianActions

Example: *BIS\_alice\_mainscope setvariable ["civilianActions",["BIS","CSLA"]];*
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: *BIS\_alice\_mainscope setvariable ["respectModifyCoef",0.2];*
Default value: 0.7
* **threatDecay = <number>;** - value which is removed from town threat every 5 seconds (until threat reaches 0)

Example: *BIS\_alice\_mainscope setvariable ["threatDecay",0.05];*
Default value: 0.033
* **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
#### Set variables to town logic with desired values

* **ALICE\_forcePopulation = <boolean>;** - set to true if you want to populate town even without players' presence.

Example: *BIS\_loc\_acityc\_kozlovka setvariable ["ALICE\_forcePopulation",true];*
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.

Example: *BIS\_loc\_acityc\_kozlovka setvariable ["ALICE\_populationCoef",1];*
Default value: around 0.6
* **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
### 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

Download sample mission

**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"]]

```