Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

[RELEASED] Emerald AI 3.2 (New Sound Detection) - The Ultimate Universal AAA Quality AI Solution

Discussion in 'Assets and Asset Store' started by BHS, Jun 26, 2015.

  1. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    4,030
    I thought that might be the case, but I didn't see any documentation on it. What is the name of the event to send? Is it just PlayAttackSound?
     
  2. unity_7UFP4-iCkwsgjg

    unity_7UFP4-iCkwsgjg

    Joined:
    Dec 13, 2017
    Posts:
    323
    @BHS it says raycast does not contain a definition for gameobject
     
  3. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,760
  4. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,760
    Oops, this should work.
    Code (CSharp):
    1. if (hit.collider.gameObject != null)
    2. {
    3.    Debug.Log(hit.collider.gameObject.name);
    4. }
     
  5. SickaGames1

    SickaGames1

    Joined:
    Jan 15, 2018
    Posts:
    1,269
    Is the 2.3.0.2 coming out soon?
     
  6. FrostedBrain

    FrostedBrain

    Joined:
    Sep 26, 2019
    Posts:
    31

    Where do I put that?
     
  7. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,760
    I'm submitting it today.
     
    SickaGames1 likes this.
  8. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,760
    You said you had a custom VR script where you wanted to cause damage on collision. You would put this code where your custom script handles your bullet collisions and you would use your own variables. I couldn't tell you exactly where without seeing your script.
     
  9. unity_7UFP4-iCkwsgjg

    unity_7UFP4-iCkwsgjg

    Joined:
    Dec 13, 2017
    Posts:
    323
    bhs no logs occurred until i removed the game object.tag then i received this log


    NullReferenceException: Object reference not set to an instance of an object
    EmeraldAI.DamageXP.<Update>g__Attack|2_0 () (at Assets/Character/Controls/Damage/DamageXP.cs:38)
    EmeraldAI.DamageXP.Update () (at Assets/Character/Controls/Damage/DamageXP.cs:20)
     
    Last edited: Oct 2, 2019
  10. FrostedBrain

    FrostedBrain

    Joined:
    Sep 26, 2019
    Posts:
    31
    I see the collision part on the bottom, here is the script if you want to take a look at it


    Code (CSharp):
    1. using System.Collections;
    2. using System.Collections.Generic;
    3. using UnityEngine;
    4.  
    5. namespace VArmory
    6. {
    7.     public class Projectile : MonoBehaviour
    8.     {
    9.         [SerializeField] protected Rigidbody rb;
    10.         [SerializeField] protected Collider col;
    11.  
    12.         public Collider Col { get { return col; } }
    13.  
    14.         [SerializeField] protected float muzzleVelocity = 169f;
    15.  
    16.         //[SerializeField] protected float forceDamp = 10f;
    17.  
    18.         //[SerializeField] protected float baseDamage = 100;
    19.         //[SerializeField] protected float maxDistance = 100;
    20.  
    21.         [SerializeField] protected Explosive explosive;
    22.         //[SerializeField] protected float extraForce;
    23.         //[SerializeField] protected float trauma = 0.25f;
    24.  
    25.         public Transform[] unchildOnCollision;
    26.  
    27.         [SerializeField] protected float pellets;
    28.         [SerializeField] protected bool destroyOnImpact = true;
    29.         [SerializeField] protected float destroyDelay = 0.05f;
    30.  
    31.         [System.Serializable]
    32.         public struct BulletImpactEffect
    33.         {
    34.             public string hitObjectTag;
    35.             public GameObject impactParticle;
    36.             public AudioClip[] impactAudio;
    37.             public GameObject exitParticle;
    38.             public AudioClip[] exitAudio;
    39.         }
    40.  
    41.         [SerializeField] protected List<BulletImpactEffect> impactEffects;
    42.  
    43.         void Start()
    44.         {
    45.             Destroy(gameObject, 7.5f);
    46.         }
    47.  
    48.         void OnCollisionEnter(Collision col)
    49.         {
    50.             Effect(col, true);
    51.  
    52.             if (explosive) explosive.enabled = true;
    53.  
    54.             foreach (Transform child in unchildOnCollision)
    55.                 child.parent = null;
    56.  
    57.             if (destroyOnImpact)
    58.                 if (destroyDelay != 0)
    59.                     Destroy(gameObject, destroyDelay);
    60.                 else
    61.                     Destroy(gameObject);
    62.         }
    63.  
    64.         public void Fire()
    65.         {
    66.             rb.AddForce(transform.forward * muzzleVelocity, ForceMode.Impulse);
    67.             Destroy(gameObject, 7.5f);
    68.  
    69.             GameObject clone = gameObject;
    70.  
    71.             for (int i = 0; i < pellets; i++)
    72.             {
    73.                 Instantiate(gameObject, transform.position, transform.rotation);
    74.                 Destroy(clone, 7.5f);
    75.             }
    76.         }
    77.  
    78.         public void Fire(float muzzleVelocity, float spread)
    79.         {
    80.             rb.AddForce(transform.forward * muzzleVelocity, ForceMode.Impulse);
    81.             Destroy(gameObject, 7.5f);
    82.  
    83.             Projectile clone = this;
    84.             Vector3 spreadV = Vector3.zero;
    85.  
    86.             for (int i = 0; i < pellets; i++)
    87.             {
    88.                 clone = Instantiate(clone, transform.position, transform.rotation);
    89.                 spreadV.x = Random.Range(-spread, spread);
    90.                 spreadV.y = Random.Range(-spread, spread);
    91.                 spreadV.z = Random.Range(-spread, spread);
    92.                 clone.rb.AddForce((transform.forward * muzzleVelocity) + spreadV, ForceMode.Force);
    93.                 Destroy(clone, 7.5f);
    94.             }
    95.         }
    96.  
    97.         void Effect(Collision col, bool ENTEREXIT)
    98.         {
    99.             for (int i = 0; i < impactEffects.Count; i++)
    100.             {
    101.                 BulletImpactEffect impactEffect = impactEffects[i];
    102.  
    103.                 if (col.gameObject.tag == impactEffect.hitObjectTag)
    104.                 {
    105.                     GameObject clone = null;
    106.                     GameObject particleEffect = ENTEREXIT ? impactEffect.impactParticle : impactEffect.exitParticle;
    107.                     //AudioClip audioEffect = ENTEREXIT ? impactEffect.impactAudio[Random.Range(0, impactEffect.impactAudio.Length - 1)] : impactEffect.exitAudio[Random.Range(0, impactEffect.exitAudio.Length - 1)];
    108.  
    109.                     if (particleEffect)
    110.                     {
    111.                         clone = Instantiate(particleEffect,
    112.                             col.contacts[0].point + col.contacts[0].normal * 0.01f,
    113.                             Quaternion.FromToRotation(Vector3.forward, col.contacts[0].normal)) as GameObject;
    114.  
    115.                         Destroy(clone, 3f);
    116.  
    117.                         Transform decal = clone.transform.GetChild(0);
    118.  
    119.                         if (decal)
    120.                             if (decal.name == "Decal")
    121.                             {
    122.                                 decal.SetParent(col.transform, true);
    123.                                 Destroy(decal.gameObject, 5f);
    124.                             }
    125.                     }
    126.  
    127.                     //if (audioEffect)
    128.                     //    AudioSource.PlayClipAtPoint(audioEffect, col.contacts[0].point);
    129.                 }
    130.             }
    131.         }
    132.     }
    133. }
     
  11. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    4,030
  12. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,760
    Within the void OnCollisionEnter(Collision col) function, try adding:
    Code (CSharp):
    1. if (col.gameObject.GetComponent<EmeraldAI.EmeraldAISystem>())
    2. {            
    3.    col.gameObject.GetComponent<EmeraldAI.EmeraldAISystem>().Damage(20, EmeraldAI.EmeraldAISystem.TargetType.Player);
    4. }
    I don't see a damage variable so I'm using a value of 20 for the damage.
     
    FrostedBrain likes this.
  13. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,760
    I agree, I'll update the offline documentation. I assumed no one used the offline version with the online version available.
     
  14. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,760
    These errors are unrelated to Emerald AI. It's most likely because you are looking for DamageXP script on an object where it doesn't exist.
     
  15. unity_7UFP4-iCkwsgjg

    unity_7UFP4-iCkwsgjg

    Joined:
    Dec 13, 2017
    Posts:
    323
    ah right so how can i get the damageXP script to damage my ai tried all ideas but to no avail ?
    no errors come up with the raycasting log so not sure what else to do
     
  16. Low_on_Mana

    Low_on_Mana

    Joined:
    Jun 18, 2018
    Posts:
    37

    Just a friendly bump!
     
  17. FrostedBrain

    FrostedBrain

    Joined:
    Sep 26, 2019
    Posts:
    31
    That works perfectly! Thanks so much.

    I'm very happy to continue using your asset and I definitely do not regret supporting you again as a dev after I lost my old account with Emerald on it.

    I'll be sure to leave a review as soon as I can. Thanks again!
     
  18. MagiSoftworks

    MagiSoftworks

    Joined:
    Feb 12, 2019
    Posts:
    124
    Hi BHS! Think I messed something up in EmeraldAIPlayerDamage messing with Invector Shooter. Going to go back through but maybe something stupid ? :)
     

    Attached Files:

    SickaGames1 likes this.
  19. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,760
    I’m not sure as you haven’t posted the whole script. Is the script you’ve been posting portions of the damageXP script? I would recommend just using the included example damage script and modifying it as needed as it is already working correctly.
     
  20. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,760
    It’s briefly used when transitioning from the combat idle to the run animations. I like the idea of having it utilized more though. I’ll look into a better solution such as distance control.

    There’s currently no way to force a run attack, but it uses the AI’s attack speed and has its own individual distance for attacking. Setting the AI’s attack speed low, such as 1 or 0, should allow it to trigger properly when chasing or approaching a target. You can control the run attack distance with the run attack distance setting.
     
  21. unity_7UFP4-iCkwsgjg

    unity_7UFP4-iCkwsgjg

    Joined:
    Dec 13, 2017
    Posts:
    323
    bhs that was whole damage script :( where is the example damage script located?
     
  22. p_hergott

    p_hergott

    Joined:
    May 7, 2018
    Posts:
    414
    Emeraldai/scripts/componets/emeraldaiplayerdamage
     
  23. unity_7UFP4-iCkwsgjg

    unity_7UFP4-iCkwsgjg

    Joined:
    Dec 13, 2017
    Posts:
    323
    ah i got that script allows my ai to damage my player it wont work other way round ?
     
  24. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,760
    You're welcome and I'm sorry to hear about your lost account. Thanks, a review is always appreciated. :)
     
  25. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,760
    It looks like you may have somehow deleted the ActiveEffects variable. Add this back to the script above the SendPlayerDamage function.
    Code (CSharp):
    1. public List<string> ActiveEffects = new List<string>();
     
  26. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,760
    You can use the EmeraldAIPlayerHealth for a example health script and the PlayerWeapon for an example damage AI script. You should be able to attach it to your player's camera.
     
  27. unity_7UFP4-iCkwsgjg

    unity_7UFP4-iCkwsgjg

    Joined:
    Dec 13, 2017
    Posts:
    323
    ah right would i attach the playerhealth to the ai for health script?
     
  28. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,760
    No, you would attach the EmeraldAIPlayerHealth to the main player object. AI have a built-in health system.
     
  29. unity_7UFP4-iCkwsgjg

    unity_7UFP4-iCkwsgjg

    Joined:
    Dec 13, 2017
    Posts:
    323
    okay done that but the ai is not recognizing an attack from my player, i have set it to attack if attacked but it just carries on walking off. Have set the tags to enemy and changed the GetMouseButton to Input.GetKeyDown("e") as that is my attack button?
     
  30. Low_on_Mana

    Low_on_Mana

    Joined:
    Jun 18, 2018
    Posts:
    37
    Thanks for the response! I'll give the attack distance thing a try and look forward to seeing if you do anything with combat walk!
     
    BHS likes this.
  31. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,760
    It sounds like something isn't setup correctly with your layers/tags. Try using the included demo player to get an idea of how it's setup. Is your player first person or 3rd person?
     
  32. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,760
    Emerald AI version 2.3.0.2 has been submitted. This update fixes the issues some users have been having with version 2.3. Thanks for the bug resorts!

    2.3.0.2 Release Notes
    • Fixed an issue that allowed melee AI to attack targets and apply damage if they were above/below them or in unreachable locations. (Only applies to melee combat)
    • Fixed an issue where AI would attack the air if their targets were above/below them or in unreachable locations. (Only applies to melee combat)
    • Fixed an issue that didn't allow the Ranged Warning animation to be visible within the editor.
    • Fixed an issue that didn't allow the melee and ranged weapon object to be visible when using both weapon types.
    • Fixed the Animator Controller from not allowing an AI to switch between weapon types when using the Both option (when not using Equip and Unequip animations).
    • Fixed an issue with Idle Sounds cutting out.
    • Fixed an issue where Companion AI couldn't attack cowardly AI.
    • Fixed an issue with the alignment calculations.
    • Added a setting to control the AI's allowed Attack Height. This setting is located under the AI's Attack Distance and only applies to melee combat.
    • Added option to disable the debug logging of Animation Events and checking for missing animations. This is located under the Docs tab within the Debug tools.
    • Added a button to the Creating an Ability Object Tutorial within the Abilities section.
    • Improved the initialization process by switching an AI's settings that would result in an AI not functioning correctly, such as preventing an Aggressive AI from using the Coward Confidence Type.
    • Added a new description for explaining the Expanded Chase Distance for further clarification and usage of the setting.
     
    Last edited: Oct 4, 2019
  33. unity_7UFP4-iCkwsgjg

    unity_7UFP4-iCkwsgjg

    Joined:
    Dec 13, 2017
    Posts:
    323
    bhs my character is third person (animal not person though) and using the tag player
     
  34. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,760
    Oh, well try using the PlayerWeapon3rdPerson instead, but attach it to your main player object. Have you tried using the included example player to see if everything is working correctly? I plan on adding an improved weapon/damage script to work universally with first or third person. I'm hoping to have this update submitted sometime next week.
     
    JRD likes this.
  35. unity_7UFP4-iCkwsgjg

    unity_7UFP4-iCkwsgjg

    Joined:
    Dec 13, 2017
    Posts:
    323
    yeah that works fine and i am using the same tags. Ai notices player to and causes player damage if set on always attack player. Ai moves when being hit by player but wont attack back(when set on only if attacked) or take damage from player .

    this is whats attached to my player and whats attached to the ai (bull) testdino.png testbull.png
     
    Last edited: Oct 4, 2019
  36. combatsheep

    combatsheep

    Joined:
    Jan 30, 2015
    Posts:
    133
    Hi, BHS.

    I want to update the EmeraldAI to ver2.3.0.2.
    Do I have to remove the ver2.3.0.1?
    Or, just importing to the ver2.3.0.1?
     
    Last edited: Oct 4, 2019
  37. llJIMBOBll

    llJIMBOBll

    Joined:
    Aug 23, 2014
    Posts:
    578
    ''Fixed an issue that allowed melee AI to attack targets and apply damage if they were above/below them or in unreachable locations. (Only applies to melee combat)''


    THANK YOU SIR!!!! :D
     
    BHS likes this.
  38. SickaGames1

    SickaGames1

    Joined:
    Jan 15, 2018
    Posts:
    1,269
    Yeah! Thank you @BHS! I love what you do and can't wait to see what you deliver in the future!
     
    BHS likes this.
  39. FrostedBrain

    FrostedBrain

    Joined:
    Sep 26, 2019
    Posts:
    31
    Is there a way to get explosive damage from this script to damage emerald AI agents?


    Code (CSharp):
    1. using System.Collections;
    2. using System.Collections.Generic;
    3. using UnityEngine;
    4.  
    5. namespace VArmory
    6. {
    7.     public class Explosive : MonoBehaviour
    8.     {
    9.         [SerializeField] protected float radius;
    10.         [SerializeField] protected float force;
    11.         [SerializeField] protected float explosionForce;
    12.         [SerializeField] protected float upwardForce;
    13.         [SerializeField] protected AnimationCurve forceOverDistanceCurve;
    14.         [SerializeField] protected Transform explosion;
    15.  
    16.         [SerializeField] protected bool explodeOnStart = true;
    17.         [SerializeField] protected bool destroyOnExplode;
    18.         [SerializeField] protected float delay;
    19.  
    20.         [SerializeField] protected bool detonateOtherExplosives;
    21.         [SerializeField] protected bool detonatedByOtherExplosives;
    22.  
    23.         [SerializeField] protected AnimationCurve damageOverDistance;
    24.         [SerializeField] protected float baseDamage;
    25.  
    26.         protected bool detonated;
    27.  
    28.         public bool DetonatedByOtherExplosives { get { return detonatedByOtherExplosives; } }
    29.  
    30.         public delegate void ExplodeEvent();
    31.         public ExplodeEvent _Explode;
    32.  
    33.  
    34.  
    35.     void Start()
    36.         {
    37.             if (explodeOnStart) StartCoroutine(ExplodeRoutine(0));
    38.         }
    39.  
    40.         public void Explode()
    41.         {
    42.             StartCoroutine(ExplodeRoutine(delay));
    43.         }
    44.  
    45.         public void Explode(float delay)
    46.         {
    47.             StartCoroutine(ExplodeRoutine(delay));
    48.         }
    49.  
    50.         public void ExplodeByOther(float delay)
    51.         {
    52.             if (!detonated) if (_Explode != null) _Explode();
    53.             StartCoroutine(ExplodeRoutine(delay));
    54.         }
    55.  
    56.         IEnumerator ExplodeRoutine(float delay)
    57.         {
    58.             if (detonated) yield break;
    59.  
    60.             detonated = true;
    61.  
    62.             if (delay > 0)
    63.                 yield return new WaitForSeconds(delay);
    64.  
    65.             var cols = Physics.OverlapSphere(transform.position, radius);
    66.             var rigidbodies = new List<Rigidbody>();
    67.  
    68.             foreach (var col in cols)
    69.             {
    70.                 if (col.attachedRigidbody != null && !rigidbodies.Contains(col.attachedRigidbody))
    71.                 {
    72.                     rigidbodies.Add(col.attachedRigidbody);
    73.                 }
    74.  
    75.                 if (detonateOtherExplosives)
    76.                     if (col.tag == "Explosive")
    77.                     {
    78.                         Explosive tempExplosive = col.GetComponent<Explosive>();
    79.  
    80.                         if (tempExplosive)
    81.                             if (tempExplosive.DetonatedByOtherExplosives)
    82.                                 tempExplosive.ExplodeByOther(0.1f);
    83.                     }
    84.             }
    85.  
    86.             foreach (var rb in rigidbodies)
    87.             {
    88.                 float distance = Vector3.Distance(transform.position, rb.transform.position);
    89.                 float forceCurve = forceOverDistanceCurve.Evaluate(distance / radius);
    90.                 rb.AddExplosionForce(forceCurve * explosionForce, transform.position, radius, upwardForce, ForceMode.Impulse);
    91.                 rb.AddForce(-(transform.position - rb.transform.position) * forceCurve * force, ForceMode.Impulse);
    92.             }
    93.  
    94.             if (explosion) Instantiate(explosion, transform.position, transform.rotation);
    95.  
    96.             if (destroyOnExplode)
    97.                 Destroy(gameObject, 0.05f);
    98.  
    99.             yield return null;
    100.         }
    101.     }
    102. }
     
  40. unity_7UFP4-iCkwsgjg

    unity_7UFP4-iCkwsgjg

    Joined:
    Dec 13, 2017
    Posts:
    323
    finally managed to the player to damage the ai yayyy :)
     
    FrostedBrain likes this.
  41. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    4,030
    @BHS I have a small request. When I use EmeraldAI with a pooling solution, I always get an error when the pooling system pre-instantiates the Emerald AI. When SetUpNavMeshAgent() is called, the AI is not on a valid nav mesh because it has only been instantiated in the pool and has not been spawned on a nav mesh yet. To solve this, I added a check in SetupNavMeshAgent() as follows:

    Code (CSharp):
    1.             if (!EmeraldComponent.m_NavMeshAgent.isOnNavMesh) return;
    2.  
    So it exits without generating the error. As far as I can tell, the AI still behave properly once spawned. But if there is anything else that needs to be done, please let me know.

    If you could add a fix like this in a future version that would be nice.
     
    combatsheep and llJIMBOBll like this.
  42. unity_7UFP4-iCkwsgjg

    unity_7UFP4-iCkwsgjg

    Joined:
    Dec 13, 2017
    Posts:
    323
    anyone know how i can make it so when the AI die the player can eat their body?
     
  43. llJIMBOBll

    llJIMBOBll

    Joined:
    Aug 23, 2014
    Posts:
    578

    I've edited Emerald to add this, it checks if ai is on navmesh before controlling it. If its not on a navmesh, it will move the ai to the closest point on the navmesh to where the ai is.

    Code (CSharp):
    1. public void DoCheck ()
    2.     {
    3.         Agent.enabled = false;
    4.         NavMeshHit closestHit;
    5.         if (NavMesh.SamplePosition (transform.position, out closestHit, MaxDistance, AreaMask)) {
    6.  
    7.             gameObject.transform.position = closestHit.position;
    8.             Agent.enabled = true;
    9.  
    10.         } else {
    11.  
    12.             DarkTonic.PoolBoss.PoolBoss.Despawn (this.transform);
    13.  
    14.             //Debug.LogError (" Could not find position on NavMesh! " + gameObject.name + ", " + gameObject.transform.position.ToString());
    15.         }
    16.     }
    I've add it to this section in Update()
    Code (CSharp):
    1. //Controls looking angle based on non-combat or during combat
    2.                 if (AIAgentActive)
    3.                 {
    4.  
    5.                     if (!m_NavMeshAgent.isOnNavMesh)
    6.                         DoCheck();
    7.  
    8.  
    9.                     if (CombatStateRef == CombatState.NotActive)
    10.                     {
     
    combatsheep, SickaGames1 and magique like this.
  44. yarsrvenge

    yarsrvenge

    Joined:
    Jun 25, 2019
    Posts:
    87
    Interested in purchasing. It seems to cover a lot of what was looking for, but I may want some behaviors that were not obvious reading through the documentation. One example of this is having an enemy surrender versus running away. Whether they surrender or run away could be based on an RNG. Is this possible or at least can the library be extended to support or are you kind of locked into the behavior / temperament types?

    If there is a way to set an AI into a state through code overriding their current state after an external event happens maybe that would be a way to accomplish it.
     
  45. yarskiss

    yarskiss

    Joined:
    May 7, 2019
    Posts:
    5
    Masked Kobold... am I missing something - can't find prefab where I can change its settings just like in Guardian - ie. tags, movement, combat etc. There are some masks, shaders etc. in AI folder but not the one i'm looking for.
     
  46. yarskiss

    yarskiss

    Joined:
    May 7, 2019
    Posts:
    5
    OK, found it... you have to add it manually...

    But now I get msg after adding the component: "There is currently no Animator Controller for this AI". There is Kobold Contorller in the Inspector tab - so what does that msg mean?
    Furthermore I got Kobold to attack UFPS player but not the other way round. This works fine with Guardian though...
     
    Last edited: Oct 7, 2019
  47. marco-maceratesi

    marco-maceratesi

    Joined:
    Sep 20, 2013
    Posts:
    13
    Realistic FPS + Emerald AI 2.3.0.2 problem:
    When I shoot at an enemy before the enemy detect the player, the detected object is the weapon held or the bullet, causing the enemies to not damage player.
    For example M1911 or SHOTGUN...
    How can I prevent this strange behavior?
    Thanks in advance
     
  48. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    4,030
    @BHS I'm seeing an issue with the Equip Animations not working in this version. My AI was working correctly previously, but now when it equips the weapon, the weapon object does not turn on. I double checked that both the EnabeWeapon and DisableWeapon events are still there and the weapon object is set correctly. I'll check the code later, but you might be able to figure out what's wrong quicker.
     
  49. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,760
    Hey there. You should be able to import version 2.3.0.2 without having to remove Emerald AI from your project, but create a backup of your project just in case.
     
    combatsheep likes this.
  50. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,760
    Right underneath this:
    Code (CSharp):
    1. if (col.attachedRigidbody != null && !rigidbodies.Contains(col.attachedRigidbody))
    2. {
    3.    rigidbodies.Add(col.attachedRigidbody);
    4. }
    Add the following:
    Code (CSharp):
    1. if (col.gameObject.GetComponent<EmeraldAI.EmeraldAISystem>())
    2. {          
    3.    col.gameObject.GetComponent<EmeraldAI.EmeraldAISystem>().Damage(20, EmeraldAI.EmeraldAISystem.TargetType.Player);
    4. }
     
    FrostedBrain likes this.