Search Unity

  1. Looking for a job or to hire someone for a project? Check out the re-opened job forums.
    Dismiss Notice
  2. Unity 2020 LTS & Unity 2021.1 have been released.
    Dismiss Notice
  3. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice

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

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

  1. gearedgeek

    gearedgeek

    Joined:
    Jun 19, 2015
    Posts:
    213
    Code (CSharp):
    1. IndexOutOfRangeException: Index was outside the bounds of the array.
    2. EmeraldAI.EmeraldAISystem.Update () (at Assets/Emerald AI/Scripts/System/EmeraldAISystem.cs:1029)
    Any ideas about this?

    This error appears when the AI starts to attack the player after being spawned with Core GameKit poolboss spawner.
     
    Last edited: Mar 3, 2021
  2. LaCorbiere

    LaCorbiere

    Joined:
    Nov 11, 2018
    Posts:
    26
    Hello. What would be the best way to approach damaging a Emerald AI NPC with a VR weapon such as a sword? I guess I'm looking for a VR version of 'DamageAISystem'. Thank you.
     
  3. SickaGamer

    SickaGamer

    Joined:
    Jan 15, 2018
    Posts:
    1,063
    @BHS when is the new update?
     
    LaCorbiere and Jakub_Machowski like this.
  4. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,394
    This may be because the animation is a Root Motion animation and you do not have Root Motion enabled. To do so, see this part of the Emerald AI Wiki: https://github.com/Black-Horizon-Studios/Emerald-AI/wiki/Setting-up-an-AI's-Animations#step-6
     
  5. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,394
    Wander Range or Chase Distance/Detection Distance?

    Typically, AI continuously chase the player until the chase distance condition has been met. AI do have the ability to chase up until a certain distance from their starting position before they return back to their starting destination. If you want an AI to protect a given area and not go outside of that (maybe wait along the max chase distance area), I can look into adding this as a feature.

    I'm not entirely sure what you are asking in regards to the optimization feature. If you have sections that you would like to have control of when AI are disabled, and you don't want to use the built-in optimization feature, you can simply disable the AI's root game object to disable the AI. When you enable it again, the AI will resume functioning as it did before it was disabled. If your AI have LODs, Emerald AI's optimization feature also handles this by disabling AI who have their last level of detail culled so it's more distance based that camera direction based. However, I believe LOD renderers are also considered culled if they are no longer visible by any camera source.
     
  6. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,394
    I will look into this. I plan on releasing the next update soon and will provide a fix with it if I can recreate the issue.
     
  7. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,394
    The error is related to the backup feature. Try setting the Backup Type to Off (located under AI's Settings>Combat>Combat Actions)
     
  8. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,394
    I will be adding more tutorials to the Emerald AI Wiki when I get the chance.

    How are you using the one-handed and two-handed animations? Melee and ranged attacks? Monsters that are attacking with one or both hands? If I had a little more info, I would be more than happy to put together a tutorial for you.
     
  9. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,394
    Yes, the needs system is mainly used an example that can be modified as needed. It supports 1 need.

    The Wander function within the EmeraldAISystem script is responsible for all movement outside of combat. You could modify this to just enable your custom task mechanics or remove the code within it. When the AI engages in combat, the Wander function is no longer called. You may need to use something like an OnStartCombatEvent to disable your task mechanics so they don't interfere while the AI is in combat.
     
    Ntotor likes this.
  10. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,394
    It looks like the AI needs to be reinitialized. Add this script to your AI and it should reinitialized each time it is re-enabled.
     

    Attached Files:

  11. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,394
    Damaging an AI can be done however you want. You just need a reference to the AI hit and then call the AI's damage function. This is explained here: https://github.com/Black-Horizon-Studios/Emerald-AI/wiki/Emerald-AI-API#damaging-an-ai
     
    LaCorbiere likes this.
  12. Bioman75

    Bioman75

    Joined:
    Oct 31, 2014
    Posts:
    67
  13. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,394
    Hey everyone,

    The location based damage update is just about done and I will be submitting it by the end of the week.

    Below is the location based damage component. I decided on making this an external script rather than including it within the Emerald AI Editor to make updates easier and to keep the Emerald AI editor as it is.

    The LBD component will grab all colliders within an AI and allow users to edit their damage multipliers. For example, a value of 1 would apply no change to the damage received to the hit collider and a value of 5 would apply 5x the amount of damage received to the hit collider. Values less than 1 can also be used to provide reduced damage or immunity to certain portions of the AI.

    To damage an AI with LBD, users can use the following code. The DamageArea function has the same parameters as Emerald AI's damage function. All you need is a reference to the collider hit and a reference to the collider's LocationBasedDamageArea script. This of course could be simplified by checking layers or tags.
    Code (CSharp):
    1. if (hit.collider.GetComponent<LocationBasedDamageArea>())
    2.                     {
    3.                         hit.collider.GetComponent<LocationBasedDamageArea>().DamageArea(DamageAmount, EmeraldAISystem.TargetType.Player, PlayerObject.transform, 400);
    4.                     }
    Hit effects from the AI's Hit Effects list (Located under AI's Settings>Combat>Hit Effect) will automatically be used when damaging a Location Based Damage Area and calling the CreateImpactEffect function and sending the position you want the effect to happen at.

    Code (CSharp):
    1. hit.collider.GetComponent<EmeraldAI.LocationBasedDamageArea>().CreateImpactEffect(hit.point);
    LocationBasedDamage.png
     
    llJIMBOBll, julianr, mattis89 and 3 others like this.
  14. SickaGamer

    SickaGamer

    Joined:
    Jan 15, 2018
    Posts:
    1,063
    Once the location based damaged scripts is completed do you know what your next update is going to be? I thought a while back you were going to do something with utility type of AI animations (ie sit on stool) ect..
     
  15. gearedgeek

    gearedgeek

    Joined:
    Jun 19, 2015
    Posts:
    213
    Unfortunately now with that script added to the AI I'm getting this new error. The scene isn't fully loaded before this error appears.

    Code (CSharp):
    1. NullReferenceException: Object reference not set to an instance of an object
    2. EmeraldAI.EmeraldAIBehaviors.DefaultState () (at Assets/Emerald AI/Scripts/Components/EmeraldAIBehaviors.cs:532)
    3. EmeraldAI.EmeraldAIEventsManager.ResetAI () (at Assets/Emerald AI/Scripts/Components/EmeraldAIEventsManager.cs:1551)
    4. ResetAI.OnEnable () (at Assets/Custom/ResetAI.cs:10)
    5. UnityEngine.Object:Instantiate(Transform, Vector3, Quaternion)
    6. DarkTonic.CoreGameKit.PoolBoss:InstantiateForPool(Transform, Int32) (at Assets/Plugins/DarkTonic/CoreGameKit/Scripts/PoolBoss/PoolBoss.cs:341)
    7. DarkTonic.CoreGameKit.PoolBoss:FillItemPool(PoolBossItem, Transform, Action) (at Assets/Plugins/DarkTonic/CoreGameKit/Scripts/PoolBoss/PoolBoss.cs:612)
    8. DarkTonic.CoreGameKit.PoolBoss:CreatePoolItemClones(PoolBossItem, Boolean, Action) (at Assets/Plugins/DarkTonic/CoreGameKit/Scripts/PoolBoss/PoolBoss.cs:561)
    9. DarkTonic.CoreGameKit.PoolBoss:ContinueInit() (at Assets/Plugins/DarkTonic/CoreGameKit/Scripts/PoolBoss/PoolBoss.cs:299)
    10. DarkTonic.CoreGameKit.PoolBoss:Initialize() (at Assets/Plugins/DarkTonic/CoreGameKit/Scripts/PoolBoss/PoolBoss.cs:265)
    11. DarkTonic.CoreGameKit.PoolBoss:Awake() (at Assets/Plugins/DarkTonic/CoreGameKit/Scripts/PoolBoss/PoolBoss.cs:166)
    12.  
     
  16. bsimser

    bsimser

    Joined:
    Sep 8, 2014
    Posts:
    65
    Hi there,

    The animations are both melee for the same character but the animations I have are both a one-handed attack (enemy with one-handed sword) and two-handed (same enemy, two-handed sword). I haven't seen any way to invoke one melee animation vs. another. I guess this could be done in a similar fashion to melee vs. ranged (like a spell) so I'll look into that but any insight on how to keep them separate would be appreciated.

    Thanks!
     
  17. Jakub_Machowski

    Jakub_Machowski

    Joined:
    Mar 19, 2013
    Posts:
    473
    Thanks for reply This is main Thing we are waiting to fix. Any estimated date of update with fix? Would be good to know. By the way below I'm sending You how we set the destination point of characters (Maybe it will help in debuging reached destination fired to early event problem)

    upload_2021-3-4_13-15-14.png

    Also One more questions it seems like sometimes there is situation When AI is chasing player/ or attack, it is in some point where Its head look at goes crazy, I noticed that AI stops attacking then,(Probablysomething with chase and detextion distance) Our settings are like this: upload_2021-3-4_13-11-3.png
     
  18. LaCorbiere

    LaCorbiere

    Joined:
    Nov 11, 2018
    Posts:
    26
    Awesome addition thank you. In the future, will it have the capacity to trigger hit animations based on the impact location?
     
  19. Mrmisklanius

    Mrmisklanius

    Joined:
    Dec 11, 2019
    Posts:
    15
    I'm having an issue with animations. I applied the animations that came with the package to an UMA character as I'm testing to get NPC's to function. after everything is applied and done, I check for animations missing and it tells me I'm missing the walk/run animations and the ranged walk/run animations. But the issue is that they're applied. I'm also getting the error mentioned a few days ago but the Reset script fixes it when i disable/reenable it whenever the error appears.

    I'm also having a huge lag spike when Animator.ProcessGraph is called. It drops my fps to nearly 0 sometimes and jumps the Time ms to 185+. The highest that has gotten was 2k+ ms. I'm not sure how to fix the issue as I'm a noob in the animation department of unity and google yields 0 help. The most I've gotten is a thread from 5 years ago that ends in a "huh, idk". For what it's worth, I've tried both root motion and navmesh and both cause the spike, navmesh being the perpetrator of the 2k+ spike.

    The walk animation seems to warp my UMA character's legs, but root motion movement still works. I'm wondering if that may be causing the Animator.ProcessGraph to take so long to process but honestly I have absolutely no clue if that's the case.

    Any help or pointer in the right direction would be much appreciated.
     
  20. mattis89

    mattis89

    Joined:
    Jan 10, 2017
    Posts:
    1,125
    Any ETA on the update?
     
  21. Jakub_Machowski

    Jakub_Machowski

    Joined:
    Mar 19, 2013
    Posts:
    473
    Yes It would be good to know, Hopefully We wont need to wait next 2 weeks for reply about that :)
     
    mattis89 likes this.
  22. SickaGamer

    SickaGamer

    Joined:
    Jan 15, 2018
    Posts:
    1,063
    @BHS is everything ok Will? You used to do a lot more updates over the past few years and it has seemed to slow down a bit. I was really hoping for the flying AI asset you were talking about as well as more AI utilities such as sitting ect..
     
  23. paulojsam

    paulojsam

    Joined:
    Jul 2, 2012
    Posts:
    506
    sorry if this is a dumb question, how do emerald ai works regarding sound detection?
     
  24. mattis89

    mattis89

    Joined:
    Jan 10, 2017
    Posts:
    1,125
    It don't have it
     
  25. SuperNewbee

    SuperNewbee

    Joined:
    Jun 2, 2012
    Posts:
    189
    Hello. I am thinking of purchasing this asset. Can anybody tell me if this asset can use 100% root motion for rotation?

    ie: no foot sliding when I run in circles around NPC. NPC should use the proper turn in place animation to stay oriented correctly.
     
  26. mattis89

    mattis89

    Joined:
    Jan 10, 2017
    Posts:
    1,125
    Yes that is achieveable
     
  27. mattis89

    mattis89

    Joined:
    Jan 10, 2017
    Posts:
    1,125
    If anyone is running into issues PM me for help, I also do more complicated consultant work.
     
  28. RazT

    RazT

    Joined:
    Feb 7, 2019
    Posts:
    6
    Hello fellow Devs and Emerald Creator <3

    I followed the 'Emerald AI Tutorial - Setting up your AI'
    all work great!

    Question: is there a way to suddenly disable emerald AI -> I have AI characters, which I want to take control on. Basically do a switch between Emerald A and my controllable character.

    Problem: have to switch between animation controllers

    I noticed, as soon as I disable the Emarald AI script following:
    1) if destinations is set the character stopps animating
    2) if destination is reached IDLE anim kicks in ant then I can cuccessfully disable the script and it animated ok (idle runs)
     
  29. SickaGamer

    SickaGamer

    Joined:
    Jan 15, 2018
    Posts:
    1,063
    Has anyone else had these type of issues when switch from melee to ranged with their AI? Still time to fix it now that your update still isn't out! TY!
     
    Last edited: Mar 9, 2021
  30. Jakub_Machowski

    Jakub_Machowski

    Joined:
    Mar 19, 2013
    Posts:
    473
    @BHS I saw an update Destination Reached event fired to early still didn't fixed... When We could get the fix? But really, cause this is like the base feature of system and it don't work. If We cant check where Ai actually is like a huge limitation, let us know When It could be fixed, We really cant wait another 2 weeks for reply.
     
    Last edited: Mar 9, 2021
  31. J_Grams

    J_Grams

    Joined:
    Oct 29, 2020
    Posts:
    2
    Howdy folks,
    I'm trying to get the damage ai by collision script to work on my arcade racing game. No luck so far. I haven't found a tutorial on it yet. I'm wondering if anybody knows exactly what are the prerequisites for this to work or where a tutorial might be, or if there are issues that would make this not work.
     
  32. Mrmisklanius

    Mrmisklanius

    Joined:
    Dec 11, 2019
    Posts:
    15
    Emerald AI has a function/event called OnTakeDamage().

    You could have the other entity send a message (SendMessage()) with the damage float / int attached to it. Then in the inspector add a trigger (using OnTakeDamage) that subtracts your health by that float / int amount.

    Or, you could have it send a message containing itself as a GameObject, then in the inspector you can call the other entities damage property. Though honestly that sounds messy so I'd go with the first option to try.

    EDIT: I'm dumb, there's an OnDoDamage event too. So just tell that to activate OnTakeDamage on your player/whatever is taking damage. I'm sure if you look those functions/events up in the Emerald AI documentation, It'll show you how to use them properly. Personally I like the Github documentation the most, so you could look there.
     
  33. mattis89

    mattis89

    Joined:
    Jan 10, 2017
    Posts:
    1,125
    @BHS where you at?
     
  34. J_Grams

    J_Grams

    Joined:
    Oct 29, 2020
    Posts:
    2
    Thanks for the reply. I'll start investigating when I get home from work. I'm pretty new to all this so it looks like I've got some studying to do!
     
    Mrmisklanius likes this.
  35. Jakub_Machowski

    Jakub_Machowski

    Joined:
    Mar 19, 2013
    Posts:
    473
    @BHS tested on Reach destination event with Debug Log and its just fired to early, It seems like it happends when there is for example 10 prefabs of ai on scene and You change destination type from dynamic wander, and then set destination point for example for 6-7AIs.
     
  36. Jakub_Machowski

    Jakub_Machowski

    Joined:
    Mar 19, 2013
    Posts:
    473
    @BHS I found the problem, If You turn on object avoidance and set layer to AI emerald for Your ai to avoid other ais, then On Reach destination event is fired to Early :) Please fix that

    upload_2021-3-11_12-19-36.png
     
    mattis89 likes this.
  37. Mrmisklanius

    Mrmisklanius

    Joined:
    Dec 11, 2019
    Posts:
    15
    At this point, I'd just fix it myself for now if I were you. Can you set waypoints to be something other than the AIEmerald layer? Maybe it's triggering when your AI "sees" the waypoint. It could be messing it up by using the AIEmerald layer. Maybe an Obstacle layer would work?
     
  38. mattis89

    mattis89

    Joined:
    Jan 10, 2017
    Posts:
    1,125
    That work but AI run into each other
     
  39. Mrmisklanius

    Mrmisklanius

    Joined:
    Dec 11, 2019
    Posts:
    15
    Maybe you could trick the system by enabling the AIEmerald layer to interact with the Obstacle layer? Or try and have Other AI be counted as obstacles? but that may cause the problem again. Maybe try to get it to look for two different kinds of avoidances? I haven't used the waypoint system yet so I'm mostly guessing. I'm having enough trouble with the animation side of things.
     
  40. Mrmisklanius

    Mrmisklanius

    Joined:
    Dec 11, 2019
    Posts:
    15
    Has anyone had the problem of the AI Hit Transform object replacing other child gameobjects?

    EDIT 1: I don't even have access to the Hit Transform option in my AI settings like the Docs say i should. This hasn't been an issue until i got animations working right. It's replacing my UMArenderer which is pretty important.

    EDIT 2: I figured it out, the AI Hit Transform replaces items if there's less than 3 children on the AI it seems. If there's more than 3 or just 3, it doesn't replace anything. Weird effect but at least the problem is solved.
     
    Last edited: Mar 12, 2021
  41. Revelation_Jeff

    Revelation_Jeff

    Joined:
    Jul 17, 2012
    Posts:
    137
    Hello! I'm having an issue with root motion movement. It appears a speed modifier is still used in "Run mode" for in and out of combat movement animations which creates skating behavior out of sync with the root motion. Is this expected behavior or is this an oversight? Shouldn't those modifiers disable while using root motion mode?

    Both AI in this video are using the same animation, speed, root motion and the only difference is one is set to walk mode and one is set to run mode. Any suggestions would be appreciated!

     
  42. Mrmisklanius

    Mrmisklanius

    Joined:
    Dec 11, 2019
    Posts:
    15
    Try copying the walk animation to a new one and speeding it up? That'd be easier than making a whole new one.

    And honestly, from what I've learned, all root motion does is maintain the objects movement positions so it doesn't reset every time the animation loops. I'm not surprised to see a speed modifier. Thinking as a dev, I wouldn't assume everyone would be automatically using different animation speeds for walk and run. You could try hunting down the speed modifier in the code and deleting it or commenting it out.
     
  43. dyrwoolf

    dyrwoolf

    Joined:
    Oct 9, 2010
    Posts:
    16
    Anyone know why this is happening, The character seams to float above ground.
    upload_2021-3-13_23-55-36.png
    I found it, it was not EmeralAI but the navmesh. I rebould the navmesh with Height Mesh checked and not it looks fine.
     
    Last edited: Mar 13, 2021
    julianr likes this.
  44. Mad_Mark

    Mad_Mark

    Joined:
    Oct 30, 2014
    Posts:
    461
    Adjust the character's base offset. Personally, I manipulate it in play mode directly on the NavMesh Agent, then once I know the offset amount, add it to the EmeraldAI spot.

    Mark
     
  45. Bioman75

    Bioman75

    Joined:
    Oct 31, 2014
    Posts:
    67
    Hey everyone, the location based damage update was released 10 days ago!!
     
    julianr likes this.
  46. SickaGamer

    SickaGamer

    Joined:
    Jan 15, 2018
    Posts:
    1,063
    Yeah I got it already! Now I just need the strafing
     
    Felinsky likes this.
  47. msalpaydin

    msalpaydin

    Joined:
    Oct 24, 2018
    Posts:
    1
    Hello,
    I am trying to change AIs faction on runtime but it seems like it doesn't work. I use
    Code (CSharp):
    1. emeraldAI.CurrentFaction = 3;

    Is there any method that I should call to make it work or is it not possible to change AIs faction on runtime?
     
  48. ellisthemiracle

    ellisthemiracle

    Joined:
    Jul 4, 2018
    Posts:
    27
    Hi,
    Do we have any plan for Sound detection and/or AI group behaviour?
    Does the dev have a road map anywhere?
     
  49. SickaGamer

    SickaGamer

    Joined:
    Jan 15, 2018
    Posts:
    1,063
    Nope no roadmap. He isn't as active as he once was.
     
  50. ellisthemiracle

    ellisthemiracle

    Joined:
    Jul 4, 2018
    Posts:
    27
    I hope the devs are okay.

    Don't really remember at what thread page, but I saw someone requested Sound detection and Group behaviour before, I hope they put that in their features list.
     
    iChuy likes this.
unityunity