Damaging the LBD Component

Important: It is expected that you have C# coding knowledge before proceeding.

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.

Note: You will need to included using EmeraldAI; at the top of your script in order to have the LocationBasedDamageArea class accessible.

DamageArea(int DamageAmount, Transform AttackerTransform = null, int RagdollForce = 0)
//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);
}

Last updated