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. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,394
    Root Motion needs to be set through the Emerald AI Editor as there are other mechanics that rely on the Emerald AI Movement Type setting. If your animations are Root Motion, ensure that Root Motion is enabled within Emerald AI: https://github.com/Black-Horizon-Studios/Emerald-AI/wiki/Setting-up-an-AI's-Animations#step-6
     
  2. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,394
    If your AI is using Starting Distance, it should give up after its target has has exceeded the distance from its starting position. I'll look into this to see if there's a bug.

    Edited: Okay, this seems like a bug. I will get it fixed with the next update. To fix it now, you will need to open up the EmeraldAIBehaviors script and find the following if statement (the one in the AggressiveBehavior function):

    Code (CSharp):
    1. //If our target exceeds the max chase distance, clear the target and resume wander type by returning to the default state.
    2.  if (EmeraldComponent.DistanceFromTarget > EmeraldComponent.MaxChaseDistance)
    3.  {
    4.     DefaultState();
    5.  }
    And update it to the following:
    Code (CSharp):
    1. //If our target exceeds the max chase distance, clear the target and resume wander type by returning to the default state.
    2. if (EmeraldComponent.MaxChaseDistanceTypeRef == EmeraldAISystem.MaxChaseDistanceType.TargetDistance && EmeraldComponent.DistanceFromTarget > EmeraldComponent.MaxChaseDistance ||
    3.                     EmeraldComponent.MaxChaseDistanceTypeRef == EmeraldAISystem.MaxChaseDistanceType.StartingDistance && Vector3.Distance(EmeraldComponent.StartingDestination, transform.position) > EmeraldComponent.MaxChaseDistance)
    4. {
    5.    DefaultState();
    6.  }
     
    Last edited: Nov 10, 2020
  3. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,394
    This typically happens when you are using walk turn animations in place of stationary turn animations. Ensure that you are using stationary turn animations in both of the Combat Turn Animations and Turn Animations slots.
     
  4. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,394
    Currently, hit animations cannot be played while an AI is moving. I will be fixing this with the next update though.
     
  5. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,394
    Is the AI you are setting to follow the player set to the Companion Behavior Type? This is required for the SetFollowerTarget to work. You can change the AI's behavior with the following (located in the EmeraldAIEventsManager script) first and then set it to follow the player:
    Code (CSharp):
    1. public void ChangeBehavior(EmeraldAISystem.CurrentBehavior NewBehavior)
    Example:
    Code (CSharp):
    1. EventsManager.ChangeBehavior(EmeraldAISystem.CurrentBehavior.Companion);
     
  6. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,394
    The Emerald AI Wiki is where all the current documentation is. All API can be found here: https://github.com/Black-Horizon-Studios/Emerald-AI/wiki/Emerald-AI-API

    The EmeraldAIPlayerDamage script could have a little more documentation so I will work on adding a section for it.

    Basically, the EmeraldAIPlayerDamage script is automatically added to the player when they first receive damage. You can created custom functions to call your own player controller/health system, like what is done with the commented out sections within that script. The EmeraldComponent parameter is sent within the SendPlayerDamage function which gives you everything you need for added functionality. If you want to know what the damage type was from the AI attacking the player, you would use something like:

    Code (CSharp):
    1. if (EmeraldComponent.WeaponTypeRef == EmeraldAISystem.WeaponType.Melee)
    2. {
    3.    //Melee Damage
    4. }
    5. else if (EmeraldComponent.WeaponTypeRef == EmeraldAISystem.WeaponType.Ranged)
    6. {
    7.    //Ranged Damage
    8. }
     
  7. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,394
  8. Darrkbeast

    Darrkbeast

    Joined:
    Mar 26, 2013
    Posts:
    116
    Thanks, perfect that did it, works like a charm.
     
  9. Cloudwalker_

    Cloudwalker_

    Joined:
    Jan 3, 2014
    Posts:
    33
    What is the box collider on the AI for ? I'm trying to use this with Puppet Master and it's causing my ragdoll to spazz out. Can it be removed?
     
  10. mattis89

    mattis89

    Joined:
    Jan 10, 2017
    Posts:
    1,126
    Oh man, I got this working with puppetmaster but it aint easy... So I put my awesome idea on paus and just use hit animations instead (yes they play all the time for me now) .. The box collider on the AI is for the ai to recieve damage (I think BHS will make a update where its not needed anymore (we get hitboxes and most likely able to use them straight from the ragdoll, AWESOME!) .. But when you set up puppetmaster with Em.AI make first the AI, then go into emerald script and comment out the disableragdoll line, (also when Using puppetmaster set deathtype to ragdoll, or animation if you using it together with puppetmasters death blend) so then set up puppetmaster so you get Root>behavior>puppetmaster>target I think it looked like that when puppetmaster is set up..remember to make puppetmaster gameobject layer ; Ragdoll... Target (the GO with AI components) ; AI layer, wwith emerald tag, and the rest whatever... should work... also in puppetmaster script theres a line you should change to it waits for puppetmaster to initialize on navmesh or else it will be errors.. I think thats all. PM me if you need help... I have it gotten working for ray hit reactions and falling etc, but the performance impact was to great in a zombie horde, looked great but.. I couldnt have 30 ai..Like I can now ... 5 was max with physics..maybe 10... Peace!
     
  11. Cloudwalker_

    Cloudwalker_

    Joined:
    Jan 3, 2014
    Posts:
    33
    Thanks for the reply, wow didn't realize the performance was so heavy? I'm also making a zombie game and that's a bit dissapointing...
     
  12. XVB75

    XVB75

    Joined:
    Sep 12, 2020
    Posts:
    11
    Ok, great. A feature request would be to add the possibility to pause the AI for X seconds regardless of activity. After that the AI pursues the previous activity again. This could be a function call.
     
  13. mattis89

    mattis89

    Joined:
    Jan 10, 2017
    Posts:
    1,126
    Are you making in VR? Thats why I have performance in mind..
     
  14. WizzleSWD

    WizzleSWD

    Joined:
    Nov 16, 2018
    Posts:
    7
    I purchased Emerald AI today and after the import I receive this error,
    Assets\Emerald AI\Scripts\Components\EmeraldAIInitializer.cs(489,39): error CS1061: 'Outline' does not contain a definition for 'effectDistance' and no accessible extension method 'effectDistance' accepting a first argument of type 'Outline' could be found (are you missing a using directive or an assembly reference?)
    I am clueless on the coding aspects any help would be greatly appreciated.
     
  15. tcz8

    tcz8

    Joined:
    Aug 20, 2015
    Posts:
    432
    Not a fan of having components added at runtime, I think I would have favored the use of interfaces instead but it will do.

    Thank you very much for all the info!
     
  16. tcz8

    tcz8

    Joined:
    Aug 20, 2015
    Posts:
    432
    mattis89 likes this.
  17. XVB75

    XVB75

    Joined:
    Sep 12, 2020
    Posts:
    11
    Another feature request. EmeraldAIEventsManager has AddWaypoint(Transform) and RemoveWaypoint(Int).

    But you can't see which waypoints are added so removing one or many is a problematic.

    These would be good to add:

    GetWaypoints()
    RemoveWaypoint(Transform)
    ClearWaypoints()
     
    Gabriel_SG likes this.
  18. jorikito

    jorikito

    Joined:
    Apr 20, 2018
    Posts:
    17
    The post you quoted was from 2018 :)
    Wonder if a cover system is in yet.
     
  19. danteswap

    danteswap

    Joined:
    Oct 27, 2013
    Posts:
    163
    HI There that worked but another problem arises because of the modification , So Ai should give up after its target has has exceeded the distance from its starting position and the Ai Is Giving up but now it loop into the default and chase state continuously until the player is moved out of detection range so in 3d world it looks like the Ai is turning towards the starting point and player continuously at same location . I can provide a video showing the problem if required.
     
  20. Yakuzza

    Yakuzza

    Joined:
    Mar 10, 2013
    Posts:
    8
    Hi everyone! I don't own this asset yet and I was wondering if it can ressurect the AI that has been killed? Sort of like the Jack boss from Resident Evil 7. He plays death animation but comes back to life after X secconds. Also, can this system play animation of getting up after bieng ragdolled?
    Appreciate your help!
     
  21. Jakub_Machowski

    Jakub_Machowski

    Joined:
    Mar 19, 2013
    Posts:
    473
    Hello @BHS, I just bought Your asset :)

    I have one question. I need to create Zombie like character that attack my player but works only in some terrain area, If Player is not in that Area, AI stops to see him or attack and again wander only in that particular area. We are trying to make enemy that Protect some point. Setting wandering area or see distance isnt enough here cause Player Could make that enemy will follow him and go out that area, We would like to make that enemy in any case cant go out that area. Hope I explained it well :)
     
    Last edited: Nov 19, 2020
  22. mattis89

    mattis89

    Joined:
    Jan 10, 2017
    Posts:
    1,126
    Thanks no problem! I have to ask, when your enemys chase and wander around, do they avoid objects and not just walking into them and hope they slid loose after a while? ... Well mine does, they dont find a new path or avoid, even if everything is set up correctly.


    Found the issue, fix is laterpost.
     
    Last edited: Nov 18, 2020
    tcz8 likes this.
  23. mattis89

    mattis89

    Joined:
    Jan 10, 2017
    Posts:
    1,126
    Hello @BHS i guess you are really busy but this is an important matther, I also sent a email.
    4) Currently, A* Pathfinding isn't integrated and there is no built-in pathfinding system. However, Emerald uses Unity's NavMesh system which has some pathfinding capabilities with using Unity 5.6 and above. We are currently looking into solutions for this for the next Emerald update.

    Any solution yet? Built in path finding`? A* project pathfinding? or how can I simply use Unity Navmesh Path finding just to easy avoind objects and find a new path?


    EDIT:;

    I found the issue, Im using ROOTMOTION and when I set the navmesh agent to have 0 Acc and 0 speed to get 100% rootmotion the object avade system goes offline (PathFinding) . But I figured out when you set speed to 0.1 and acc to 120(default) you still have nice rootmotion and the unity navmesh pathfinding working.... So everybody know that now, I saw someone else was asking about pathfinding too..
     
    Last edited: Nov 18, 2020
    tcz8 likes this.
  24. mattis89

    mattis89

    Joined:
    Jan 10, 2017
    Posts:
    1,126
    if (hit.collider.transform.root.GetComponent<EmeraldAI.EmeraldAISystem>() != null) { hit.collider.transform.root.GetComponent<EmeraldAI.EmeraldAISystem>().Damage(damage, EmeraldAI.EmeraldAISystem.TargetType.Player, transform, 400); } else How to write this so its takes the child colliders wich are on the bottom of the parent ? Root takes the top (parent)

    @BHS
     
    tcz8 likes this.
  25. ParadoxSolutions

    ParadoxSolutions

    Joined:
    Jul 27, 2015
    Posts:
    291
    Code (CSharp):
    1. hit.collider.transform.GetChild(hit.collider.transform.childCount)
    Something like that to get the last child. This is off the top of my head though so the capitalization in the syntax might be wrong.

    Please use code tags in your forum posts so it is easier to read.



    I also highly recommend downloading Unity's nave mesh component system for your version of Unity. The package contains ways of dynamically updating navmeshes like the A* pathfinding project but still using Unity's built-in pathfinding and agents.
    https://github.com/Unity-Technologies/NavMeshComponents
     
  26. septN

    septN

    Joined:
    Oct 29, 2015
    Posts:
    26

    Anyone can help me with this. It always happened when im changing zone, that's when Despawn happens.

    nothing wrong with animation. All is there. It only happens during despawn and trying to spawn that enemy again
    Code (CSharp):
    1. var spawned = EmeraldAIObjectPool.Spawn(_agentPrefabs[randAgent],
    2.                             spawnPosition, Quaternion.Euler(0, randRotY, 0));
    3.                         spawned .name = agentId;
    4.                         _spawnedAgents.Add(spawned);
    5.  
    6. EmeraldAIObjectPool.Despawn(agent);
    7.  
    8. //The next .Spawn() will cause this error. And only on ranged AI. If my _agentPrefabs only contains various melee unit, the error will not happen
    9.  
    Same error encountered by another discord user

    And just like Mavrx85, this error only happened to ranged units @BHS

    This doesn't fix the issue, it only hides it. My archer and mage now move but has no animation, even though it's there
     
    Last edited: Nov 22, 2020
  27. verteom

    verteom

    Joined:
    Oct 26, 2018
    Posts:
    48
    Hi~ I tried to figure it out about Emerald AI & Invector Integration .
    In Invector Stealth Kill Add-on asset , it already set some parameters, is that means , when I trigger the action to my enemy in Emerald AI, I just need to care GameObject rigidbody and Dead-animation ? Any better suggestions?
     

    Attached Files:

    • 423.png
      423.png
      File size:
      2.6 MB
      Views:
      32
  28. Jakub_Machowski

    Jakub_Machowski

    Joined:
    Mar 19, 2013
    Posts:
    473
    @BHS We are stil waiting for Your answer, We also contacted You on e-mail still without reply. If We wont get answer how to (or if that is possible to do what I described in earlier pos) We need to ask for refund, and gtry to find other asset. We will wait few days more for reply, but overall we need asset with responsive support cause we have not so long time to achieve what We want. Regards
     
  29. Mad_Mark

    Mad_Mark

    Joined:
    Oct 30, 2014
    Posts:
    461
    @BHS I still seem to be having issues with the Companion AI.
    I have 2 characters (dogs) setup as Companions to aid my player in fighting the zombie horde.
    They initialize and follow him around as expected. They engage the zombies as they get close. They attack and kill them too. All good.

    The problem: Once they have killed all of the zombies in range, ONE or BOTH of them will not come out of attack mode. It is random, it is not one single dog, sometimes its the big one, sometimes its the small one. Sometimes, none of them, but it needs to be always.

    Is there somewhere that I can FORCE them out of attack mode and return to following their followtarget until they reach the destination (player.transform), then return to hunting for the next bad guy?

    I have added a script to try and do that, but I'm not sure I'm doing it right, as the behavior persists.

    Code (CSharp):
    1.  
    2. using EmeraldAI;
    3. using System.Collections;
    4. using System.Collections.Generic;
    5. using UnityEngine;
    6. using UnityEngine.AI;
    7.  
    8. public class MyCompanionController : MonoBehaviour
    9. {
    10.     public EmeraldAISystem EAISys;
    11.     public Transform playerTransform;
    12.     public NavMeshAgent navMeshAgent;
    13.     EmeraldAIEventsManager eventsManager;
    14.     public AudioSource audioSource;
    15.  
    16.     void Start()
    17.     {
    18.         EAISys = GetComponent<EmeraldAISystem>();
    19.         eventsManager = EAISys.EmeraldEventsManagerComponent;
    20.         playerTransform = GameObject.FindGameObjectWithTag("Player").transform;
    21.         navMeshAgent = GetComponent<NavMeshAgent>();
    22.         audioSource = GetComponent<AudioSource>();
    23.     }
    24.  
    25.     void Update()
    26.     {
    27.         CheckForTarget(); // This will end up a Coroutine called every second or two.
    28.     }
    29.  
    30.     void CheckForTarget()
    31.     {
    32.         if (EAISys.CurrentTarget != null)   // Companion AI has a target.
    33.         {
    34.             if (!EAISys.CurrentTarget.GetComponent<NavMeshAgent>().isActiveAndEnabled) // The target has NO active navmesh agent.  It must be dead!
    35.             {   // Make its wander type dynamic, and tell it to resume following.
    36.                 eventsManager.ChangeWanderType(EmeraldAISystem.WanderType.Dynamic);
    37.                 eventsManager.ResumeFollowing();
    38.             }
    39.         }
    40.     }
    41. }
     
  30. Mad_Mark

    Mad_Mark

    Joined:
    Oct 30, 2014
    Posts:
    461
    Have you though about using trigger colliders?
    Player hits a trigger collider, and you enable/disable the detection routine. That way you can have the detection range as large as you want, but it won't do anything until you hit the trigger collider. Player leaves the trigger area and have the detection stop and set the zombie's destination back to his starting point.

    just my 2¢. Collect the whole dime!
    Mark
     
  31. Jakub_Machowski

    Jakub_Machowski

    Joined:
    Mar 19, 2013
    Posts:
    473
    Thanks For Tip I will try :) but I will also wait for @BHS offical reply, FOr now I have not reply and thats not good that support reply takes so long. Hopefully We will get answer This week :)
     
  32. Mad_Mark

    Mad_Mark

    Joined:
    Oct 30, 2014
    Posts:
    461
    Well, in all fairness, it doesn't sound like this is a programming issue. Your use case seems to ask how to confine the working AI. You will likely have to constrain the AI with visible (or invisible) walls that are marked static, with non-static openings that enable/disable when the player runs into a trigger collider. This is what I do for doors in my zombie game, except that I use a NavMeshObstacle component rather than enable/disable. When the door is open, the NavMesh allows movement in and out of the area. When closed, the door's NavMeshObstacle cuts off the NavMesh entry point, essentially leaving the AI with no avenue of pursuit or attack.

    Please try it, and let me know if you get it working or need more help figuring things out.
    Mark
     
  33. Mad_Mark

    Mad_Mark

    Joined:
    Oct 30, 2014
    Posts:
    461
    OH, and if you REALLY need a programattic solution, you might want to create a collider around the area, mark it trigger, and then use OnTriggerEnter, OnTriggerStay, and OnTriggerExit to determine whether the player is coming in, staying inside, or leaving the area. Couple of IF statements and you have an area of influence. You should place this script on an empty gameobject that also holds the trigger collider to keep the GetComponent function calls local.
    Code (CSharp):
    1.  
    2. using UnityEngine;
    3.  
    4. public class ConfinedArea: MonoBehaviour
    5. {
    6.    /// This script confines an area holding AI.
    7.    /// When player hits the "door" collider, it allows the AI to pursue/attack.
    8.    /// Attach it to an empty that holds the main area collider, and add the door collider in inspector.
    9.  
    10.     public Collider areaCollider;
    11.     public Collider doorwayCollider; // This will be assigned in the editor!
    12.  
    13.     private void Start()
    14.     {
    15.         areaCollider = GetComponent<Collider>();
    16.     }
    17.  
    18.     public void OnTriggerEnter(Collider other)
    19.     {
    20.         if(other.CompareTag("Player"))
    21.         {
    22.            // Turn off the doorway collider!
    23.             doorwayCollider.enabled = false;
    24.             // OR move it out of the way!  Up is good, so as not to make moving difficult.
    25.             doorwayCollider.transform.y += 100;
    26.         }
    27.     }
    28.  
    29.    public void OnTriggerStay(Collider other)
    30.     {
    31.         if(other.CompareTag("Player"))
    32.         {
    33.            // Do what ever you want here...
    34.         }
    35.     }
    36.     public void OnTriggerExit(Collider other)
    37.     {
    38.         if(other.CompareTag("Player"))
    39.         {
    40.            // Turn on the doorway collider!
    41.             doorwayCollider.enabled = true;
    42.             // OR move it back into the way!  This still leaves a path, but it is blocked.  Add NavMeshObstacle!
    43.             doorwayCollider.transform.y -= 100;
    44.         }
    45.     }
    46. }
    47.  
    This is UNTESTED code that I just type in, so your mileage may vary.
    Obviously, if you move the trigger collider up 100 units, the OnTriggerStay won't work. LOL.
    Mark
     
  34. Mad_Mark

    Mad_Mark

    Joined:
    Oct 30, 2014
    Posts:
    461
    @BHS I still seem to be having issues with the Companion AI.

    See post: 6564316 above.
     
  35. Jakub_Machowski

    Jakub_Machowski

    Joined:
    Mar 19, 2013
    Posts:
    473
    Yes I though about it but characters then Wont go back to the protetction point but Will be walking just next to that walls (of course if Player will bu runing and going back) This is Why I ask @BHS of some defeault behaviour not about trying to do that another road :) But thanks for that If BHS wont asnwer soon I will try that.
     
  36. septN

    septN

    Joined:
    Oct 29, 2015
    Posts:
    26
    how do you make your companion default to run?
    I've had this set but they only Run when the follow target went too far
     
  37. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,394
    You should be able to pause an AI regardless of activity and resume movement with the following. You could set a time to control this.

    StopMovement - https://github.com/Black-Horizon-Studios/Emerald-AI/wiki/Emerald-AI-API#StopMovement
    ResumeMovement - https://github.com/Black-Horizon-Studios/Emerald-AI/wiki/Emerald-AI-API#resumemovement
     
  38. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,394
    That's weird because the Outline component is apart of the standard Unity text component. What version of Unity are you using? Have you tried reimporting Emerald AI?
     
  39. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,394
    Emerald AI does this automatically. You need to set the AI to use the Root Motion Movement Type as explained here: https://github.com/Black-Horizon-Studios/Emerald-AI/wiki/Setting-up-an-AI's-Animations#step-6
     
  40. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,394
    You most likely need to call EmeraldComonent.EmeraldEventsManagerComponent.ResetAI(); before respawning your AI. There's some internal Animator Controller code that needs to be called after an AI dies and is respawned.
     
    septN likes this.
  41. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,394
    Companion AI sometimes not leaving attack mode is a bug that will be fixed with the next update. If you need a solution now, please email me so I can provide the code needed to fix it.
     
  42. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,394
    My apologies for the delayed response. The recent sales have put me a little behind on support, but I'm working hard on getting everything caught up. Replies should be a lot quicker now.
     
    julianr likes this.
  43. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,394
    This is intended as if the companion is always running, they will run into their follower or run too fast. They switch to run after they are a certain distance away from their follower.
     
  44. SickaGamer

    SickaGamer

    Joined:
    Jan 15, 2018
    Posts:
    1,063
    @BHS where are you with the next upgrade?
     
  45. MagiJedi

    MagiJedi

    Joined:
    Apr 17, 2020
    Posts:
    1
    Anyone know why I can't add an Animation Clip to the Attack Animations section of Combat? I click the radio button and the window appears. If I click something nothing highlights, but the window seems to come into focus. Then no matter which animation clip I click on, nothing happens.

    Edit:
    Tested on a blank project using 2019.4.13f with just Emerald AI and a model pack. Still won't let me add any attack animations. Every other screen I've tested adding animations to worked.

    I'm about to install latest 2019 (15f) and test a blank project there.

    I'm using URP in case it matters.

    Edit2:
    Installed 2019.4.15f and tested the same scenario and it worked. I'm in the midst of upgrading my actual project and hopefully that'll do it.

    Final Edit:
    That worked. It was a bug in 2019.4.13f.
     
    Last edited: Nov 29, 2020
  46. verteom

    verteom

    Joined:
    Oct 26, 2018
    Posts:
    48
    @BHS Hi~~~Can you give me some help?Thanks
     
  47. mattis89

    mattis89

    Joined:
    Jan 10, 2017
    Posts:
    1,126
  48. septN

    septN

    Joined:
    Oct 29, 2015
    Posts:
    26
    How do you handle friendly fire in EmeraldAI? My ranged enemies are unable to damage the player because the ability got consumed by the obstructing enemy in front of it.


    I've already put "Emerald AI Evil" layer set to not obstruct the ranged attack, but they still obstructing it. I just want to friendly fire be pass through.


    Straight modifying the EmeraldAIProjectile.cs and adding this check seems to do what I want, but it seems hackish. Is there any way doing it without tampering the code directly?
     
    Last edited: Nov 30, 2020
  49. Drannach

    Drannach

    Joined:
    Apr 6, 2014
    Posts:
    24
    Hello devs,
    i'll try to ask here, discord seems a bit quiet :)
    I have a problem with the aim of the ranged ai. if i stand in front of the enemy, he aim at me correctly, but if i step back he start to aim over my head and the height increase with the distance. i tryed the Player Y Offset under Head Look Option but it's not helping, because it is true that it tune down the aim, but when i get closer he shoots at my feets... any ideas?

    Answer : Ok for some reason the aiming animation was "wrong". Stil don't know why but changing it removed the problem. now i just need to know how ik is working in emerald ai because i need to reposition the hands on the weapon

    I'll just add another one :

    Someone is using the EventsManager.SetCombatTarget(Transform Target) API method? because it's very handy when the AI needs to react to an hit, the problem is that it overrides the the AI chase limit, and in the beginning is fine, the ai will hunt down the attacker, the problem is that it stays like that forever and it means that the attacker has no way to escape. there's a way to reintroduce the chase limit after the AI reach the attacker?

    Answer from the dev (Thanks Will btw!) :
    When an AI is initialized, their starting chase distance is assigned to another variable so it can be manually reassigned. Within the EmeraldAISystem script, the variable StartingChaseDistance contains the AI's default/starting chase distance value. So you could use something like below. You could then reset the chase distance by watching the variable DistanceFromTarget (located within the EmeraldAISystem ) once the target is within range.

    EmeraldComponent.MaxChaseDistance = EmeraldComponent.StartingChaseDistance;

    Tested and it works perfectly!

    I've posted the answers here because maybe someone other than me needs em
     
    Last edited: Dec 9, 2020
  50. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,394
    I just posted the release notes for the 2.4.1.1 update. The 2.4.2 update will be finished soon.
     
unityunity