Skip to content

Instantly share code, notes, and snippets.

@Fusselwurm
Last active May 3, 2021 07:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Fusselwurm/957ffb340d35fe941c396d9cd20386d8 to your computer and use it in GitHub Desktop.
Save Fusselwurm/957ffb340d35fe941c396d9cd20386d8 to your computer and use it in GitHub Desktop.

grad-civs: population zones & transit traffic

step by step

enable grad-civs

addon settings: enable grad-civs

just for debugging purposes, choose to show civilians on map

addon settings: show civs on map

place modules and a player unit like so

  • put population zone module anywhere
  • place a trigger and size it to the area you want civilians to spawn into.
  • sync (connect) the trigger to the population zone module
  • set a player unit somewhere close, but not too close to the population zone - at default settings,
    • people living in homes will spawn in 500m to 1km distance from players
    • foot patrols will spawn between 1km and 1.5km away from the next player
    • people driving cars will spawn between 1.5km and 4.5km away from the next player
  • put transit traffic source and sink modules and sync them. these will always spawn traffic, regardless of player distance and population zones.

set modules like so

start into singleplayer and wait ten seconds

result, about 10 seconds into the game


note

  • there's different types of civilians. some need houses to spawn. you wont get a bunch of civs sitting around in no mans land.
  • different types of civilians will only spawn when they're within a certain distance of players (minimum & maximum). look at the settings and see what suits you best.
  • the algorithm that looks for suitable spawn positions is fairly stupid. make sure population zones are not too small (couple hundred meters diameter at least)
  • if you place no population zones, the whole island will be considered to be a population zone

scenario from the example above (mission.sqm):

version=54;
class EditorData
{
	moveGridStep=1;
	angleGridStep=0.2617994;
	scaleGridStep=1;
	autoGroupingDist=10;
	toggles=1;
	class ItemIDProvider
	{
		nextID=6;
	};
	class Camera
	{
		pos[]={2994.8516,405.8049,5914.1494};
		dir[]={0.047934607,-0.96503162,0.25771391};
		up[]={0.17646867,0.26213312,0.94875985};
		aside[]={0.98313862,-3.7252903e-009,-0.18286309};
	};
};
binarizationWanted=0;
sourceName="grad-civs-popzone-demo-minimal";
addons[]=
{
	"grad_civs_common",
	"grad_civs_transit",
	"A3_Characters_F"
};
class AddonsMetaData
{
	class List
	{
		items=3;
		class Item0
		{
			className="grad_civs_common";
			name="common";
			author="AUTHOR";
		};
		class Item1
		{
			className="grad_civs_transit";
			name="transit";
			author="AUTHOR";
		};
		class Item2
		{
			className="A3_Characters_F";
			name="Arma 3 Alpha - Characters and Clothing";
			author="Bohemia Interactive";
			url="https://www.arma3.com";
		};
	};
};
randomSeed=12043049;
class ScenarioData
{
	author="Fusselwurm";
};
class Mission
{
	class Intel
	{
		timeOfChanges=1800.0002;
		startWeather=0.30000001;
		startWind=0.1;
		startWaves=0.1;
		forecastWeather=0.30000001;
		forecastWind=0.1;
		forecastWaves=0.1;
		forecastLightnings=0.1;
		wavesForced=1;
		windForced=1;
		year=2035;
		month=7;
		day=6;
		hour=12;
		minute=0;
		startFogDecay=0.014;
		forecastFogDecay=0.014;
	};
	class Entities
	{
		items=5;
		class Item0
		{
			dataType="Logic";
			class PositionInfo
			{
				position[]={2721.699,8.2864456,6731.9893};
			};
			id=0;
			type="grad_civs_common_PopulationZone";
			atlOffset=42.615429;
		};
		class Item1
		{
			dataType="Trigger";
			position[]={3310.1013,37.804783,6665.2544};
			angle=0.44253123;
			class Attributes
			{
				sizeA=500;
				sizeB=750;
				isRectangle=1;
			};
			id=1;
			type="EmptyDetectorAreaR250";
		};
		class Item2
		{
			dataType="Logic";
			class PositionInfo
			{
				position[]={4403.0034,126.14592,6780.2676};
				angles[]={0.09719272,3.6129158,6.1416388};
			};
			id=2;
			type="grad_civs_transit_transitSource";
			class CustomAttributes
			{
				class Attribute0
				{
					property="grad_civs_transit_transitSource_interval";
					expression="_this setVariable ['Interval',_value,true];";
					class Value
					{
						class data
						{
							class type
							{
								type[]=
								{
									"SCALAR"
								};
							};
							value=60;
						};
					};
				};
				class Attribute1
				{
					property="grad_civs_transit_transitSource_vehicles";
					expression="_this setVariable ['Vehicles',_value,true];";
					class Value
					{
						class data
						{
							class type
							{
								type[]=
								{
									"ARRAY"
								};
							};
						};
					};
				};
				nAttributes=2;
			};
		};
		class Item3
		{
			dataType="Logic";
			class PositionInfo
			{
				position[]={2027.2291,3.3938859,5177.6748};
			};
			id=3;
			type="grad_civs_transit_transitSink";
		};
		class Item4
		{
			dataType="Group";
			side="West";
			class Entities
			{
				items=1;
				class Item0
				{
					dataType="Object";
					class PositionInfo
					{
						position[]={2476.1531,73.781822,5671.0254};
					};
					side="West";
					flags=7;
					class Attributes
					{
						isPlayer=1;
					};
					id=5;
					type="B_Soldier_A_F";
				};
			};
			class Attributes
			{
			};
			id=4;
		};
	};
	class Connections
	{
		class LinkIDProvider
		{
			nextID=2;
		};
		class Links
		{
			items=2;
			class Item0
			{
				linkID=0;
				item0=0;
				item1=1;
				class CustomData
				{
					type="Sync";
				};
			};
			class Item1
			{
				linkID=1;
				item0=2;
				item1=3;
				class CustomData
				{
					type="Sync";
				};
			};
		};
	};
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment