Search Unity

  1. Calling all beginners! Join the FPS Beginners Mods Challenge until December 13.
    Dismiss Notice
  2. It's Cyber Week at the Asset Store!
    Dismiss Notice

[ON SALE - 50% OFF!] Emerald AI 2.3 - The Ultimate Universal AAA Quality AI Solution

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

  1. huntersteeger

    huntersteeger

    Joined:
    Dec 27, 2017
    Posts:
    19
    Hey man! I'm trying to figure out a way to make an AI agent turn towards the player when starting a conversation. Any way I can do this? Been playing around with the API haven't really found a good solution.
     
  2. AdminArdagor

    AdminArdagor

    Joined:
    Feb 6, 2018
    Posts:
    13
    Hi BHS, I wanted to know when the update for Emerald with an increased number of animations will be released?
     
    SickaGamer likes this.
  3. huntersteeger

    huntersteeger

    Joined:
    Dec 27, 2017
    Posts:
    19
    Also, just an idea for a small feature, I think an event when an AI kills its target would be an awesome way to add some functionality!
     
  4. unity_7UFP4-iCkwsgjg

    unity_7UFP4-iCkwsgjg

    Joined:
    Dec 13, 2017
    Posts:
    285
    would emerald ai work with sleepless footprints asset?
     
  5. wood333

    wood333

    Joined:
    May 9, 2015
    Posts:
    651
    My Emerald AI deer roams until encountering a couple of benches around a campfire, where it gets stuck. I placed a capsule nav obstacle around the area, but the deer still gets stuck attempting to reach a point inside the nav mesh obstacle. Can I create an AI exclusion zone or something to solve this?
     
  6. mattis89

    mattis89

    Joined:
    Jan 10, 2017
    Posts:
    1,079
    Hello! @BHS Is Astar A* pathfinding project supported?
     
    wood333 likes this.
  7. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,045
    Hey there! There isn't currently a built-in way to do this, but I plan on adding some API soon that will allow you to do so.
     
    huntersteeger likes this.
  8. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,045
    I'm working on one more update that will fix the remaining minor issues and add a new character controller system. After this, I will work on the update that will add more animations.
     
  9. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,045
    I totally agree. I'll be sure to add this with the next update.
     
    huntersteeger likes this.
  10. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,045
    I haven't tested it, but it sounds like you should be able to add footprints with an Animation Event on your AI's walking or running animations.
     
  11. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,045
    The AI shouldn't pick waypoints that it can't reach because it uses the same position API to ensure the generated point is on NavMesh before assigning it. Try searching for the line NavMesh.SamplePosition(NewDestination, out hit, 4, 1) in the EmeraldAISystem script. Try adjusting the 4 value higher to see if it allows the generated waypoint to be better placed.
     
  12. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,045
    Not yet, but I plan on adding support at some point.
     
    hoodoo and mattis89 like this.
  13. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    9,868
    If you're using the Dialogue System for Unity, try this in the Sequence field of the NPC's first node:
    {{default}}; LookAt(listener)
     
    huntersteeger and ZGoodwin like this.
  14. dejoshua1

    dejoshua1

    Joined:
    May 22, 2018
    Posts:
    18
    Hi, im usin urpg and I got the emerald ai to damage the player by following the docs but I cant get the player to damage the ai. I tried

    if (other.gameObject.tag == ("Enemy"))
    {

    other.gameObject.GetComponent<EmeraldAISystem>().Damage(damage, EmeraldAISystem.TargetType.Player, transform);
    }
    but no luck
     
  15. dejoshua1

    dejoshua1

    Joined:
    May 22, 2018
    Posts:
    18
    Nevemind this helped

    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.
     
  16. zKici

    zKici

    Joined:
    Feb 12, 2014
    Posts:
    223
    Right, but what I was referring to is other events for example the one I have to put on the animation for cast spell such as: EmeraldAttackEvent

    What other events are there.
     
  17. zKici

    zKici

    Joined:
    Feb 12, 2014
    Posts:
    223
    Same issue here.
     
  18. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    3,676
    If anyone is interested in Playmaker integration, here is my initial set of Playmaker actions for EmeraldAI. I haven't fully tested this so please consider it an Alpha version. I don't know yet if I'll do any more work on this. It depends on if anyone uses it and if there are more requested actions.

    I recommend extracting the files into the EmeraldAI folder, but you can put it anywhere in your project if you want.
     

    Attached Files:

  19. zKici

    zKici

    Joined:
    Feb 12, 2014
    Posts:
    223
    Thank you
     
    magique likes this.
  20. pjccccc

    pjccccc

    Joined:
    Oct 7, 2015
    Posts:
    43
    My characters fight each other even they have same faction value.
    The faction values are controlled by script, please see code below.

    Did I miss something?

    upload_2019-11-3_21-27-3.png
    upload_2019-11-3_21-27-39.png
     
  21. bholland

    bholland

    Joined:
    Mar 24, 2017
    Posts:
    13
    First of all, great asset, I've been making my through it and getting it to work with the Opsive UCC. So far I have gotten everything to work, I can damage the EmeraldAI, they can damage me, and they can damage each other. But, when I set the Emerald AI "characters" up for ranged, it is like they are shooting into a wall, none of there projectiles moves past the transform, whether they are shooting at the Opsive character or each other, the projectile acts like it hits some kind of collider. I'm using Emerald 2.3. I've tried removing everything in the scene but it doesn't seem to help. Any ideas?
     
  22. Nitrox32

    Nitrox32

    Joined:
    May 9, 2017
    Posts:
    94
    I have an AI character that is not attacking my player. The AI detects the player, turns, then runs toward the player but when he reaches the player it goes out of combat mode and continues walking and pushing my player as if it were simply blocking its path to the the next way point. I have other AI characters that are set up the same way and they are attacking the player. This is just a different model.
     
  23. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,045
    Most of the events listed in the docs can be called with an Animation Event. They aren't just limited to calling them through code.

    Relevant animation specific events are the follow:

    Plays a idle sound when called (This can also be done automatically within the Sounds tab)
    PlayIdleSound

    Plays a walk sound when called

    WalkFootstepSound

    Plays a run sound when called
    RunFootstepSound

    Plays an attack sound when called
    PlayAttackSound

    Plays a warning sound when called
    PlayWarningSound

    Enables the AI's Weapon Object
    EnableWeapon(string WeaponTypeToEnable)

    Disables the AI's Weapon Object
    DisableWeapon(string WeaponTypeToDisable)
     
    zKici likes this.
  24. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,045
    I'll look into the issue with the projectiles firing too low.
     
  25. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,045
    When is this being called? Is there enough time for the Emerald AI system to be initialized? There's a possibility that Emerald AI is overriding the faction modifications, if your script is called first.
     
  26. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,045
    Very strange, this is the first time I've heard of this issue. My guess is that the AI's Box Colliders on your AI may been generated too big. Try adjusting them to fit within your AI's mesh. Also, ensure that your Ranged Transform is properly assigned to where you want the projectiles to spawn from.

    If you're still having issues, a video of the problem would better help me understand what's happening.
     
  27. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,045
    What's this AI's Distance Type (Located under the Detection Options) set to? If it's set to Starting Distance, the max distance may be being exceeded making the AI return to its starting position and exiting out of combat mode. Try using the Target Distance or increasing the Chase Distance to see if it resolves the problem.
     
  28. SickaGamer

    SickaGamer

    Joined:
    Jan 15, 2018
    Posts:
    823
    Since you stated that your updates are not going to be as huge but smaller and more often, any idea when the next update comes out?
     
  29. Nitrox32

    Nitrox32

    Joined:
    May 9, 2017
    Posts:
    94
    Actually, after observing the behavior, it's not that it isn't finding the player. It is actually finding the player and attacking and will continue attacking and locking onto my player as expected. It's only after I land a successful attack that the enemy will simply ignore me and just keep walking and pushing me to where ever it wants to go.
     
  30. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,045
    I'm hoping no more than a couple of weeks.

    I'm just about finished with a new demo character controller system for a much more polished player combat example. The current one is a bit..dated. I'm also working on a brand new "Combat Text System" that will work globally for all AI and even players with customizable text colors, fonts, animation types, and more all controllable through the Combat Text Manager. Best of all, it uses Unity's UI system and no longer uses the outdated Text Mesh component. I'll be making a status update on all of this sometime tomorrow. :)
     
    SickaGamer likes this.
  31. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,045
    What parameters are you passing when damaging the AI? If you are using:
    Code (CSharp):
    1. Damage (int DamageAmount, TargetType? TypeOfTarget = null, Transform AttackerTransform = null, int RagdollForce = 100)
    Ensure that you are also passing the AttackerTransform or the AI may be getting a null target which could make it lose its reference to your player.
     
  32. Nitrox32

    Nitrox32

    Joined:
    May 9, 2017
    Posts:
    94
    Honestly, I'm not sure. I'm not much of a coder, I just used the steps provided by the Invector AI integration tutorial by BHS. Where would I find the code you referenced and how would I check?
     
  33. MattyZuZu

    MattyZuZu

    Joined:
    Jun 2, 2019
    Posts:
    5
    I’m encountering 2 problems with an AI agent in my game - possibly related:

    1. I have an enemy using waypoints and he works fine until he sees the player Once the player is detected, the AI has omniscience and is able to find the player no matter where he hides. Is this a layer issue? Is the agent seeing through walls, etc. because they’re on a different layer? I selected "water" for the layer as that is what is in the tutorial video.

    2. The second issue is that the enemy will follow the player for a while and then stop moving apart from to face the player (no matter where the player is on the level, the AI will turn to face him).

    (You guys need a proper forum instead of an 89 page thread!)
     
  34. Nitrox32

    Nitrox32

    Joined:
    May 9, 2017
    Posts:
    94
    Indeed!
     
  35. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    3,676
    Or Discord
     
  36. Low_on_Mana

    Low_on_Mana

    Joined:
    Jun 18, 2018
    Posts:
    28
    I'm sorry if this has been brought up before, but I'm experiencing an issue in which when given a destination, the AI moves to it, but stops close by. Is there a stop distance number I can set programmatically so that they stop exactly at the destination in certain scenarios?

    I also noticed something similar for combat. AI will go only as close as they need to be to reach with melee, but if something is walking away from them, they will have issues keeping up because they'll approach it, attack as it walks away, and repeat the process until the target stops long enough to be hit. Can the attack range be set to a distance larger than the "combat range" as it were?
     
    Last edited: Nov 5, 2019
  37. wood333

    wood333

    Joined:
    May 9, 2015
    Posts:
    651
    I have a sound issue. I set up an Emerald Ai animal with an idle sound. The sound plays, but it doesn't come from the animal, it sounds the same whether I am near the animal or far away.
     
  38. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    3,676
    Make sure the AudioSource is set to 3D spatial blend. And set your Max distance as well.
     
  39. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    3,676
    @BHS I have a request for next update. I'm working on integrating EmeraldAI with ORK and am planning to have EmeraldAI handle all the locomotion, enemy detection, etc, but have ORK drive the actual attacks so that I can be more specific in having the AI attack a certain way or cast a spell, or use an item, etc.

    The problem I have is that even though I removed all Attack animations from Emerald, it still tries to initiate an attack. The code randomizes attack index so that it is never less than 1 no matter what. Even if I change TotalAttackAnimations to 0 in code, the attack randomizer still runs and tries to perform an attack.

    At a minimum, I would like to see a fix where if TotalAttackAnimations is set to 0 in code that the attacking code would not run. Ideally, this would still work even if there are actually 5 attack animations in the list. That way, I could duplicate the attacking code and pick specific attacks and drive them from my own code. Another possibility is to simply have some flag that specifies whether attacks are driven by Emerald AI and instead of checking the TotalAttackAnimations it would check to see if EmeraldAI is in charge or not. Maybe call the flag something like EmeraldControlsAttacks and default to true.
     
  40. wood333

    wood333

    Joined:
    May 9, 2015
    Posts:
    651
    Spacial Blend is full 3D and I am adjusting the Max distance, etc. It's getting better. Thanks for the tips.:)
     
    magique likes this.
  41. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,045
    The Invector integration tutorial passes the Invector player when damaging an AI so I'm not sure why the AI would lose the target reference. Did you setup your layers and tags correctly?

    API and a damage example can be found here: https://docs.google.com/document/d/...2njM7Jx9pYlqgbtM8/edit#heading=h.ocdxmxz2k2sx
     
  42. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,045
    1) Are you using the Trigger or Line of Sight Detection Type (located under the Detection Options)? The Line of Sight feature will only target a target if it is unobstructed, whereas the Trigger type ignores this. Ensure that you are using the Line of Sight Detection Type.
    2) Are you receiving any errors when this happens? This is the first time I've heard of this issue.

    If you want an additional support method, Discord is a great alternative: https://discord.gg/XpWYzjp
     
  43. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,045
    If you want to manually set the stopping distance for an AI, you can use:
    Code (CSharp):
    1. YourEmeraldAISystemReference.StoppingDistance
    However, setting the AI's Stopping Distance to the minimum amount of 0.25 should allow the AI to stop right on its destination.

    As for the combat stopping distance, this is needed or the AI would walk right on their target's position. The reason the AI attacks right when it arrives to the target's position is working as intended, but this depends on the game and combat type. To remove this feature, find the following line and comment it out (located in the EmeraldAIBehavior script). I will add an option to enable or disable this with the next version.
    Code (CSharp):
    1. EmeraldComponent.AttackTimer = EmeraldComponent.AttackSpeed-0.25f
     
    Last edited: Nov 6, 2019
  44. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,045
    Have you tried stopping the AttackState function from being called in the EmeraldAIBehavior script? AttackState(); is located twice within said script and handles the is responsible for triggered all attacks. Commenting them out should work. I can look into a better solution for this as you've mentioned though.
     
  45. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    3,676
    Oh, yeah, I had no problem fixing the code to do it myself. I just thought a solution on your end would be best so future updates wouldn't need code changes again.
     
  46. pccross

    pccross

    Joined:
    Jun 20, 2015
    Posts:
    93
    Has anyone used Final IK with EAI, and if so how difficult was it to integrate the two?
    I can't seem to get the EAI ranged gun combat on my enemy character to look realistic. This is a VR project, so may be more glaring when there are small offsets, but I find my enemy always seems to be aiming its gun a bit too far left or right of the player.
    It seems Final IK has AIMIK which appears to streamline this aiming aspect greatly, but given its steep price tag, want to make sure it won't cause issues on my existing EAI setup.
     
  47. MattyZuZu

    MattyZuZu

    Joined:
    Jun 2, 2019
    Posts:
    5
    Thanks for the reply. Yes, I have detection set to "Line of Sight." The Obstruction Ignore Layers is set to "Ignore Raycast" and under Tag Options the detection layer are set to "Default" and "TransparentFX."
     
  48. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,045
    Gotcha. It shouldn't be a problem to add something like this. My only concern is it possibly confusing other users. Maybe I will make it more of a hidden option.
     
  49. magique

    magique

    Joined:
    May 2, 2014
    Posts:
    3,676
    Yeah, I was going to suggest that as well. If you make it public, but don't expose in the editor than it can be accessed in code, but no one will even know it's there and they can't accidentally turn it off.
     
  50. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,045
    If your AI's aiming is off (which I'm assuming you are using the Head Look feature), try using a "dummy" object as the player instead of the actual VR player to ensure the AI are aiming at the right position.

    Final IK is supported and I've made an integration tutorial for it. However, this only covers the foot IK and not the aiming.