Search Unity

[RELEASED] Emerald AI 2.2 - AAA Quality AI with Root Motion, Head Look, Ragdolls, Blocking, & more!

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

  1. ThePaceMaker

    ThePaceMaker

    Joined:
    Dec 18, 2016
    Posts:
    5
    Hey guys, tried messaging you and emailing you but no reply?
    I Have used Emerald many times and never had any issues really, absolutely love it!!. Im currently using invector integration all tutorials worked fine and I am on unity 2018 3.8. I have an issue upon using the setup manager where after I click setup AI at the end of the process I am getting prefab instances error, top of the code Is below, ive messaged you the full error, if you could possibly assist It would be appreciated.

    ArgumentException: UnpackPrefabInstance must be called with a Prefab instance.
    UnityEditor.PrefabUtility.UnpackPrefabInstance (UnityEngine.GameObject instanceRoot, UnityEditor.PrefabUnpackMode unpackMode, UnityEditor.InteractionMode action) (at C:/buildslave/unity/build/Editor/Mono/Prefabs/PrefabUtility.cs:1531)
    EmeraldAI.Utility.EmeraldAISetupManager.OnGUI () (at Assets/Emerald AI/Scripts/Editor/EmeraldAISetupManager.cs:155)
     
  2. unicat

    unicat

    Joined:
    Apr 8, 2012
    Posts:
    367
    Hi, my zombie ai sometimes looses his tag(from Flesh to Untagged) and layer(from NPCs to Default) in playmode. The most time it is, if he is fighting with another ai. Is this an emerald or unity issue ? Thanks.
     
  3. Dionysos1111

    Dionysos1111

    Joined:
    Feb 14, 2016
    Posts:
    38
    Hi,

    Is there en event to play PlayRunAttackSound()
    I would like to play another sound when the runattack is used then the normal attack sounds.
    Would also be nice if you can choose which sounds goes with which attack animation.
     
  4. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    3,585
    Thanks for providing a video. I will look into a solution to resolve this.
     
    SilverHelmStudios likes this.
  5. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    3,585
    I don't have an ETA for 2.3 yet.
     
  6. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    3,585
    This is most likely an API update with that version of Unity. I will look into this and when I find a solution, I will let you know how to resolve it.
     
    ThePaceMaker and Aphelion78 like this.
  7. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    3,585
    Emerald AI doesn't modify the AI's layer or tag and I have never seen this issue. The only thing it does modify is the Ragdoll's tags after the AI dies. What version of Unity and Emerald AI are you using?
     
  8. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    3,585
    There isn't a separate sound list for run attack sounds, but you could use a custom Animation event to do so for each run attack animation you have. You could also use the PlayRandomSoundEffect function to play a random sound from the AI's Interact Sounds list. When I get the chance, I can add additional functions to choose the index of the sound to allow users to choose which sound is played for each attack animation.
     
    SickaGamer likes this.
  9. unicat

    unicat

    Joined:
    Apr 8, 2012
    Posts:
    367
    Using Unity 2019.1.0f2 and the latest Emerald 2.2x. But i think it was in Unity 2018x too.
    Why i am the only one who has always such crazy things in Unity :)
     
  10. ThePaceMaker

    ThePaceMaker

    Joined:
    Dec 18, 2016
    Posts:
    5

    Thanks bud, much appreciated
     
    SickaGamer likes this.
  11. Aphelion78

    Aphelion78

    Joined:
    May 8, 2015
    Posts:
    7
    Hello folks!
    I'm trying to get Emerald AI and Invector TPC to work together. I've followed the integration tutorials but I can't seem to get the AI to interact with my character. Is there another tutorial someplace that goes into a bit more depth on how to properly set up the player and AI? I'm really running out of ideas. Thanks for reading!
     
  12. ThePaceMaker

    ThePaceMaker

    Joined:
    Dec 18, 2016
    Posts:
    5
    Once ive got the fix needed id be happy to help you out. Ive had success on other versions of unity just struggling with 2018. 2 key things to check is the tags and layers, emeralds setup pretty much does the rest for you
     
  13. kylewetton

    kylewetton

    Joined:
    Sep 6, 2018
    Posts:
    24
    Hey guys, my first post here. I've been having a lot of success with EAI so far, there is one thing I'm battling to get my head around however. My world scale is quite accurate with humans being approximately 1.7m tall.

    Any way, I'm battling with the settings Stopping Distance, Attack Distance and Too Close Distance

    What I'd ideally like, is for enemies to stop at approx 3 units from their target (player), and move in to attack, and then back off. If you imagine Assassins Creed enemies circling a player, all taking a turn (for the most part) to move 2 units in, attack and then back off into their circle, this is what I'm trying to achieve.

    Any ideas on how to achieve that behaviour from my enemy AI would be greatly appreciated.

    If stopping distance is any higher than attack distance, enemies attack in mid air and don't land damage to my player.

    Here's a video of what I've got so far, really early days yet.

    Thanks

     
  14. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    3,585
    I haven't found anything yet, but I will keep trying to see if I can recreate it. Are you using Emerald AI with any other asset that modify the layers and tags such as a complete project asset?
     
  15. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    3,585
    There really isn't too much that needs to be done other than ensuring the tags and layers are setup correctly and that you've made the necessary code changes. Also, ensure that AI Attacks Player set to Always. This setting is located under the Tag Options and controls whether or not an AI will attack a player on sight.
     
  16. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    3,585
    Hey there,

    I have scaled AI with many different scales and never encountered any issue related to distance detection. I did notice that your animations don't seem to be properly utilizing Root Motion. This is why your AI snap back after using their attack animation.This may be throwing off the distance detection. Also, make sure that your AI's damage Animation Events are timed correctly.

    There currently isn't direct way to have the AI attack and then move back. What you can do is have the too close distance trigger after your AI attacks which will cause them to backup after they attack.
     
  17. unicat

    unicat

    Joined:
    Apr 8, 2012
    Posts:
    367
    Only Emerald AI and RFPS in the Urban Underground Pack from the assetstore. Some spider and zombie models too.
     
  18. Aphelion78

    Aphelion78

    Joined:
    May 8, 2015
    Posts:
    7
    Well... I remade the scene and paid closer attention to the tags in the demo.. I *think* I know what I did different. Not 100% sure. The AI certainly sees my player now but no damage is being done. I added the animation events as instructed but the player still lives! We can't have that! Is there a script I should attach to the player?
     
  19. Room101_Studios

    Room101_Studios

    Joined:
    Apr 4, 2018
    Posts:
    5
    Any chance for uRPG or uMMORPG integration? This looks like wonderful kit. Reminds me of the old NPC Activities from Neverwinter Nights.
     
  20. Deckard_89

    Deckard_89

    Joined:
    Feb 4, 2016
    Posts:
    167
    How can we enable attached objects through animation events? I'm using the
    GameObject.SetActive function, but I'm not sure how to reference the actual game object. Does it have to be a prefab or can it just be a scene object?
     
  21. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    3,585
    Strange, there should be no reason for tags or layers resetting. Try setting the Ragdoll Tag to Flesh to see if this fixes your tag resetting problem.
     
  22. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    3,585
    Try positioning your SendEmeraldDamge Animation Events to the center of your AI's attack animation. If it works after doing this, it's a bug with Unity's animation blending/transitions, which can be fixed by decreasing the transition time to 0.1. If this doesn't work, try enabling all the Debug Log Mode options, located under Docs at the bottom, to see the exact target that's being detected as well as what object may be obstructing the AI's sight.
     
  23. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    3,585
    Yes, I have plans to integrate more assets such as uRPG and uMMORPG. These will be done through tutorial videos like I have done with the other integrations. I will be able to do this when I have finished the UniStorm 4.0 and Emerald 2.2.2 updates.
     
    Weblox likes this.
  24. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    3,585
    What specifically are you trying to enable? There's a system dedicated to enabling and disabling objects that are present on the AI (not through prefabs). This is done by attaching the object to the AI's Items list, located under AI's Settings>Items. When you've done this, create a unique numerical id and use the Animation Event EnableWeapon passing the item's id as the Animation Event parameter (in the example below it's 10). If you want to disable a weapon, you can do so doing the same thing, but using DisableWeapon.

    EnableWeaponEvent.png
     
    Deckard_89 likes this.
  25. unicat

    unicat

    Joined:
    Apr 8, 2012
    Posts:
    367
    There is no ragdoll tag, only an ignore ragdoll tag ?
     
  26. Deckard_89

    Deckard_89

    Joined:
    Feb 4, 2016
    Posts:
    167
    @BHS Got it, thanks.
     
  27. radiantboy

    radiantboy

    Joined:
    Nov 21, 2012
    Posts:
    806
    anyone able to get sound going on this yet? Been baffling me for weeks. I have the animation events etc, but the sounds simply dont work. Weird thing is if Im miles away I can hear them sometimes, its like the sound is being played in the distance, rather than from the enemy.
     
  28. combatsheep

    combatsheep

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

    I tried the script which you suggested and succeeded to change the tag.
    But the follower AI(companion) doesn't change its behavior.

    follow.jpg

    Do I need to edit something more script?

    Code (CSharp):
    1.  
    2.             if (isFollow)
    3.             {
    4.                 gameObject.GetComponent<EmeraldAI.EmeraldAISystem>().FollowTag = "Untagged";
    5.             }
    6.             else
    7.             {
    8.                 gameObject.GetComponent<EmeraldAI.EmeraldAISystem>().FollowTag = "Player";
    9.             }
    10.             isFollow = !(isFollow);
    11.  
     
  29. edub101

    edub101

    Joined:
    Jul 16, 2015
    Posts:
    18
    I'm thinking of purchasing Emerald AI. I see that the system can handle melee and ranged damage-type attacks, but what about other things, like a friendly NPC casting a healing spell on an injured ally? Or an AI selecting from different attack options based on an enemy's weakness (e.g. a wizard casts a fireball at an ice-golem, instead of attacking with his ice staff)? Or perhaps an AI selecting an enemy based on priority (e.g. A character might prioritize ranged attackers over melee, elves over humans, or the player over a player's companion)? In other works, can Emerald AI handle skills/spells/actions in addition to melee or ranged attacks?
     
  30. Deckard_89

    Deckard_89

    Joined:
    Feb 4, 2016
    Posts:
    167
    I am trying to test a scenario in which the Emerald AI is killed when the player enters a trigger. In the trigger I am calling the KillAI event. The AI successfully plays it's die animation, however when the animation is complete it reverts back to a T-pose. Is there something else I should do?
     
  31. jokers44life

    jokers44life

    Joined:
    Apr 13, 2018
    Posts:
    4
    Is it possible to have a AI that gathers? and did we get a good UCC integration yet?
     
  32. Troast

    Troast

    Joined:
    Mar 5, 2017
    Posts:
    11
    Hi, I fixed a bug in 2.2.1 where enemy attack sounds didn't come out. Need to place in AttackState() function of EmeraldAIBehaviors.cs.

    Code (CSharp):
    1. GetComponent<EmeraldAIEventsManager>().PlayAttackSound();
     
    radiantboy likes this.
  33. jaytwist28

    jaytwist28

    Joined:
    Jul 18, 2017
    Posts:
    38
    Hey, does 2.2 work with game kit controller? I know it was integrated in 2.0 but since things have changed a lot I was wondering if it was something that could still be easily done.
     
  34. Duffer123

    Duffer123

    Joined:
    May 24, 2015
    Posts:
    1,032
    @BHS ,

    What next for Emerald AI?
     
  35. radiantboy

    radiantboy

    Joined:
    Nov 21, 2012
    Posts:
    806
    Great man, can you tell me the exact line to add it to?
     
    combatsheep likes this.
  36. ZGoodwin

    ZGoodwin

    Joined:
    Jul 14, 2017
    Posts:
    23
    Apologizes for asking about the upcoming cover system when it may already be answered. Any news on it?
     
  37. SickaGamer

    SickaGamer

    Joined:
    Jan 15, 2018
    Posts:
    636
    Any new on integrating Malbers dragons
     
  38. MWray

    MWray

    Joined:
    Sep 27, 2018
    Posts:
    2
    I'm new to this forum, so please forgive me if I'm doing this wrong. I want to see if I can get some help figuring out why my animals no longer dynamicaly wander. I say no longer, because I had them wandering fine with Unity version 2018.2.17 and Emerald AI version 2.0, but now I've upgraded to Unity 2018.3.11 and Emerald AI 2.2 and none of the animals will dynamicaly wander. I have verified they are on the navmesh, so I don't believe that is the problem. Any suggestions for things to look at or try will be appreciated. I can send screen shots or setup details if necessary. Thanks.
     
  39. llJIMBOBll

    llJIMBOBll

    Joined:
    Aug 23, 2014
    Posts:
    552
    Code (CSharp):
    1. using UnityEngine;
    2. using EmeraldAI;
    3.  
    4.  
    5. public class Jims_AIAttackSound : MonoBehaviour
    6. {
    7.     public EmeraldAIEventsManager emeraldAIEventsManager;
    8.     public EmeraldAISystem emeraldAISystem;
    9.  
    10.    
    11.     void Start()
    12.     {
    13.         emeraldAIEventsManager = GetComponent<EmeraldAIEventsManager>();
    14.         emeraldAISystem = GetComponent<EmeraldAISystem>();
    15.         if(emeraldAIEventsManager == null)
    16.         return;
    17.          if(emeraldAISystem == null)
    18.         return;
    19.  
    20.         emeraldAISystem.OnAttackEvent.AddListener(PlayAttackSound);
    21.     }
    22.  
    23.     void PlayAttackSound()
    24.     {
    25.         if(emeraldAIEventsManager == null)
    26.         return;
    27.         emeraldAIEventsManager.PlayAttackSound();
    28.     }
    29. }
     
  40. kylewetton

    kylewetton

    Joined:
    Sep 6, 2018
    Posts:
    24
    Hey guys,

    I'd like some help debugging an issue I'm having with Emeralds animations and Root Motion.

    I've got my animations and AI character set up, if I use a clean animation controller with her walk animation, she walks correctly. The animation preview shows her walking correctly via root motion too. She walks perfectly using root motion without Emerald involved.

    When I use the animation via Emerald AI however,

    • With Auto Enable Animate Physics enabled, she walks very, very slowly, with her feet skating. If I increase animation speed, she walks the same speed, but the animation speed is increased (has no affect on her actual in-world movement speed).
    • With Auto Enable Animate Physics disabled she simply walks on the spot.
    I have Movement Type set to Root Motion.

    What do you suggest I check to make this work? My rig is directly from Mixamo (FBX for Unity), and so is the animation. Again though I've already checked that it isn't an issue by using a clean animator controller and can see the character with her current settings moving correctly in the animation I give her.



     
  41. Deckard_89

    Deckard_89

    Joined:
    Feb 4, 2016
    Posts:
    167
    The T-posing happens after the "Seconds to Disable" has expired. Also, if I choose Ragdoll on Death, it just T-poses then starts sinking into the ground o_O
     
  42. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    3,585
    The Ragdoll Tag is located under AI's Settings>Combat>Combat actions at the very bottom. It is only available when Death Type is set to Ragdoll, which I'm assuming you are using ragdolls, correct?
     
    Duffer123 likes this.
  43. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    3,585
    Have you adjusted the AudioSource settings at all? By default, they are set to a value that allows you to hear sounds from about 50 units away. Try adjusting these to see if you can get them working. Also, how did you setup your AI? An AI is supposed to have 3 AudioSources. 2 of them are applied on start and use the settings from the first one.
     
  44. Deckard_89

    Deckard_89

    Joined:
    Feb 4, 2016
    Posts:
    167
    @BHS Turns out it is Final IK that is causing the weird T-Posing thing. It's important though, even if it's just grounder for foot placement. Is there some integration instruction I have missed to allow Final IK on Emerald characters, and if not do you plan to include it at some point?
     
  45. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    3,585
    You may need to clear the AI's target too as it still most likely has a reference to it. When you want to clear the target, use YourEmeraldAIComponent.CurrentFollowTarget = null; this should allow the AI to go back to its default state.
     
    combatsheep likes this.
  46. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    3,585
    Interesting, I haven't had any issues with Final IK. Here's a video tutorial on how to get it working:
     
    Deckard_89 likes this.
  47. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    3,585
    These features are not currently possible, however, with the 2.3 update, I will be redoing the way attacks are handled. This will make all attacks into abilities using scriptable objects that users can customize, which includes the ability to heal. I haven't thought about weaknesses, but I can certainly look into it while developing the abilities system.
     
  48. SickaGamer

    SickaGamer

    Joined:
    Jan 15, 2018
    Posts:
    636
    Almost done with your Unistorm and 2.2.2? Really looking forward to 2.3!
     
  49. Deckard_89

    Deckard_89

    Joined:
    Feb 4, 2016
    Posts:
    167
    Ah, that's it I think. All working now, thanks a lot.
     
  50. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    3,585
    Not currently, but I can look into this feature for a future update. Not yet with UCC, I never received a response from the developer. I don't have a copy of UCC so there's no way I can make a tutorial for it until I do.