Description of goals

Description of goals icons are downloaded from the **"\*.json"** files located in the **"World/Targets/"**.folder. Each file loads an array of descriptions, the file can contain one or more descriptions

Goals are used in different places of the game, when it is necessary to determine the purpose of the action or condition - it can be an object or a place.

Most often this description is required in:

* Bulleted list item
	+ task:
		- conditions for range - for example, a player at a certain distance from the target
		- action of the task - create an object at a certain point
		- job tags - designate a place or object
	+ description of cities - specify where to create a passenger or cargo
	+ customize the character - specify where to go, where to fly
	+ Other game systems (music, windows, etc.) that use condition aliases

**Targets for cities (bases)**

In tasks, the name of the global goal is specified, but when it is received, it first checks to see if there is a city (base) with that name, and only if it does not, looks for a goal description in global purposes. Also do other subsystems that use global targets.

**Source of goal request**

It is important to understand the context of the goal request, i.e. - who is looking for a goal. On this depends, for example, on how the nearest goal and the like will be chosen.
We have three objects that can search for the goal: the world, the city and the character. The search takes into account the location of each object, with the exception of the world - its location - the position of the player's airplane.

**Description structure**

{

```
   "Name": "ExampleTarget",
   "TargetType": "WorldEntity",
   "EntityCollection": "bases_biggun_powerplant",
   "EntityType": "QuestLandingZone",
   "Coordinates": [ 10, 0, 0 ]

```

}
**"Name"** is a unique name for the purpose by which it can be referenced.
**"TargetType"** - the type of the goal description of, determines what exactly we will describe.

* **"PlayerShip"** - the object - player's airplane,
* **"Self"** is an object that asks - so the characters can refer to themselves,
* **"SelfPlace"** is the position of the object that asks - so the characters can refer to themselves,
* **"WorldEntity"** is an object that is selected using other parameters of this description, for example, the nearest hangar,
* **"Coords"** is a position in the world either relative to the questioner, or global (determined by the "WorldPosition" parameter).

Next are optional (individually!) Parameters defining (as filters) the choice of the target when the type of "TargetType" is set: "WorldEntity":

**"EntityType"** - the target will be this type. List of types: Ship, Turret, WindVolume, City, SimpleUnityEntity, LandingZone, Hangar, CargoBox, Character, LandingPadEmergency, TradePlace, RepairDron, ATC, Oxy, PumpTower, PowerCell, House, Storage, Tank, Tower, TechBuilding, Crane, OutProductPlace.

**"EntityCollection"**: "bases\_researchlaboratory\_north" - if you specify, then the collection of objects will not be the one that asks, but the city with that name.

**"TargetNames"**: ["bases\_biggun\_test", "bases\_biggun"] - the target will be with the name from this list.

**"ExceptTargetNames"**: ["bases\_biggun\_powerplant"] - there will be no targets with such names.

**"WithDoor"**: true - if the target object - will be selected only with inputs for the characters, if the target is a city - only open cities for the player.

**"MinMaxDistance"**: [1000, 100000] - the target will be in this range of 3D distance in meters.

**"EntitySelectType"**: "Random" - a way of selecting one goal if there are several of them:

* First - the first of the sample is taken,
* Nearest - the nearest from the questioner,
* Random is a random sample, a feature: characters receive a random number when they are created, remembers it, and uses it when selecting a target in this case.

Next are the parameters for determining the position (coordinates), with the "TargetType" type set: "Coords":

**"Coordinates"**: [-338, 266, 11438] - 3D coordinates in the world or relative to the questioner. Feature: when receiving a position with the "TargetType" set: "WorldEntity" - these coordinates are used to offset relative to the selected object.

**"SetPositionToGround"**: true - you need to set the resulting position with the vertical projection to the ground.

**"Rotate"**: 15 - rotation of the position along the world vertical axis.

**"WorldPosition"**: true - coordinates will be global, without reference to the position of the questioner.

Extra options:

**"SelectOnce"**: true - only works for the character! - The character remembers the goal and does not choose it anymore, for example, when a random city is selected by the passenger.

**"EmptyTargetAccess"**: true - this parameter will not display a warning about an object not found.

**Examples of using**

**Global Goals**

{ //means a place named "ContainerPickUp", which is offset to [0, -13, 70] from the first in the city list
"bases\_researchlaboratory\_north" landing pad

```
 "Name": "ContainerPickUp",
 "TargetType": "WorldEntity",
 "EntityCollection": "bases_researchlaboratory_north",
 "EntityType": "LandingZone",
 "Coordinates": [ 0, -13, 70 ]

```

},
{ //A place with the name "CreateCargoBoxPlace" on the world coordinates, which will be set according to the height of the terrane

```
 "Name": "CreateCargoBoxPlace",
 "TargetType": "Coords",
 "Coordinates": [ 450, 266, 11800 ],
 "WorldPosition": true,
 "SetPositionToGround": true

```

},
{ //denotes an object-target with a name "NearestCargoBox", which has the type "CargoBox", which is closest to the player, in the range of distances from 0 to 70 meters,

```
 //if there is no goal, there will be no warnings
 "Name": "NearestCargoBox",
 "TargetType": "WorldEntity",
 "EntityType": "CargoBox",
 "EntitySelectType": "Nearest",
 "MinMaxDistance": [ 0, 70 ],
 "EmptyTargetAccess":  true

```

}

**Objectives for characters**

//goal - the player's airplane, the target's name coincides with TargetType
{ "TargetType": "PlayerShip" },
//goal is the character himself
{ "TargetType": "Self" },
//goal - the birthplace of the player, is selected once and remembered
{

```
 "Name": "BirthPlace",
 "TargetType": "SelfPlace",
 "SelectOnce": true

```

},
//the goal is the nearest structure from the character with the entrance, in the range from 25 (not to select the aircraft) to 3000 meters
{

```
 "Name": "NearestCityDoor",
 "TargetType": "WorldEntity",
 "WithDoor": true,
 "EntitySelectType": "Nearest",
 "MinMaxDistance": [ 25, 3000 ]

```

},
//The goal is a casual open city, excluding three cities, in a range of distances, choosing only once and memorable
{

```
 "Name": "RandomCity",
 "TargetType": "WorldEntity",
 "EntityType": "City",
 "WithDoor": true,
 "EntitySelectType": "Random",
 "ExceptTargetNames": [ "bases_biggun_test", "bases_biggun", "bases_biggun_powerplant" ],
 "MinMaxDistance": [ 1000, 100000 ],
 "SelectOnce": true

```

}

**Objectives for creating characters and containers in cities**

"CreatePlace":
{ //place - a shift of 10 and 10 meters from the center of the landing pad

```
   "TargetType": "WorldEntity",
   "EntityType": "LandingZone",
   "Coordinates": [ 10, 0, 10 ]

```

}