# Damaging the LBD Component

{% hint style="warning" %}
**Important:** It is expected that you have C# coding knowledge before proceeding.
{% endhint %}

## Damaging the Location Based Damage Component

Emerald AI agents can automatically detect if another AI target has a LBD component. When this happens, the hit AI will be damaged according to the hit collider, its multiplier, and the damage received.

If you want your player to damage an LBD component, an extra step is required as damaging an LBD component is different than damaging the AI directly. To do this, you will need a reference to the AI collider hit, a reference to the LocationBasedDamageArea component, and a call to the DamageArea function within the LocationBasedDamageArea component. The DamageArea parameters are the same as the EmeraldAISystem's Damage function to make the process easier.

{% hint style="info" %}
**Note:** You will need to included ***using EmeraldAI;*** at the top of your script in order to have the LocationBasedDamageArea class accessible.
{% endhint %}

```csharp
DamageArea(int DamageAmount, Transform AttackerTransform = null, int RagdollForce = 0)
```

```csharp
//Damages an AI based off of the collider hit and its multiplier. 
//In this example, a raycast was used to get a reference to the object hit.
//However, something like an OnCollisionEnter or OnTriggerEnter can also be used.
LocationBasedDamageArea m_LocationBasedDamageArea = hit.collider.GetComponent<LocationBasedDamageArea>();

if (m_LocationBasedDamageArea != null)
{
   m_LocationBasedDamageArea.DamageArea(DamageAmount, PlayerTransform, 400);
}
```


---

# 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://black-horizon-studios.gitbook.io/emerald-ai-wiki/emerald-components-optional/location-based-damage-component/damaging-the-lbd-component.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.
