Search Unity

  1. Are you interested in providing feedback directly to Unity teams? Sign up to become a member of Unity Pulse, our new product feedback and research community.
    Dismiss Notice

[RELEASED] Emerald AI 2.4.2 - The Ultimate Universal AAA Quality AI Solution

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

?

Which main feature would you like to see in the upcoming 2.6 Emerald AI update?

  1. Strafing - Allow AI to strafe in circles around their targets within a customizable distance.

    22.5%
  2. Stats - Allow AI to have additional stats, such as stamina and mana, usable by an AI's abilities.

    29.2%
  3. Sound Detection - Allow AI to detect sounds within a certain distance of their position.

    48.3%
  1. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,494
    Try increasing your AI's Stopping Distance. 0.25 is quite small for AI of that size. Also, you can turn on Use Object Avoidance (located at the bottom of the Detection Options) and then set which layers you want to be avoided, which should be your AI layer.
     
    trojant likes this.
  2. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,494
    I will look into PupperMaster support after I have finished the Emerald AI update I've been working on.
     
    shyamarama likes this.
  3. al3d

    al3d

    Joined:
    Feb 7, 2013
    Posts:
    26
    Thanks you so much :)
     
  4. adifrank

    adifrank

    Joined:
    Dec 11, 2017
    Posts:
    10
    Is it possible for AI to react to sound?
     
  5. SickaGamer

    SickaGamer

    Joined:
    Jan 15, 2018
    Posts:
    1,136
  6. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,494
    Hey everyone!

    Updated: This post has been updated and the Emerald AI 2.5 update is now the Emerald AI 3.0 update. This update ended up being much bigger than I originally expected. I wanted to go through every feature and fix every bug I could find, as well as add many needed improvements and features.

    The 3.0 update's purpose is to get Emerald AI to a very solid place before releasing larger updates such as strafing, sound detection, and stats. While Emerald AI has been stable for awhile now, I wanted to address some of the known bugs and issues that may have inhibited it from being as solid as it could be. This update took a lot longer than expected because all of Emerald AI's features were tested so bugs could be found and improvements could be made where needed. This is also why it is not apart of the 2.x update range. I have a few more things I'm working on with this update so I may add more to the release notes.

    Emerald AI Feature Poll
    As for the next new feature for the 3.1 update (the next update following the 3.0 update), I have created a poll here on the Emerald AI thread so users can to vote on which main feature they want the most. I will also be posting information about the poll on the Black Horizon Studios Discord so there should be a decent amount of votes. Whichever one gets the most votes, will be the feature I will focus on first, followed by the one in second, and then third. This will allow me to see what the majority of users want first so I can prioritize the features accordingly. Also, feel free to comment here on the Emerald AI thread to add additional features and improvements you'd like to see. *The poll is available at the top of this thread.

    Emerald AI 3.0 Release Notes
    Improvements/Features
    • Added a simple hand IK system that allows AI to keep their hands positioned to a ranged weapon. This feature is only available who use the Emerald IK Type.
    • Added two types of IK; Unity IK (which uses the built-in Unity IK) and a custom one called Emerald IK (which uses a custom system controlled by the EmeraldAILookAtController). The Emerald IK type allows AI with ranged weapons, such as bows and guns, to accurately aim their weapons (including the weapon's muzzle) at targets. This feature allows users to add up to 3 bone transforms to be used for added customization.
    • Added the ability for projectile abilities to to stay stuck into targets based on the colliders hit allowing them to move with their current target, when Sticks Into Objects is enabled.
    • Added the ability for projectiles to be used with Location Based Damage AI so projectiles, such as arrows, stay stuck into the colliders of an AI's body that were hit.
    • Renamed Arrow Projectile to Sticks Into Object.
    • Added the ability for projectiles to use gravity with a customizable gravity amount.
    • Added a new component called TargetPositionModifier that allows non-AI and player targets to have their target position modified so AI can properly hit them. Users have had issues with AI aiming at the player's base which resulted in incorrect targeting and incorrect target obstructions. This new component resolves this and has an easy to use editor with visual indicators.
    • Completely rewrote the IK look at feature to be reliably smooth between targets.
    • Improved the way aiming offset is calculated as Unity's IK system will aim high at distant targets. The aiming offset is reduced as the target gets closer to the AI who is aiming. This also works for the IK look feature with non-combat targets.
    • When within the Emerald AI Editor, changed the visual line of sight center transform from the base of the AI to its head transform.
    • Added a gizmo to show an AI's attack distance when within the Unity Editor and the Emerald AI editor is active for that AI.
    • Renamed Head Look Speed to Non-Combat Look at Speed
    • Added a separate look at Speed for combat called Combat Aim Speed so users can have a faster aiming speed for combat and a slower look at speed for look at players (as well as other non-combat NPCs).
    • Added an event called OnDetectTargetEvent that triggers an event each time an AI successfully detects a target when while in combat.
    • Removed all look at code within the EmeraldAIDetection script and moved it to a separate script called EmeraldAILookAtController. This component is automatically added to an AI when they are created with the Setup Manager. For AI who are preexisting, this component is added upon initialization.
    • Improved the way turning animations are calculated as the previous method would sometimes allow an AI to play the wrong turning animation when an AI was rotating.
    • Reworked the way stationary turning speeds are handled by having separate settings for combat and non-combat. Also reworked the way moving turning speeds are handled by having separate settings for combat and non-combat. This all gives much more control over how the AI moves and turns, especially with AI who use Root Motion. This was tested significantly and allowed for the most polished looking AI turning movement both in and out of combat. It also allows AI to move between manual waypoints and dynamic waypoints more cleanly by better utilizing their turning animations.
    • Added a Refresh Animator Controller button that manually updates an AI's animations and reapplies an AI's Animator. This can sometimes happen (rarely) when updating to a newer version of Emerald AI.
    • Added a confirmation message to the Check for Missing animation if no missing animations are found.
    • Reworked the way player damage is handled with EmeraldAIPlayerDamage. The EmeraldAIPlayerDamage script is now integrated within all Emerald AI scripts so AI can detect when an player's health reaches 0. This also allows users to integrate custom character controllers or health systems, like what was done previously within EmeraldAIPlayerDamage, but the IsDead variable can be set with custom code that is then read within the Emerald AI code so AI will always know when a player has died. This is all handled in real-time so AI will know exactly when a player has died, even if they are mid attack or walking towards the player target. This means no more AI attacking dead players. All integration tutorials will be updated with these improvements by the release of version 3.0.
    • When a player dies, their transform is added to a static list of transforms called IgnoredTargetsList that stores all killed players so they cannot be retargeted. This is to avoid having to modify the player in anyway, such as changing a player's tag or layer. There is simple easy to use API to remove a selected player from the IgnoredTargetsList, or it can also be cleared, so it can be targeted again by AI. This is explained further below.
    • The IgnoredTargetsList can also be used for other mechanics so any target can be ignored if desired. API is available to set, remove, and clear the IgnoredTargetsList.
    • Reworked the way Non-AI damage is handled with EmeraldAINonAIDamage. This is similar to what was done with EmeraldAIPlayerDamage as explained above.
    • Added a function called ResetNonAITarget to EmeraldAINonAIDamage that resets a non-AI target to its default health, tag, and layer. This can be used to reset a non-AI target if users want to reuse the game object.
    • Added the ability to remove undesired colliders from an AI's Location Based Damage Collider List.
    • Added a button to the Animation tab called "Regenerate Animator Controller" that will regenerate the AI's current animator controller from the Emerald AI master version without having to resave or reapply any animations. This is useful when the master animator controller has been updated, like it has with this update, and users need a quick way to update to the current version of the animator controller. This also works with multiple objects so users can select as many AI at a time as needed.
    • Improved the way stationary turning is handled when AI are wandering. AI will now play and complete their turning animations according to their turn angle before moving. This allows AI to move much more naturally.
    • Added code that checks if an AI's Animator Controller has gone missing, which can happen if the Animator Controller has been overwritten with changes from another AI that shares said controller. When this happens, the user will be notified within the Emerald AI editor that the Animator Controller has gone missing and that it can attempt to recover it using the last known file path. If this file path hasn't changed, the Animator Controller will be recovered and reapplied. This seemed to be an issue that would happen occasionally with some users so now there's a failsafe method to possibly resolve it. If the controller cannot be found, the user will be notified to simply create a new Animator Controller.
    • Rewrote the backup state to be much more responsive and accurate when looking for obstacles while backing up. This allows an AI that's backing up to detect the distance of a collision and only backup until they're within their Stopping Distance + 1 unit away of said collision. AI will also no longer continuously attempt to backup when there's no space to do so.
    • Added a Backup Layer Mask to the Emerald AI Editor to ignore certain layers with the backup detection process.
    • Renamed UseCastSound within the EmeraldAIAbility script to UseCreateSound to generalize the name. This change means this variable has been reset.
    • Renamed CastSound within the EmeraldAIAbility script to CreateSoundsList. This was changed to a list of sounds that are randomly picked when an ability is created. This gives much more diversity when abilities are being created, especially for AI who use weapons like guns. This change means this variable has been reset.
    • Renamed UseCastEffect within the EmeraldAIAbility script to UseCreateEffect to generalize the name. This change means this variable has been reset.
    • Renamed CastEffect within the EmeraldAIAbility script to CreateEffect to generalize the name. This change means this variable has been reset.
    • Rewrote a lot of the EmeraldAIProjectile code so it referenced the passed EmeraldAIAbility data instead of having duplicated variables that were used for both.
    • Removed the initialization function within the EmeraldAISystem script for initializing Emerald AI Projectiles and move it within the EmeraldAIProjectile script.
    • Replaced all enums that used a separate Yes or No value with a global one used for all EmeraldAISystem enum variables. Due to a mistake on my part from many updates ago, the UseRunAttack enum and UseBloodEffect variables had reversed values so I had to rename them to avoid potential errors. All this means for users is that you will have to reapply the UseRunAttack setting or UseBloodEffect setting to what you had it prior to the 3.0 update. Renamed UseRunAttack to UseRunAttacks and UseBloodEffect to UseHitEffects.
    • Added an option to control whether or not projectiles will play their collision effect on targets.
    • Reworked all Draw Raycasts code so they run without the detection update "ticks". This allows them to be much smoother and accurate when using the Debugging Tools.
    • Rewrote the equip weapon system to be much easier and so it's no longer dependent on the Item List. This now consists of a held weapon object and a holstered weapon object both defined within the Emerald AI editor. When using the EquipWeapon Animation Event on an AI's equip animation, a string is also passed to define what weapon is being equipped. The exact opposite is done for unequipping a weapon using the UnequipWeapon. This works for both ranged and melee weapons and only needs 2 animation events, instead of 4 like what was done previously.
    • Rewrote the weapon drop system to work with the above system simply duplicating the currently equipped/held weapon and adding the needed components allowing it to fall.
    • Rewrote how the aggro system works to be more reliable. This improvement also stops the AI from reassigning the same target when the aggro system chooses a new target.
    • Rewrote the blocking system to be much more fluid with playing blocking and blocking impact animations. This also improves blocking angle detection by calculating the angle of each attacker so an attack is only blocked when the attacker is within the blocking angle limit.
    • Rewrote how Root Motion movement is calculated to be more responsive with AI stopping at destinations. This improvement also allows AI to transition to their walk animation (when using run) prior to arriving at their destination and allows for cleaner combat mechanics by preventing AI from getting too close to each other.
    • Changed Collision Sound on projectiles to a list of sounds that are randomly picked when an ability collides with an object or target. This gives much more diversity when abilities collide, especially for AI who use weapons like guns. This change means this variable has been reset.
    • Moved the Weapon Objects from AI's Settings>Combat>Combat Action to AI's Settings>Items.
    • Added a blood decal spawning system (not the blood decals themselves) for spawning blood decals with customizable decal objects, scales, angles, radius, and more. This is featured in Emerald AI 3.0's newest video. Using an open source asset called Dynamic Decals, users can have the decals as seen in the video.
    • Added a explosion damage system that applies damage and explosion force to surrounding AI with mitigated damage and mitigated force based on distance from an explosion.
    • Removed the Turn Animation Type setting as it is now handled automatically.
    • Removed the Ranged Attack Distance minimum cap when using both weapon types.
    • Added a new Switch Weapon Type condition for AI that use both weapon types. This one allows an AI to switch weapon types based on a random time within the minimum and maximum amount of seconds.
    • Added an option to randomize an ability's damage amount between a minimum and maximum value.
    • Added a setting called Non-Combat AI for Passive AI that allows users to bypass having to apply combat animations on AI that will not use them. This also stops non-combat AI from being targeted by Aggressive AI. This also stops all missing animation and missing animation events warning messages from being displayed on Start.
    • The following variables each have their own variable based on the weapon type used. This makes adjusting these variables within the editor and with custom code much clearer, especially with AI who use both weapon types. This also allows AI who use both weapon types to have different settings for ranged and melee.
      • MeleeAttackDistance
      • RangedAttackDistance
      • MeleeTooCloseDistance
      • RangedTooCloseDistance
      • MinMeleeAttackSpeed
      • MaxMeleeAttackSpeed
      • MinRangedAttackSpeed
      • MaxRangedAttackSpeed
    New API
    • Added CancelAttackAnimation() to the EmeraldAIEventsManager that allows the AI's current attack animation to be cancelled.
    • Added SetIgnoredTarget(Transform TargetTransform) to the EmeraldAIEventsManager that adds the specified ignored target to the static EmeraldAISystem IgnoredTargetsList.
    • Added ClearAllIgnoredTargets() to the EmeraldAIEventsManager that clears all irgnored targets from the static EmeraldAISystem IgnoredTargetsList.
    • Added ClearIgnoredTarget(Transform TargetTransform) to the EmeraldAIEventsManager that removes the specified target from the static EmeraldAISystem IgnoredTargetsList.
    • Added GetAttacker() to the EmeraldAIEventsManager that returns the transform that last attacked the AI.
    • Added ChangeDetectionType (EmeraldAISystem.DetectionType DetectionType) to the EmeraldAIEventsManager that changes the AI's Detection Type.
    • Added GetCombatTarget() to the EmeraldAIEventsManager that returns the transform that returns the AI's current target.
    • Added GetFaction() to the EmeraldAIEventsManager that returns the AI's current faction.
    • Added AddWaypoint(Transform Waypoint) to the EmeraldAIEventsManager that adds a waypoint to an AI's waypoint list via the position of the specified transform.
    • Added RemoveWaypoint(int WaypointIndex) to the EmeraldAIEventsManager that clears the specified waypoint using the index from the AI's waypoint list.
    • Added ClearAllWaypoints() to the EmeraldAIEventsManager that allows you to clear all of an AI's waypoints.
    • Added OverrideCombatTarget(Transform Target) to the EmeraldAIEventsManager that allows you to set a target the AI can move to and attack with no distance limitations.
    • Reworked SetCombatTarget(Transform Target) within the EmeraldAIEventsManager so it assigns a target that's within an AI's detection radius.
    Bug Fixes
    • Fixed a bug that caused a desync in internal settings when selecting an AI that had a Weapon Type of Both and another AI that didn't when within the Emerald AI Editor. This has been reworked and resolved.
    • Fixed a bug that didn't allow the look at IK feature to work consistently that often lead to head and body jerking between targets. This has been fixed and greatly improved to be smooth and reliable.
    • Fixed a bug that didn't allow an AI's raycasts to be drawn at the center of non-AI and player targets, if they were rotated on the x or z axis.
    • Fixed a bug that didn't allow the AI's Hit Transform Point visual indicator to take rotations into account.
    • Fixed a bug that didn't allow AI to look at the correct point if a target was rotated on the x or z axis.
    • Fixed a bug that didn't allow an AI's projectile to continue its path if its target died before the projectile made it to the target.
    • Fixed a bug that would sometimes allow a target's projectile to hit its target and not cause damage (When not using Location Based Damage).
    • Fixed a bug that would sometimes allow a target's projectile to hit its target and not cause damage (When using Location Based Damage).
    • Fixed a bug that didn't allow ranged AI to shoot at targets that were on structures above them.
    • Fixed a bug that allowed an AI to not fire their ranged attack at the appropriate distance even if their target was unobstructed.
    • Fixed a bug that sometimes didn't allow AI that were using Line of Sight detection with the Random Pick Target Type to properly find a target.
    • Fixed a bug that would sometimes allow an AI to incorrectly set the target type when using Line of Sight detection type.
    • Fixed a bug that sometimes didn't allow the Random Pick Target Type to work properly with non-AI Targets.
    • Fixed a bug that didn’t allow ranged AI who used the Stationary Obstruction Action to move closer to their target if the target was obstructed and exceeded their attack distance. This bug caused AI to get stuck without ever moving to their target if the view remained obstructed.
    • Fixed a bug that allowed the check animations error to display with combat animations when using non-combat AI
    • Fixed a bug that allowed line of sight to still function when an AI was passive or a pet.
    • Fixed a bug that stops the LineOfSightDetection function from looping through potential targets once one has been successfully found.
    • Fixed the function name within EmeraldAIEventsManager from InstantlyRefillAIHeath to InstantlyRefillAIHealth as it was misspelled.
    • Fixed a bug that could make AI using Location Based Damage (LBD) be undetectable to other AI. This happened if LBD AI had gaps in their colliders that didn't provide a valid collision source for other AI. This was fixed by altering the Box Collider generated by Emerald AI during startup to be positioned right where an AI's Hit Transform is to ensure an AI always has a collision source for being detected.
    • Fixed a bug that allowed the Emerald AI progress bar to still be displayed if there was an issue with setting up.
    • Fixed an error that happened with the Setup Manager if Auto Optimize was set to No.
    • Fixed an error that would happen with melee AI if Run Attacks were enabled, but the Run Attack List was empty.
    • Fixed an error that would happen with ranged AI if Run Attacks were enabled, but the Ranged Run Attack List was empty.
    • Fixed a bug that stopped allowing AI to attack if they switched targets that were greater than 100 degrees while using an Attack Speed of 0.
    • Fixed a bug that would allow melee AI to successfully generate an attack even if they were not done rotating with their Combat Turning Angle. This resulted in AI rotating towards their target, generating an attack, then continuing to rotate the rest of the needed amount, which looked unnatural. Melee AI must now finish rotating before they can attack their targets.
    • Fixed a bug that allowed AI to keep attacking a dead player.
    • Fixed a bug that updated the an AI's wandering position and starting position when RestAI() was called (used for reusing a killed AI).
    • Fixed a bug that would disable an AI's internal colliders when RestAI() was called and the AI was using the Location Based Damage system. This resulted in an AI not being able to properly use Location Based Damage after being killed and reset.
    • Fixed a bug that would sometimes give a missing reference exception when an AI that was killed was despawned (being disabled).
    • Fixed a bug that didn't allow cast or fire effects to rotate with the AI.
    • Fixed a bug that didn't allow AI attacks to be cancelled. This required changes to the master Animator Controller which means animator controllers will need to be regenerated. A button has been added to update an animator controller to the current version right from within the Emerald AI editor. This is explained above.
    • Fixed an error that would happen if a projectile's target was destroyed while moving towards its target.
    • Fixed a bug that would allow an AI's Location Based Damage colliders to stop an AI's backup process.
    • Fixed a bug that allowed an AI's projectiles to collide with its own colliders when using Location Based Damage.
    • Fixed a bug that didn't allow the proper backup speed to be applied when switching between ranged and melee attacks.
    • Fixed a bug that allowed a melee attack's Impact Effects to spawn without being parented to a transform.
    • Fixed a bug that allowed AI to generate multiple attacks within a single attack sequence which sometimes allowed incorrect attack animations to play.
    • Fixed a bug that allowed multiple block animations to get triggered when getting hit while the current block animation was playing.
    • Fixed a bug that allowed an AI's block sound to play if they were killed while blocking and they were hit while they were dead.
    • Fixed a bug that didn't allow an AI's projectile critical hit damage to be dealt or displayed correctly when using critical hits.
    • Fixed a bug that didn't properly color critical hits when hitting non-AI targets with the Combat Text System.
    • Fixed a bug that didn't display a warning message for AI using equip animations, with the Ranged Weapon Type, when they were missing the needed Animation Event.
    • Fixed a bug that didn't allow projectiles to spawn at the proper angle towards its target on the first frame of being spawned.
    • Removed the Player Offset Y Position and Head Look Y Offset from the EmeraldAIEditor as they are no longer used. The TargetPositionModifier component replaces this and allows for much better control for players and individual non-AI targets.
    • Added a warning message to Combat Turning Angle if it is below an AI's Max Firing Angle (for ranged and both weapon types) as having the Combat Turning Angle lower than the Max Firing Angle can result in an AI being unable to fire at its target.
     
    Last edited: Sep 18, 2021 at 8:43 PM
    julianr, HeadClot88, wood333 and 9 others like this.
  7. angellnetwork

    angellnetwork

    Joined:
    Feb 8, 2018
    Posts:
    2
    Any news about RPG Builder integration?
     
  8. mattis89

    mattis89

    Joined:
    Jan 10, 2017
    Posts:
    1,146
    Good fixes!! Thanks
     
  9. twobob

    twobob

    Joined:
    Jun 28, 2014
    Posts:
    1,934
    @BHS looking forward to it.
    TLDR; I wrote a basic script that (very badly, lol) constructs AI walkable paths based on MapMagic2 data.

    Downside: Sometimes the agents mess up and the NavMash wont let them path there (I create chunks on NavMesh on the fly) but that a navMesh/exception handling issue, TBH the paths come though fine. I just hacked your script to NOT make them "do nothing" at that point and it was all fine.

    It uses a simple array of white pixels to export the data. This is not an efficient way to do it and was just a proof of concept. Looking forward to adding better facilities in the future
     
    BHS likes this.
  10. trojant

    trojant

    Joined:
    May 8, 2015
    Posts:
    65
    Hi,@BHS
    Thank you for your reply.

    (1) I used your way,and they avoid other AI better than before.
    https://github.com/Black-Horizon-Studios/Emerald-AI/wiki/Setting-up-an-AIs-Layers-and-Tags
    Refer to this tutorial,I also set labels and layers correctly.But sometimes two AI will still get stuck together, less than before.They can't avoid each other.

    test video link:https://gyazo.com/c4d91d12832fd96c0d08dd9b89814d6a
    And I uploaded screenshots of some parameters.How can I solve it?

    Unity has always had this problem? I searched a lot.Is A* Pathfinding Project Pro plugin considered to be supported in the future?
    https://forum.unity.com/threads/nav...one-another-obstacleavoidancetype-bug.146381/

    (2)Is stopping distance half of radius with Obstacle Avoidance?How do I set this value?

    (3)In small probability, the animal does not play the walking animation, but moves to the target point. This happens sometimes. I don't know what's wrong?

    (4)When I use this Emerald AI plugin, do I not need to adjust parameters of the NavMeshAgent component?
    Thank you very much.
     

    Attached Files:

    Last edited: Aug 3, 2021
  11. Crazy-Potato

    Crazy-Potato

    Joined:
    Sep 15, 2020
    Posts:
    1
    Will this fix the UFPS integration?
     
  12. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,494
    I just reached out to the developer to see if I can get a copy of RPG Builder to add support, but I won't be able to start looking into this until I've finished the Emerald AI 2.5 update.
     
    uberwiggett likes this.
  13. SickaGamer

    SickaGamer

    Joined:
    Jan 15, 2018
    Posts:
    1,136
    And.... ABC Combat Kit?
     
    StevenPicard likes this.
  14. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,494
    Using Unity's built-in AI avoidance through the NavMesh system isn't perfect. This is why I implemented a custom solution. This solution requires a decent amount of space as it relies on Unity's Navmesh to generate new destinations temporarily until the nearby AI is no longer in the way.

    In your video, you have quite a few large AI in a small amount of space with very little NavMesh to move on. This is most likely the issue. Try having a larger area for the AI to move around on. As it is currently, the AI have no room to generate waypoints around each other.
     
    trojant likes this.
  15. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,494
    What's wrong with UFPS? Last time I tested it, which as recently, everything was working fine.
     
  16. SickaGamer

    SickaGamer

    Joined:
    Jan 15, 2018
    Posts:
    1,136
  17. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,494
    Thanks, I'll look into more integrations after the next update has been released.
     
    StevenPicard likes this.
  18. moltke

    moltke

    Joined:
    Apr 28, 2019
    Posts:
    95
    Any update on when new release will be sent out?
     
  19. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,494
    Yes, I will be doing another status update on this within the next day or two. The 2.5 update (which I'm now calling the Emerald AI 3.0 update) is slightly delayed (probably by two weeks or so) because more mechanics had to be rewritten or improved than I though, but these rewrites are significantly improving the quality Emerald AI and adding some features that I haven't yet mentioned.
     
    Last edited: Aug 9, 2021
    iChuy likes this.
  20. SickaGamer

    SickaGamer

    Joined:
    Jan 15, 2018
    Posts:
    1,136
    Might as well throw in some ABC Combat Toolkit integration as well as strafing, stats and sound detection!
     
  21. nathanjams

    nathanjams

    Joined:
    Jul 27, 2016
    Posts:
    215
    Are there any plans to add AStar Navigation to Emerald?
     
  22. SickaGamer

    SickaGamer

    Joined:
    Jan 15, 2018
    Posts:
    1,136
    @BHS can you make it possible to stop animations, play a emotes or custom one and then resume? I'd use this in a boss fight scenario.
     
  23. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,494
    Not currently. Right now my focus is getting Emerald AI 3.0 out. After that, I can look into how difficult it would be.
     
    nathanjams likes this.
  24. nathanjams

    nathanjams

    Joined:
    Jul 27, 2016
    Posts:
    215
    Absolutely. Would be awesome if you could look into it. AStar navigation would be such an awesome addition!
     
    StevenPicard likes this.
  25. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,494
    I believe it is currently possible to play an emote animation during combat. Is this not working?
     
  26. SickaGamer

    SickaGamer

    Joined:
    Jan 15, 2018
    Posts:
    1,136
    @BHS I am having a hard time stopping the combat animations and then restarting them once my series of emotes (special attacks) are done. On another note... If I have a ton of preconfigured AIs with 2.4, will I have to redo anything with 3.0?
     
  27. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,494
    Gotcha. With version 3.0, there is an option to cancel animations with new API called CancelAttackAnimation(). As of right now, this isn't possible, but it will be with version 3.0.

    I've tried to make the upgrade process as easy as possible. Most things can be automated. I've made an option within the Emerald AI Editor to Regenerate Animator Controllers (updates the Animator Controller to the most recent version), which even works with multiple objects and AI with different Animator Controllers. Everything else is covered within the version 3.0's release notes above, but you should be able to select all AI at once and update things as needed.
     
  28. SickaGamer

    SickaGamer

    Joined:
    Jan 15, 2018
    Posts:
    1,136
    @BHS that is awesome! I am guessing you also have a StartAnimationAttack (preferred choice) or does it start back up automatically?

    Another thing that would be awesome and beyond the really needed noise detection, stats and strafing would be an advanced setting.

    I was thinking of the ability to setup different animations sequences at a certain percentage of life. Example a dragon starts fighting on the ground goes through its first sequence of attacks, at 50% life do the next sequence of animations. This would be a new set of movement animations with a Y offset (flying animations and new attacks). 25% life back to ground and do special attacks (emotes or new subset of attack ect... i hope this makes sense.
     
  29. Mr_squiggle

    Mr_squiggle

    Joined:
    May 11, 2019
    Posts:
    30
    Hi I'm interested in purchasing this asset. Was just wondering if flying enemies are possible? And not just hovering as it says in the description on the asset page.
     
  30. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,494
    I haven't really thought about a start attack animation. CancelAttackAnimation simply cancels the current animation once and then allows the AI to generate another attack based on its attack speed. I could look into something like PauseAttacks that would temporarily stop allowing AI to generate attacks. Then something like ResumeAttacks to allow them to generate again. I could see how this could add some cool functionality. I'll look into it.

    I've thought about similar functionality and I will keep it in mind. My focus right now is getting every bug fixed and making sure each feature works flawlessly. I've also been rewriting many features that have needed improvement. This should all make adding advanced functionality easier in the future. Once 3.0 is released, I will look into this further.
     
    SickaGamer likes this.
  31. SickaGamer

    SickaGamer

    Joined:
    Jan 15, 2018
    Posts:
    1,136
    This would allow someone to do a lot of custom stuff w/ C# and say buzz off FSM and BTrees!
     
  32. SickaGamer

    SickaGamer

    Joined:
    Jan 15, 2018
    Posts:
    1,136
    My Emerald Wave Spawner for you folks

    Code (CSharp):
    1. using System.Collections;
    2. using System.Collections.Generic;
    3. using UnityEngine;
    4. using EmeraldAI.Utility;
    5. using EmeraldAI;
    6. using EmeraldAI.Example;
    7.  
    8.  
    9. public class EmeraldAIWaveSpawner : MonoBehaviour
    10. {
    11.     public Transform SpawnPoint;
    12.     public Transform Destination;
    13.     private Transform myTransform;
    14.     public List<GameObject> SummonCharacters = new List<GameObject>();
    15.     private List<GameObject> myCharacters = new List<GameObject>();
    16.     private int CurrentCompanions = 0;
    17.     public int NumberofWaves = 3;
    18.     private int CurrentWaves = 0;
    19.     public AudioClip StartWaveSoundClip;
    20.     public AudioClip EndWaveSoundClip;
    21.  
    22.     // Start is called before the first frame update
    23.     void Start()
    24.     {
    25.         for (int i = 0; i < SummonCharacters.Count; i++)
    26.         {
    27.             myCharacters.Add(SummonCharacters[i]);
    28.         }
    29.         CurrentCompanions = myCharacters.Count;
    30.     }
    31.  
    32.     // Update is called once per frame
    33.     void Update()
    34.     {
    35.         if (CurrentWaves < NumberofWaves)
    36.         {
    37.             if (CurrentCompanions <= myCharacters.Count)
    38.             {          
    39.                 for (int i = 0; i < myCharacters.Count; i++)
    40.                 {
    41.                     Vector3 SpawnPosition = SpawnPoint.transform.position + SpawnPoint.transform.forward * 5 + (Random.insideUnitSphere * 2);
    42.                     SpawnPosition.y = SpawnPoint.transform.position.y;
    43.                     GameObject SpawnedAI = EmeraldAIObjectPool.Spawn(SummonCharacters[i], SpawnPosition, Quaternion.identity);
    44.  
    45.                     //Set an event on the created AI to remove the AI on death
    46.                     SpawnedAI.GetComponent<EmeraldAISystem>().DeathEvent.AddListener(() => { RemoveAI(); });
    47.                     CurrentCompanions++;
    48.  
    49.                     SpawnedAI.GetComponent<EmeraldAIEventsManager>().SetDynamicWanderPosition(Destination);
    50.                 }
    51.                 CurrentWaves++;
    52.                 PlayAudioClip(StartWaveSoundClip);
    53.             }
    54.            
    55.            
    56.         }
    57.  
    58.     }
    59.  
    60.  
    61.     public void RemoveAI()
    62.     {
    63.         CurrentCompanions--;
    64.     }
    65.  
    66.     private void PlayAudioClip(AudioClip audioClip)
    67.     {
    68.         if (audioClip == null) return;
    69.         var audioSource = GetComponentInParent<AudioSource>();
    70.         if (audioSource == null)
    71.         {
    72.             if (transform.parent == null)
    73.             {
    74.                 AudioSource.PlayClipAtPoint(audioClip, FindObjectOfType<SmoothMouseLook>().transform.position);
    75.                 return;
    76.             }
    77.             audioSource = transform.parent.gameObject.AddComponent<AudioSource>();
    78.         }
    79.         audioSource.spatialBlend = 0f;
    80.         audioSource.PlayOneShot(audioClip);
    81.     }
    82. }
    83.  
     
    HezoMelo and iChuy like this.
  33. SickaGamer

    SickaGamer

    Joined:
    Jan 15, 2018
    Posts:
    1,136
    NPC Healer Class w/ RFPS controller (replace this with yours).

    Code (CSharp):
    1. using UnityEngine;
    2. using System.Collections.Generic;
    3. using UnityEngine.UI;
    4. using UnityEngine.AI;
    5. using System.Collections;
    6. using UnityEngine.Events;
    7. using EmeraldAI.Utility;
    8. using PixelCrushers.DialogueSystem;
    9.  
    10.  
    11. namespace EmeraldAI
    12. {
    13.  
    14.     [RequireComponent(typeof(BoxCollider))]
    15.     [RequireComponent(typeof(NavMeshAgent))]
    16.     [RequireComponent(typeof(AudioSource))]
    17.     [RequireComponent(typeof(EmeraldAIDetection))]
    18.     [RequireComponent(typeof(EmeraldAIInitializer))]
    19.     [RequireComponent(typeof(EmeraldAIBehaviors))]
    20.     [RequireComponent(typeof(EmeraldAIEventsManager))]
    21.     [SelectionBase]
    22.  
    23.  
    24.     public class NPCHealer : MonoBehaviour
    25.     {
    26.  
    27.         //Support Abilities
    28.         public EmeraldAIAbility m_EmeraldAIAbility;
    29.  
    30.         //public UnityEvent OnHealEventNPC;
    31.         protected static GameObject ObjectPool;
    32.  
    33.         public GameObject SpawnEffect;
    34.         //public List<AudioClip> SpawnEffectSounds;
    35.      
    36.         public AudioClip[] SpawnEffectSound;
    37.         //public AudioClip SpawnEffectSound;
    38.  
    39.         //Healing Cooldown Items
    40.         protected Coroutine HealingOverTimeCoroutine;
    41.         protected int HealthPercentageToHeal = 30;
    42.         protected bool HealingCooldownActive = false;
    43.         public int HealingCooldownSeconds = 8;
    44.         float HealingCooldownTimer;
    45.         protected int CurrentHealth;
    46.         protected int StartingHealth = 15;
    47.         public int AmountToHeal;
    48.        
    49.  
    50.         protected EmeraldAIInitializer EmeraldInitializerComponent ;
    51.         protected EmeraldAIEventsManager EmeraldEventsManagerComponent;
    52.         protected EmeraldAIBehaviors EmeraldBehaviorsComponent;
    53.  
    54.         //RFPS Variables
    55.         private FPSPlayer fpsPlayer = null;
    56.         protected float healthToAdd;
    57.  
    58.  
    59.  
    60.  
    61.         // Start is called before the first frame update
    62.         void Start()
    63.         {
    64.             EmeraldInitializerComponent = GetComponent<EmeraldAIInitializer>();
    65.             EmeraldInitializerComponent.Initialize();
    66.         }
    67.  
    68.         // Update is called once per frame
    69.         void Update()
    70.         {
    71.             //Healing cool down to avoid an AI healing too often
    72.             if (HealingCooldownActive)
    73.             {
    74.                 HealingCooldownTimer += Time.deltaTime;
    75.  
    76.                 if (HealingCooldownTimer >= HealingCooldownSeconds)
    77.                 {
    78.                     HealingCooldownTimer = 0;
    79.                     HealingCooldownActive = false;                  
    80.                 }
    81.             }
    82.             else
    83.             {
    84.                 FindPlayer();
    85.                 if (fpsPlayer.hitPoints < 100)
    86.                 {
    87.                  
    88.                     Heals();
    89.                 }
    90.             }
    91.  
    92.         }
    93.  
    94.         private void FindPlayer()
    95.         {
    96.             if (fpsPlayer == null)
    97.             {
    98.                 fpsPlayer = FindObjectOfType<FPSPlayer>();
    99.             }
    100.         }
    101.  
    102.         public void Heals()
    103.         {
    104.            
    105.            PlayAudioClip(SpawnEffectSound[Random.Range(0, SpawnEffectSound.Length)]);
    106.             GameObject.Find("Bcoles").GetComponent<EmeraldAISystem>().EmeraldEventsManagerComponent.PlayEmoteAnimation(1);
    107.             GameObject.Find("Bcoles").GetComponent<EmeraldAISystem>().EmeraldEventsManagerComponent.SpawnAdditionalEffect(SpawnEffect);
    108.             FindPlayer();
    109.             fpsPlayer.HealPlayer(Mathf.Min(AmountToHeal, fpsPlayer.maximumHitPoints - fpsPlayer.hitPoints));
    110.  
    111.             HealingCooldownSeconds = m_EmeraldAIAbility.AbilityCooldown;
    112.             HealingCooldownTimer = 0;
    113.             HealingCooldownActive = true;
    114.  
    115.         }
    116.  
    117.         private void PlayAudioClip(AudioClip audioClip)
    118.         {
    119.             if (audioClip == null) return;
    120.             var audioSource = GetComponentInParent<AudioSource>();
    121.             if (audioSource == null)
    122.             {
    123.                 if (transform.parent == null)
    124.                 {
    125.                     AudioSource.PlayClipAtPoint(audioClip, FindObjectOfType<SmoothMouseLook>().transform.position);
    126.                     return;
    127.                 }
    128.                 audioSource = transform.parent.gameObject.AddComponent<AudioSource>();
    129.             }
    130.             audioSource.spatialBlend = 0f;
    131.             audioSource.PlayOneShot(audioClip);
    132.         }
    133.     }
    134.        
    135.     }
     
  34. SickaGamer

    SickaGamer

    Joined:
    Jan 15, 2018
    Posts:
    1,136
    Spider Boss Fight with Emerald

    Code (CSharp):
    1. using UnityEngine;
    2. using System.Collections.Generic;
    3. using UnityEngine.UI;
    4. using UnityEngine.AI;
    5. using System.Collections;
    6. using UnityEngine.Events;
    7. using EmeraldAI.Utility;
    8. using EmeraldAI;
    9.  
    10. public class SpiderBoss : MonoBehaviour
    11. {
    12.     public Transform SpawnPoint;
    13.     private Transform myTransform;
    14.     public List<GameObject> SummonCharacters = new List<GameObject>();
    15.     private List<GameObject> myCharacters = new List<GameObject>();
    16.     private int CurrentCompanions = 0;
    17.     public int NumberofWaves = 3;
    18.     private int CurrentWaves = 0;
    19.     public AudioClip StartWaveSoundClip;
    20.     protected int SpiderQueenHealth;
    21.  
    22.     // Start is called before the first frame update
    23.     void Start()
    24.     {
    25.         for (int i = 0; i < SummonCharacters.Count; i++)
    26.         {
    27.             myCharacters.Add(SummonCharacters[i]);
    28.         }
    29.         CurrentCompanions = myCharacters.Count;
    30.     }
    31.  
    32.     // Update is called once per frame
    33.     void Update()
    34.     {
    35.         SpiderQueenHealth  = GameObject.Find("Spider Queen").GetComponent<EmeraldAISystem>().CurrentHealth;
    36.  
    37.         if ((SpiderQueenHealth <= 1500 && SpiderQueenHealth >= 1000) && CurrentWaves == 0)
    38.         {
    39.             if (CurrentCompanions <= myCharacters.Count)
    40.             {
    41.                 for (int i = 0; i < myCharacters.Count; i++)
    42.                 {
    43.                     Vector3 SpawnPosition = SpawnPoint.transform.position + SpawnPoint.transform.forward * 5 + (Random.insideUnitSphere * 2);
    44.                     SpawnPosition.y = SpawnPoint.transform.position.y;
    45.                     GameObject SpawnedAI = EmeraldAIObjectPool.Spawn(SummonCharacters[i], SpawnPosition, Quaternion.identity);
    46.  
    47.                     //Set an event on the created AI to remove the AI on death
    48.                     SpawnedAI.GetComponent<EmeraldAISystem>().DeathEvent.AddListener(() => { RemoveAI(); });
    49.                     CurrentCompanions++;
    50.                 }              
    51.  
    52.                 PlayAudioClip(StartWaveSoundClip);
    53.                 CurrentWaves++;
    54.              
    55.             }
    56.         }
    57.            else if((SpiderQueenHealth <= 1000 && SpiderQueenHealth >= 500) && CurrentWaves == 1)
    58.             {
    59.             if (CurrentCompanions <= myCharacters.Count)
    60.             {
    61.                 for (int i = 0; i < myCharacters.Count; i++)
    62.                 {
    63.                     Vector3 SpawnPosition = SpawnPoint.transform.position + SpawnPoint.transform.forward * 5 + (Random.insideUnitSphere * 2);
    64.                     SpawnPosition.y = SpawnPoint.transform.position.y;
    65.                     GameObject SpawnedAI = EmeraldAIObjectPool.Spawn(SummonCharacters[i], SpawnPosition, Quaternion.identity);
    66.  
    67.                     //Set an event on the created AI to remove the AI on death
    68.                     SpawnedAI.GetComponent<EmeraldAISystem>().DeathEvent.AddListener(() => { RemoveAI(); });
    69.                     CurrentCompanions++;
    70.  
    71.  
    72.                 }
    73.                 PlayAudioClip(StartWaveSoundClip);
    74.                 CurrentWaves++;
    75.             }
    76.  
    77.             else if((SpiderQueenHealth <= 500 && SpiderQueenHealth >= 0) && CurrentWaves == 2)
    78.             {
    79.                 for (int i = 0; i < myCharacters.Count; i++)
    80.                 {
    81.                     Vector3 SpawnPosition = SpawnPoint.transform.position + SpawnPoint.transform.forward * 5 + (Random.insideUnitSphere * 2);
    82.                     SpawnPosition.y = SpawnPoint.transform.position.y;
    83.                     GameObject SpawnedAI = EmeraldAIObjectPool.Spawn(SummonCharacters[i], SpawnPosition, Quaternion.identity);
    84.  
    85.                     //Set an event on the created AI to remove the AI on death
    86.                     SpawnedAI.GetComponent<EmeraldAISystem>().DeathEvent.AddListener(() => { RemoveAI(); });
    87.                     CurrentCompanions++;
    88.  
    89.                 }
    90.                 PlayAudioClip(StartWaveSoundClip);
    91.                 CurrentWaves++;
    92.             }
    93.         }
    94.  
    95.     }
    96.  
    97.     public void RemoveAI()
    98.     {
    99.         CurrentCompanions--;
    100.     }
    101.  
    102.     private void PlayAudioClip(AudioClip audioClip)
    103.     {
    104.         if (audioClip == null) return;
    105.         var audioSource = GetComponentInParent<AudioSource>();
    106.         if (audioSource == null)
    107.         {
    108.             if (transform.parent == null)
    109.             {
    110.                 AudioSource.PlayClipAtPoint(audioClip, FindObjectOfType<SmoothMouseLook>().transform.position);
    111.                 return;
    112.             }
    113.             audioSource = transform.parent.gameObject.AddComponent<AudioSource>();
    114.         }
    115.         audioSource.spatialBlend = 0f;
    116.         audioSource.PlayOneShot(audioClip);
    117.     }
    118. }
    119.  
     
  35. tbgames3000

    tbgames3000

    Joined:
    Mar 3, 2017
    Posts:
    3
    Hello, I'm using trying to have the injured sound play when I hit the ai but it's not playing. I have added a sound file in the list of sounds to play but for some reason it never plays. I have a capsule collider that I'm using as a weapon to hit the ai. Do I need to add a specific tag to the collider for it to work or any other thing? The ai also has a box collider on it and I've made sure it's big enough to detect that it was collided with.
     
  36. HezoMelo

    HezoMelo

    Joined:
    Apr 18, 2020
    Posts:
    3
    Hey, I see this is an older bug report but I am currently experiencing the bug where ranged attacks will not fire of, but the AI reacts to the player. I tried a fresh install creating new characters and multiple other fixes to no avail. AI debug shows that I am aiming at my character and the layers are correct, the AI just doesn't initiate firing. Does anyone have a fix to this? I'm willing to email a copy of my project or AI setup for better help.

    FYI I am using the UCC / Emerald integration for my main character but the problem persists even when using the Demo 3rd person controller that comes with the package.
     
  37. wood333

    wood333

    Joined:
    May 9, 2015
    Posts:
    763
    Quick question. I have a stag set up. If I hit it with a melee weapon it will begin fighting with me. If I shoot it with a gun it just keeps walking around aimlessly.
     
  38. Ben2390

    Ben2390

    Joined:
    Sep 6, 2014
    Posts:
    10
    I'm sure this is not the case but is the range attack animation playing? if so, check you're calling the event on the animation?
     
  39. trojant

    trojant

    Joined:
    May 8, 2015
    Posts:
    65
    Hi,@BHS
    I made a bear. In real life, when it walks and runs, we can hear its breathing sound. Can a new sound function be added to the this plugin in the future? It is like a special idle sound, but when walking and running, the frequency and size of the volume will change, and will not affect the playback of walk, run, attack and other sounds. It is like two or multiple audio sources, playing different sounds to simulate the real sound.Or do you have a better way to simulate real sound?
    Thank you.
     
  40. Mad_Mark

    Mad_Mark

    Joined:
    Oct 30, 2014
    Posts:
    468
    Well, I don't know if it is "better", but the way I have tackled this myself is to create the wav files of the bear breathing and either:
    1. Add an event to the walk animation. This will fire off the breathing sound at that specific point in the animation cycle. OR
    2. Create a script that will take a random float between 1 and 5,000 and if it is greater than say, 3000, play the breathing sound. Add the script to your bear. This script can be called by an animation event (which will fire at every walk cycle, but only play the sound SOMETIMES. OR
    3. Toss the sound into the Footstep list. It won't play the footstep sound that one time, but does it matter? Need it to play more often? Add it multiple times to the list!​

    There ya go. 3 ways that I have done similar things.
    Cheers!
     
    trojant and StevenPicard like this.
  41. trojant

    trojant

    Joined:
    May 8, 2015
    Posts:
    65
    Thank you for your reply.
    Without looking at the plugin function, I think the second is my current solution, because I think this sound is an additional sound. I need to add an audio source separately and control it with a script, and then it will change the frequency and size of breathing according to the speed parameter of the animation. Maybe sometimes it's random.:)
     
  42. HezoMelo

    HezoMelo

    Joined:
    Apr 18, 2020
    Posts:
    3
    Hey, an easy way to pull this off would be by adding an audiosource to your AI and adding an audiosourcplay event to your "On player detection event" or "On start combat event".
     
    Last edited: Aug 24, 2021
    trojant likes this.
  43. SeymourGutz

    SeymourGutz

    Joined:
    Aug 9, 2019
    Posts:
    15
    I'm happy Sound Detection is winning, and hope this can include AI shouting for backup from allies within range.
     
  44. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,494
    Injured sounds should play when an AI receives damage. If it's not playing, the AI is not receiving damage.

    How are you damaging the AI? Are you using the Damage function? https://github.com/Black-Horizon-Studios/Emerald-AI/wiki/Emerald-AI-API#damaging-an-ai
     
  45. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,494
    The problem with UCC is usually that its center position is at the base of the player making it difficult for AI to properly detect its collider. Emerald AI 3.0 will fix this by adding a system called TargetPositionModifier that allows users to adjust the position where AI will aim at a specific target, such as a player. Until 3.0 is released, I don't have a solution to resolve this.

    However, if the problem is still happening with the included Emerald AI player, then it's likely you need to add an EmeraldAttackEvent as explained here: https://github.com/Black-Horizon-Studios/Emerald-AI/wiki/Creating-Attack-Animation-Events
     
  46. BHS

    BHS

    Joined:
    Dec 21, 2009
    Posts:
    4,494
    This usually means you are damaging an AI that's outside of the AI's detection radius and you are not passing the AttackerTransform parameter within the Damage function.
     
  47. MartinsWar

    MartinsWar

    Joined:
    May 21, 2015
    Posts:
    3
    Couldn't find where anyone had made the opsive spells damage emerald AI. Here is a custom ImpactAction I made that will damage an emerald AI with the opsive bridge attached. Just select it as the impact action when setting up the spell.
    Code (CSharp):
    1. using System.Collections;
    2. using System.Collections.Generic;
    3. using UnityEngine;
    4. using EmeraldAI;
    5. using Opsive.UltimateCharacterController.Items.Actions;
    6. using Opsive.UltimateCharacterController.Items.Actions.Magic.ImpactActions;
    7.  
    8.  
    9. public class EmeraldSpellDamage : ImpactAction
    10. {
    11.     [Tooltip("The damage amount.")]
    12.     [SerializeField] protected float m_Amount = 10;
    13.     [Tooltip("The magnitude of the force that is applied to the object.")]
    14.     [SerializeField] protected float m_ForceMagnitude;
    15.     [Tooltip("The number of frames to add the force to.")]
    16.     [SerializeField] protected int m_ForceFrames = 1;
    17.     [Tooltip("Should the subsequent Impact Actions be interrupted if the Health component doesn't exist?")]
    18.     [SerializeField] protected bool m_InterruptImpactOnNullHealth = true;
    19.  
    20.     private EmeraldAISystem _emeraldAI;
    21.     private MagicItem magicItem;
    22.  
    23.  
    24.     public float Amount { get { return m_Amount; } set { m_Amount = value; } }
    25.     public float ForceMagnitude { get { return m_ForceMagnitude; } set { m_ForceMagnitude = value; } }
    26.     public int ForceFrames { get { return m_ForceFrames; } set { m_ForceFrames = value; } }
    27.     public bool InterruptImpactOnNullHealth { get { return m_InterruptImpactOnNullHealth; } set { m_InterruptImpactOnNullHealth = value; } }
    28.  
    29.  
    30.  
    31.     /// <summary>
    32.     /// Perform the impact action.
    33.     /// </summary>
    34.     /// <param name="castID">The ID of the cast.</param>
    35.     /// <param name="source">The object that caused the cast.</param>
    36.     /// <param name="target">The object that was hit by the cast.</param>
    37.     /// <param name="hit">The raycast that caused the impact.</param>
    38.     protected override void ImpactInternal(uint castID, GameObject source, GameObject target, RaycastHit hit)
    39.     {
    40.         _emeraldAI = target.GetComponent<EmeraldAISystem>();
    41.  
    42.         if (_emeraldAI != null )
    43.             _emeraldAI.Damage((int)Amount, EmeraldAISystem.TargetType.Player, source.transform);
    44.     }
    45.  
    46. }
     
  48. wood333

    wood333

    Joined:
    May 9, 2015
    Posts:
    763
    This happens when I am standing right beside the Emerald NPC, and the On Take Damage () event is firing. Yet, no reaction.
     
  49. wood333

    wood333

    Joined:
    May 9, 2015
    Posts:
    763
    So, if we aren't passing the AttackerTransform parameter, where do I go to correct that?
     
  50. MartinsWar

    MartinsWar

    Joined:
    May 21, 2015
    Posts:
    3
    I am using emerald with the opsive character controller and have it mostly working. I can damage ai with melee and magic projectiles and can be damaged by melee ai. I set up a ranged ai and it can target me and shoot projectiles but the projectiles don't damage me on collision. Any ideas?
     
unityunity