UFPS Integration Tutorial
This tutorial will get Emerald AI working with UFPS version 1.7.5. This will allow users to use UFPS to damage, both ranged and melee, Emerald AI agents as well as have Emerald AI damage the UFPS player. Note: This tutorial requires adding a few lines to a couple UFPS scripts and some basic understanding of minor editing of scripts.
Note: This tutorial has been updated to included explosive damage. Ensure that you follow the vp_Explosion step.
In order for Emerald AI to work correctly, your scenes must be baked with Unity’s NavMesh. For a quick guide on how to do so, see Unity’s guide here: Baking your Scene with Unity's NavMesh. Your AI’s attack animations will also need to have Attack Animation Events for ranged/melee attacks. See the tutorial on doing this here: Attack Animation Event Tutorial
This code should be placed right under the line m_Transform.position = m_Hit.point; within the vp_FXBullet script. Save the script when you’re done.
//Damage Emerald AI object
if (m_Hit.collider.gameObject.tag == "Emerald AI")
{
if (m_Hit.collider.gameObject.GetComponent<EmeraldAI.EmeraldAISystem>() != null)
{
EmeraldAI.EmeraldAISystem EmeraldComponent = m_Hit.collider.gameObject.GetComponent<EmeraldAI.EmeraldAISystem>();
EmeraldComponent.Damage((int)Damage, EmeraldAI.EmeraldAISystem.TargetType.Player, m_Source.transform, 400);
}
}
This should be placed within the TryDamage function at the very top within the vp_Explosion script. This is what allows explosive weapons to affect Emerald AI agents.
//Damage Emerald AI object
if (m_TargetCollider.gameObject.tag == "Emerald AI")
{
if (m_TargetCollider.gameObject.GetComponent<EmeraldAI.EmeraldAISystem>() != null)
{
EmeraldAI.EmeraldAISystem EmeraldComponent = m_TargetCollider.gameObject.GetComponent<EmeraldAI.EmeraldAISystem>();
EmeraldComponent.Damage((int)Damage, EmeraldAI.EmeraldAISystem.TargetType.Player, m_Source.transform, 400);
}
}
This code should be placed right under the last commented section within the EmeraldAIPlayerDamage script. Ensure that you have also added the line DamageUFPSPlayer(DamageAmount); within the SendPlayerDamage function. Save the script when you’re done.
void DamageUFPSPlayer(int DamageAmount)
{
if (GetComponent<vp_FPPlayerDamageHandler>())
{
GetComponent<vp_FPPlayerDamageHandler>().Damage((float)DamageAmount);
}
}
This concludes the UFPS integration tutorial, if something isn’t working correctly, re-watch the video to ensure nothing was missed. If you’re having issues with implementing UFPS, and you’ve gone through the video tutorial, support can be provided at: Support@BlackHorizonStudios.com
- Version 3.0 Upgrade Guide
- Creating an AI through the Setup Manager
- Setting up an AI's Animations
- Creating Attack Animation Events
- Creating an AI Ability Object
- Applying an AI's Head Transform
- Applying an AI's Ranged Attack Transform
- Setting up an AI's Factions
- Setting up an AI's Layers and Tags
- Using the Combat Text System
- Setting up an AI's Optimization Settings
- Setting up an AI with Ragdoll Deaths
- Creating a Shooter AI
- Creating a Floating or Hovering AI
- Using Emerald AI's Built in Object Pool
- Using the Emerald AI Needs System
- Using Emerald AI with Crux Spawner
- Using Location Based Damage
- Using the Emerald AI Camera Shake System
- Setting up an Equippable and Unequippable Weapon
- Setting up Ranged Weapon Hand IK
- Using the Target Position Modifier
- Using the Built-in IK System
- Setting up Non-AI Targets
- Setting up Custom Damage with Emerald AI
- Using the Sound Detector System
- Setting up the Built in Health Bars and Name Text
- Behaviors and Confidence Levels
- Wander Types and Movement
- Using Factions and Faction Manager
- Detection Type and Target Picking
- Adjusting an AI Hit's Transform
- Enabling an AI's Debugging Tools