# DataType:ground

Contains all data related to a ground spawn

## Members

| **Type**                                                                                       | **Member**      | **Description**                                                 |
| ---------------------------------------------------------------------------------------------- | --------------- | --------------------------------------------------------------- |
| [*int*](/macroquest/data-types-and-top-level-objects/data-types/datatype-int.md)               | **ID**          | Ground item ID (not the same as item ID, this is like spawn ID) |
| [*int*](/macroquest/data-types-and-top-level-objects/data-types/datatype-int.md)               | **Distance**    | Distance from player to ground item                             |
| [*float*](/macroquest/data-types-and-top-level-objects/data-types/datatype-float.md)           | **X**           | X coordinate                                                    |
| [*float*](/macroquest/data-types-and-top-level-objects/data-types/datatype-float.md)           | **Y**           | Y coordinate                                                    |
| [*float*](/macroquest/data-types-and-top-level-objects/data-types/datatype-float.md)           | **Z**           | Z coordinate                                                    |
| [*heading*](/macroquest/data-types-and-top-level-objects/data-types/datatype-heading.md)       | **Heading**     | Ground item is facing this heading                              |
| \_\_[*string*](/macroquest/data-types-and-top-level-objects/data-types/datatype-string.md)\_\_ | **Name**        | Name                                                            |
| [*heading*](/macroquest/data-types-and-top-level-objects/data-types/datatype-heading.md)       | **HeadingTo**   | Direction player must move to meet this ground item             |
| [*bool*](/macroquest/data-types-and-top-level-objects/data-types/datatype-bool.md)             | **LineOfSight** | Returns TRUE if ground spawn is in line of sight                |
| [*int*](/macroquest/data-types-and-top-level-objects/data-types/datatype-int.md)               | **Address**     | ???                                                             |
| [*float*](/macroquest/data-types-and-top-level-objects/data-types/datatype-float.md)           | **DisplayName** | Displays name of the grounspawn                                 |
| [*int*](/macroquest/data-types-and-top-level-objects/data-types/datatype-int.md)               | **Distance3D**  | Distance from player to ground item                             |
| [*int*](/macroquest/data-types-and-top-level-objects/data-types/datatype-int.md)               | **SubID**       | ???                                                             |
| [*int*](/macroquest/data-types-and-top-level-objects/data-types/datatype-int.md)               | **ZoneID**      | ???                                                             |
| \_\_[*ground*](/macroquest/data-types-and-top-level-objects/data-types/datatype-ground.md)\_\_ | **First**       | First spawn                                                     |
| \_\_[*ground*](/macroquest/data-types-and-top-level-objects/data-types/datatype-ground.md)\_\_ | **Last**        | Last spawn                                                      |
| \_\_[*ground*](/macroquest/data-types-and-top-level-objects/data-types/datatype-ground.md)\_\_ | **Next**        | Next spawn                                                      |
| \_\_[*ground*](/macroquest/data-types-and-top-level-objects/data-types/datatype-ground.md)\_\_ | **Prev**        | Prev spawn                                                      |
| [*float*](/macroquest/data-types-and-top-level-objects/data-types/datatype-float.md)           | **W**           | X coordinate (Westward-positive)                                |
| [*float*](/macroquest/data-types-and-top-level-objects/data-types/datatype-float.md)           | **N**           | Y coordinate (Northward-positive)                               |
| [*float*](/macroquest/data-types-and-top-level-objects/data-types/datatype-float.md)           | **U**           | Z coordinate (Upward-positive)                                  |
| \_\_[*string*](/macroquest/data-types-and-top-level-objects/data-types/datatype-string.md)\_\_ | **To String**   | Same as ID                                                      |

## Methods

| Name         | Action                                                          |
| ------------ | --------------------------------------------------------------- |
| **DoFace**   | Will cause the toon to face the called for spawn if it exists   |
| **DoTarget** | Will cause the toon to target the called for spawn if it exists |
| **Grab**     | Picks up the ground spawn                                       |

## Examples

Extended the Ground TLO to accept searches

`/echo The closest ${Ground[brew].DisplayName} is ${Ground[brew].Distance3D} away from you.`

output: The closest Brew Barrel is 26.4 away from you.

Note that both of the search functions are case insensitive and are sorted by distance closest to you. The only acceptable parameter in the search filter is by name or partial name.

/echo ${Ground\[egg].Doface.Distance3D}) Will face the closest item on the ground which has the word "egg" in it. and then echo the distance to it in the mq2 window. well if it finds an item with the word "egg" in it on the ground that is, otherwise it will just echo NULL .DoFace does NOT target the ground item, it just faces it.

`/if (${Ground[egg].DoTarget.ID}) /echo we just targeted a ${Ground[egg]}`

Will target the closest item on the ground which has the word "egg" in it. and then echo the distance to it in the mq2 window.

`/if (${Ground[1].Doface.Distance3D}) /echo we just targeted a ${Ground[1].DisplayName}`

Will face the closest item on the ground. and then echo the distance to it in the mq2 window. well if it finds an groundspawn, otherwise it will just echo NULL .DoFace does NOT target the ground item, it just faces it.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://macroquest.gitbook.io/macroquest/data-types-and-top-level-objects/data-types/datatype-ground.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
