Contaminated Areas Configuration – DayZ

From Bohemia Interactive Community
Jump to navigation Jump to search

Configuration of the contaminated areas is done through a file within the mission folder, so any server owner can contaminate any part of the world.

Creation of static areas is done on mission start, the entities are not persistent, so from one server restart to another they can be removed or added with NO WIPE REQUIRED.

File should contain the full list of all static zones to be used by the contaminated areas logic. Dynamic zones are spawned through CE and use script defaults (They are treated as dynamic events, see relevant documentation to set them up).

File name is : cfgEffectArea.json

In case one wishes to disable Effect areas, putting an empty file in Mission folder will do the trick → Empty meaning opening and closing bracket { }.

An empty JSON, no area will be loaded:

{
}

Formatting

JSON does not support comments (//, /* */, or any other type); be sure to remove all comments from your file for it to work.
{
	// NOTE : All numerical values must be VALID Integers or Floats (0150 is NOT valid and should be written 150)
	"Areas": // All the areas user wants to define
	[
		{
			/* string */	"AreaName": "NWAF-South",			// Name to help differentiate in file but can also be used for debug
			/* string */	"Type": "ContaminatedArea_Static",	// Class name of EffectArea derived class one wants to spawn
			/* string */	"TriggerType": "",					// Trigger type ( typename as a string ), leave empty if no trigger desired
			/* object */	"Data": {
				/* float array */   "Pos": [ 4581, 450, 9592 ],	// Position of anchor entity, if Y coordinate is non-zero, entity and first layer of particles will not be snapped to ground
				/* float */			"Radius": 300,				// Radius of zone
				/* float */			"PosHeight": 25,			// Height of cylinder area going up from anchor entity position
				/* float */			"NegHeight": 10,			// Height of cylinder area going down from anchor entity position
				/* integer */		"InnerRingCount": 2,		// The amount of rings user wants inside of area ( does not include outer ring )
				/* integer */		"InnerPartDist": 35,		// Distance, on a straight line, between two particle emitters on interior rings. If value is strictly superior to radius, NO rings will be spawned
				/* boolean */		"OuterRingToggle": true,	// Toggle if outer ring is desired ( if yes it will be an additional ring to the inner rings )
				/* integer */		"OuterPartDist": 20,		// Distance, on a straight line, between two particle emitters on most outside ring
				/* integer */		"OuterOffset": -5,			// The distance with the radius of area ( negative value will push outer ring OUTSIDE of radius )
				/* integer */		"VerticalLayers": 0,		// The amount of vertical layers user wants to define ( in addition to ground level )
				/* integer */		"VerticalOffset": 25,		// Offset between two vertical layers
				/* string */		"ParticleName": "contaminated_area_gas_bigass" // The name of the particle one wants to populate the area with
			},
			"PlayerData": {
				/* string */		"AroundPartName": "contaminated_area_gas_around",		// The name of the "around" particle to spawn around player when in trigger -> requires trigger to do anything
				/* string */		"TinyPartName": "contaminated_area_gas_around_tiny",	// The name of the "tiny" particle to spawn around player when in trigger -> requires trigger to do anything
				/* string */		"PPERequesterType": "PPERequester_ContaminatedAreaTint"	// The typename of the Post Process Effect to apply on the player camera when inside the area
			}
		},
		{
			"AreaName": "NWAF-North",
			"Type": "ContaminatedArea_Static",
			"TriggerType": "ContaminatedTrigger",
			"Data": {
				"Pos": [ 4036, 0, 11712 ],
				"Radius": 150,				// Pass -1 to use default value
				"PosHeight": 30,			// Pass -1 to use default value
				"NegHeight": 60,			// Pass -1 to use default value
				"InnerRingCount": 2,		// No default support yet
				"InnerPartDist": 35,		// Pass -1 to use default value
				"OuterRingToggle": true,	// NO WAY TO PASS DEFAULT ( it's just a bool )
				"OuterPartDist": 20,		// Pass -1 to use default value
				"OuterOffset": -5,			// NO WAY TO PASS DEFAULT ( would cause conflict with valid values )
				"VerticalLayers": 0,		// Pass -1 to use default value
				"VerticalOffset": 0,		// Pass -1 to use default value
				"ParticleName": "contaminated_area_gas_bigass"
			},
			"PlayerData": {
				"AroundPartName": "contaminated_area_gas_around",
				"TinyPartName": "contaminated_area_gas_around_tiny",
				"PPERequesterType": "PPERequester_ContaminatedAreaTint"
			}
		}
	]
}

Particle Calculation

The formula used to determine the amount of particle emitters in an area is as follows:

2 PI / ACOS( 1 - ( x ^ 2 / 2 * y ^ 2 ) )

where 'x' is the spacing between emitters and 'y' is the radius of a given ring

example with x = 20 and y = 105

2 PI / ACOS( 1 - ( 20 ^ 2 / 2 * 105 ^ 2 ) ) = 2 PI / ACOS( 1 - ( 400 / 2 * 11025 ) ) =  2 PI / ACOS( 1 - ( 400 / 22050 ) )  = 2 PI / ACOS( 1 - 0.01814059 ) = 2 PI / ACOS( 0.98185941 ) = 2 PI / 0.190765318 = 32.93672756

These values being rounded you will have 32 particle emitters on this specific ring.

When configuring a zone, if you want to know in advance how many emitters you will have in total, pass each of your ring settings in this formula, add the results and add 1 (central emitter) and multiply by the amount of vertical layers you have (at least 1 on ground) and you will have your total amount of emitters.

For inner ring 'y' values take your area radius (100 for example) divide by the amount of inner rings minus 1 (2 inner rings = 100 / 3) your first ring will have a radius of 33 and second one will have a radius of 66. This may seem like an odd way of doing things but we assume an outer ring exists and that would be your 3 from the previous formula.

It is not recommended to have more than 100 emitters per zone, each DEFAULT area emitter being 10 particles.

The more particles are spawning, the bigger the performance hit.

When using non-default particles please keep in mind that the performance hit comes from particle count, not emitter count.

Visual Examples of Configuration

Fig.1 Rings and emitters generation Fig.2 Trigger height configuration
Generation of rings and emitters Configuration of trigger dimensions