Adding Ambient Civilians & Vehicles To A Map.

ambient_civilians_thirsk

Ambient civilians on Thirsk

How To Add Ambient Civilians To A Custom Map

Using the Ambient Civilian and the Ambient Civilian Vehicles editor modules on a stock Arma2 map is very easy. Just insert the modules into the mission and the modules will populate the map with vehicles and civilians; nothing else required. If you are using a custom built map where the cities are not defined though, just inserting the modules will do nothing. The modules don’t know where the cities are, so they will not spawn units to populate the island.

When I first saw that there were location game logics called City Center, I assumed that I could just synchronize them to the editor module and all would work. This does not work. Scripting is required.

Defining City Locations

Since the city locations are not defined on some addon maps (in my example, Thirsk) you need to tell the Ambient Civilian editor modules where the cities are located. To do this open up the mission editor and make sure Units (F1) is selected. Double click roughly where you figure the center of your city is and insert a game logic. In my example I used an actual City Center Location game logic, but it makes no difference; a regular game logic will do. It is important however that you name the game logic. You will need the name when you script the editor modules.

ambiant civilian gamelogic

ambiant civilian gamelogic

I Inserted my first game logic with the following properties:

  • Side: Game Logic
  • Class: Locations
  • Unit: City Center
  • Name: Thirsk

I inserted my second game logic over the center of the airport with the same options as above, but I named it Thirsk_airport.

Townlist for Ambient Civilians

Once I have my named game logics inserted where I want my civilians to spawn I can insert the actual Ambient Civilian editor modules. Make sure Modules (F7) is selected and double click anywhere on the map to insert a module. In my example I inserted both an Ambiant Civilians and Ambient Civilian Vehicles module. Next the scripting.

In the initialization line of each module I need to add the following bit of script:

this setVariable ["townlist",[Thirsk,Thirsk_airport]];

Where:

  • this refers to the module. I could have named the module and used it’s name here instead
  • setVariable is a scripting command to set a value for a variable.
  • “townlist” is a variable built into the editor module. We will be setting it to the names of the game logics we inserted in the mission editor earlier.
  • [Thirsk,Thirsk_airport] is an array of names of our game logics that we inserted into the mission editor.

Once I’ve typed this script into the initialization field of both the Ambient Civilians and Ambient Civilian Vehicles modules I can then preview the mission. If I’ve setup my mission correctly I should see random vehicles and civilians around where I’ve placed my game logics. Note that it does take a few seconds for the modules to spawn the civilians and send them walking/driving around. You may not see them right away. To verify that your city locations are working properly, turn on the module’s debug feature by inserting the following line of code into the editor module’s initialization field:

this setVariable ["debug",true];

If your mission is setup correctly when you preview it and look at the map you should see something like this at your city location.

ambient_civilian_debug

ambient civilian debug mode

Map markers will be inserted on the map indicating where the civilians are, door locations (tiny triangle’s on the buildings) and where the vehicle spawn areas are.

I’ve included a sample mission on Thirsk with all the city locations setup already. Grab it and give it a try.

 

Reference