A Unity ID allows you to buy and/or subscribe to Unity products and services, shop in the Asset Store and participate
in the Unity community.
Separate names with a comma.
Discussion in 'Assets and Asset Store' started by BHS, Jun 26, 2015.
HQ FPS weapon assets And STP Template asset integration with emerald 3.0
Thanks that helped a lot.
A* Pathfinding has been mentioned many times already, but as far as I can see there is no official support for it, yet.
Does someone have an integration they can share, or at least advise on how to go about creating one?
@BHS an update with the strafing one would have been great, if sound detection is taking time do this one
Strafing - Allow AI to strafe in circles around their targets within a customizable distance.
That was posted 2015. What is the status on A* pathfinding support?
Hi, how can I setup a taunt sound? So when the AI detects an enemy, he should yell and then run towards the player.
Oh wow, I literally just came here to ask about pathfinding since A* is what I just switched to.
If pathfinding isn't in @BHS could you share how it can be implemented?
Hello. I have very simple AI for the infantry units in my game, which I use for them to move around when the camera is not showing them. It also calculates the results of combat when they are off camera in a simple way.
However, when the units are on camera, and the player can see them, I would like a more advanced AI system that would produce interesting and realistic combat. I am thinking of getting Emerald AI for this.
Is it possible to integrate Emerald AI with my system, so that it only controls units when they are on screen and they can be seen by the player? And as soon as they go off screen, is it possible for my simple AI system to take control of them again?
Thank you for your advice.
Looking forward to the sound detection update. I'd imagine it wouldn't take too long to implement. Will it be radius based sound detection where you can define the alert status of each detection based on its distance? So if far away, but inside the radius, the AI will be curious as to where the sound has come from and plays a specific animation, closer sound detection becomes more aware and begins to search for where it was coming from and very close will know where the sound is coming from and seeks out the player or other AI. Or will it just be based on one setting radius with how loud the sound is?
Hey, I am looking for a little advice. I am making something very similar to cod zombies (waw, or bo1) where there is one target only (singleplayer) and the zombies follow it relentlessly until the target (player) dies. What I am noticing, is that the way the asset works is more like a detection-range, and If I want the same functionality that I mentioned, I need to increase the detection zone. Issue with that is that the performance tanks as soon as I spawn 40 or so zombies (Ryzen 2 6 cores, 1660TI).
Clearly this isn't how I should do it. There must be a setting which sets a single target, and the AI should behave aggressively relentless towards it, but it seems I am missing that. Is there a guide that I didn't see about achieving this, or should I stick to fiddling the settings and maybe write custom code for this?
I need the melee system that the pack offers more than anything, as I can write pathfinding and animation systems myself, so if that can be de-coupled, that would be great. Can it?
is there any way I coould use combat text on other objects than emerald AI?
like destructable enviro elements?
I really like the effect but can't find in docs or in code how it is created on spot, besides the runtime spawned canvas
I'm having trouble getting the ranged attacks to work. I have an animation assigned to the range with an EmeraldAttackEvent. The enemy is definitely seeing me because it tracks me, and if I change it to melee, it attacks just fine with the melee attacks, but then when I change it to both or range to test the ranged attack, it simply won't trigger it. I'm watching the animator in a second window and it just doesn't want to trigger. Any idea what I may be missing? No errors in the console either.
Obstruction ignore has been tested with both nothing and everything and neither seems to help.
I haven't tested this myself, but I believe this API call should do what you want,
Try making a custom function that is triggered by Emerald AI System script -> AI Settings -> Events -> On PlayerDetection Event() that tracks if the player target has been set and if not calls OverrideCombatTarget on each of your AI.
[Version 2.0] I have a goat object that just generally wanders around and would like to make it follow the player when they perform a certain action nearby (think of the goat quest in The Witcher 3). However, no matter what I try, the goat continues to keep wandering, or just becomes stationary.
I have tried setting the waypoint target as the character, changing behaviour type, setting the player relation to Enemy, setting the Follow target, and nothing works.
The closest thing was the "SetCombatTarget" which got the goat turning towards the player and looping through one of their idle animations, but they did not start moving towards the player.
Have you checked the goat's detection settings (Detection & Tags -> Tag & Faction -> Detection layers) Make sure that your player is on the same layer that's listed on your detection layers and that it is tagged with the tag "Player"
Check and make sure that your animations are set properly also. Sometimes if it just stops, it could be because it is missing an animation such as combat run/walk. Also, have you tried making the goat as a pet? That may be better than having it as an enemy. The pet behavior type is designed to follow you but not attack your enemies if that's what you want.
Emerald AI has specific hard-coded requirements to allow changing it into a following companion. If the AI does not meet those requirements then it won't work. Unless it's changed, the AI must be set to Cautious and either Brave or Foolhardy confidence
if sound detection is taking long strafing should be done first, AI is still standing in front of player which seems very dumb if it strafe around player in circle it seems very good also hard to attack
hello, tell me how to spread bullets on the enemy
Awesome, this worked! It was due to the detection layer not being set to the same layer as the player.
For future generations, here's what the fix was with the help of Black Horizon Support:
I used the debug to find out if the AI could "see" my player https://github.com/Black-Horizon-Studios/Emerald-AI/wiki/Enabling-an-AI's-Debug-Tools
It turns out, the view was occluded. The reason is that the transform of the player was too near the ground. I then applied the target position modifier and got it near the center of the player. https://github.com/Black-Horizon-Studios/Emerald-AI/wiki/Using-the-Target-Position-Modifier
Next, I changed obstruction ignore layers to nothing.
@BHS Projectiles have a "High Quality Collisions" option that turns on Continuous Collision Detection, but this doesn't work because the projectiles use Trigger colliders and Trigger colliders never use CCD.
Hello, I am working on a multiplayer game where I am using Emerald AI for enemies. I would like to enable AI scripts only on the host. Clients will only receive position and animation of the AI. I wanted to ask what is the best way to disable an AI at the start and reenable it if we are the host. Would disabling all Emerald AI scripts and enabling them later at the runtime be ok?
The Hit effect animation of AI doesn't seem to work when AI is walking or running towards target. Any solutions?
@BHS Hi there, is there a general eta for the next update?
Excuse me, I have a question on accessing the combat text system. How can I call the CreateCombatText function in Invector Character Controller?
Has anyone been able to get this to work with the AI Behavior type set to Passive? I don't want the AI attacking all the time, only when provoked. Seems the AI only works with Aggressive behavior .
I have a small issue with the obstruction detection when the AI is using Ranged attack. In particular if the first AI is blocking the view of the second one and this is behind the first, it will not proceed to go close to the Player but will just stand there doing nothing.
I set the obstructed action to Move closer immediately but it does not really help.
Any suggestion? I would really like to make the obstructed AI walk around the blocking one and reposition itself.
Thank you and best regards,
Hello, I had a look but can't see anything for this in the forums.
Is there any way to teleport my AI in a way where it will completely ignore the fact it has just been moved?
Essentially my world is on a treadmill where if the player gets further than 200m away from the origin they and everything else will get shifted back towards zero.
Problem is, a wandering AI that gets teleported with navmmeshagent.warp() will not really know where it is. For example, with a 10m wander dynamic distance set, he'll waddle off to the north east and a breakpoint shows 132.8336 remainingDistance in the agent.
1. Load scene with player at x1024, y128, z1024
2. First run of the treadmill runs on first frame, moving player to 0,0,0 and everything around him to that + offset.
3. 5 seconds go by, and the AI decides to wander.
4. It wanders far longer than the permitted distance, until it hits a wall. It appears to have picked a point on the navmesh from its original position and not its new position that it has now been at for several seconds.
is there a way I can manually teleport an AI without the player noticing any unusual behaviour given the context?
hasPath = false;
bool hasPath = false;
Vector3 targetPos = Vector3.zero;
public void Move(Vector3 offset)
hasPath = false;
hasPath = true;
targetPos = agent.pathEndPosition + offset;
agent.Warp(transform.position + offset);
transform.SetPositionAndRotation(transform.position + offset, transform.rotation);
Hi, looks like the 'EventsManager.KillAI();' function does not work, causes the AI to try to find target instead. To avoid this I just use damage with high amount, but wanted to call out the bug. Oh using the latest version and unity version 2021.3.0f1.
hi every one i am getting error with like this cannot covered float into int
Emerald AI 3.0 and invector
i have an error coming up with invector 2.6.2a
its say cannot covert float into int
[Emerald AI 3.0]
I am having an issue with Combat Hit Animations. I want that every time the AI is hit to play the Hit Animation but it seems that this is not happening. I assume is somehow 'random'? The problem is that most of the time I kill the AI without triggering the animation.
Edit: I see the hit animation only appears if the AI is in IDLE mode. If he is running or attacking me will not play. IS there a solution for that?
I tried to use an event: OnTakeDamage but I don't know what to do there. I cant use 'emotes' because the AI is in combat and emotes cannot be used. I searched the API, hoping to find a 'pause emerald ai feature' and then simply play my animation but there is no feature for that.
Any idea? Thank you
hi i am using invector 2.6.2a having error with integration any help
How are you calling the KillAI function? It should kill an AI as all it does is deal a high amount of damage. The only way your AI would look for a target is if it had more than 9999999 health. If this is the case, increase 9999999 to something even higher.
/// Instantly kills this AI
public void KillAI()
I'm currently looking into the Invector issue.
Emerald AI 3.1.5 is now live!
This update is important and should resolve any remaining detection issues. Users should also now use the Collider Position Source when using the Target Position Modifier on their character controllers as this will now dynamically adjust in size depending on the character controller's collider height.
The Target Position Modifier section on the Emerald AI Wiki has been updated with using these new features: https://github.com/Black-Horizon-Studios/Emerald-AI/wiki/Using-the-Target-Position-Modifier
3.1.5 Release Notes
Improved the Target Position Modifier script to allow a character controller's collider to be used for positioning (with still allowing for a height offset). This allows for the hit point to reposition during runtime if a player crouches and the collider changes size.
Improved the way line of sight detects targets (both detected and undetected) by using the collider's bounds.
Improved some code in the SearchForTarget function.
Improved the way the movement blend trees use their movement turning animations so they're more likely to play during movement turns. This is especially noticeable for quadruped models with turning animations.
An option called Movement Turning Sensitivity has been added to AI's Settings>Movement>Turning Settings to adjust the above option. A value of 1 was the original amount and the new default is a value of 2.
Fixed a bug that could cause some character controllers to not reliably be detected.
Fixed a bug that wouldn't properly apply some ranged animations to an AI that was using the Both Weapon Types option.
Fixed a bug that could allow an AI to rotate towards non-combat position while playing an Emote Animation.
Fixed a bug that caused an error when killing an AI that hadn't yet detected a target.
Fixed a bug that allowed a hit effect to spawn on both the default hit position and the impact effect position when using Location Based Damage (This should only be played once from the impact effect position).
Quick question, if I want to stun the enemy, preventing them from attacking and moving, which API calls would i use for this?
As far as i know for movement it would be the event EventsManager.StopMovement();
However for the attacking, im not so sure, would it be EventsManager.CancelAttackAnimation(); ?
@BHS any thoughts on this?
Yes, hit animations will only play when the AI is idling or not moving. This is to prevent an exploit where the player can continuously hit an AI and never allow it to attack. I'm working on finding a solution that allows hit animations to play better while still giving an AI a chance to attack. One solution for now is to just set the AI's Min and Max Attack Speed to 1. This should give the AI a chance to play a hit animation and still attack.
Thanks for the reply, I will test the Attack Speed hack.
Regarding the issue, maybe a solution would be that when the AI is moving/attacking to have a % for showing the hit animation. The dev could set it to 50% so half of the attacks will also result into playing the animation
I looked through the API and found the general gist of what needs to be done.
How would I go about pausing the AI for something like the player throwing an enemy? I want to include special one on one attacks but not too sure how to go about it.
Hi having a issue with the emeraldAIEventsManager.ResetAI(); on AI using both melee and ranged. If a stay at a distance and the AI never engages in melee its fine, however if I go in and it switches to melee, the next time its respawns is just targets the player and never attacks. Its like its stuck between those two states. I've not modified the ai, I just call the reset method when it dies.
If anyone is trying to implement a stun effect, the following worked for me:
public void EnemyStun(int stunDuration)
EmeraldComponent.enabled = false;
emeraldAIDetection.enabled = false;
IEnumerator EndStunEffect(int _stunDuration)
yield return new WaitForSeconds(_stunDuration);
if (EmeraldComponent.CurrentHealth <= 0)
//Enemy dies, so do nothing otherwise you'll get an error.
yield return null;
else if (EmeraldComponent.CurrentHealth > 0)
EmeraldComponent.enabled = true;
emeraldAIDetection.enabled = true;
I couldnt get any animation to play during the stun. If anyone has any ideas i'd be keen to try!
Hi, I think you just can call the gameObject.GetComponent<Animation>().Play("stuntAnim");
this should do the trick, right?
Is there any general fix for Emerald AI not using all Attack animations assigned to the System component?
I import an Animation Profile with multiple attack animations, but they only end up using 1 at runtime. I then manually add the attack animations to the list of attack animations under the Animations > Combat tab in the System component, and still, only uses 1 at runtime.
I even refresh the Animator and can see that it has multiple attack animations assigned to the Animator. If I put in a debug log in EmeraldAICombatManager.cs at line 16 to check the "EmeraldComponent.MeleeAttacks.Count", it always just returns 1.
Can this be fixed at all?
Did you set up the melee attacks damage settings for each attack?
i damage the enemy and his not following me
+1, strafing would be an incredible boost to the AI's combat performance
Setting up Ranged Weapon Hand IK
when I turn on Look at options--IK type--Emerald IK, enemy stops shooting
when I turn on Look at options--IK type--Unity IK, enemy shooting
tell me how to fix