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.
Discussion in 'Assets and Asset Store' started by BHS, Jun 26, 2015.
I really like the red outline on the enemy being targeted. Nice.
Hey I'm implementing a turn based combat system. What i'd like to do is have a squad of say 5 AI entities with behaviour states (melee attacker, range attacker, healer / support, wizard etc.)
At the start of your turn you issue attack or move waypoint commands, when the orders for all 5 are issued, the AI fight mode activates
Basic logic: entity move to position, if in melee range do melee attacks else if at range do range attacks and spells
Each AI entity will do say 2-3 attacks or special abilities then go into combat idle animation in a particular turn order.
I would be most grateful for some advice on how to Emerald AI could be used to help accomplish this!
This possible if you use some higher level control logic to manage your AI units. I wrote a bunch of Playmaker actions for just this sort of thing. It will also require one small code change, which @BHS is looking to add to the next update, which relinquishes attack control from EmeraldAI and lets another script dictate that. As it is out of the box, though, you won't be able to accomplish it.
Is the Invector Integration tutorial/video still valid for Emerald 2.0 - 126.96.36.199 ?
The tutorial docs get you a working integration, yes.
I have a couple of issues with raindeer AI's.
My character approaches them and they are setup as cowards but they just keep walking in a straight line regardless.
First: I want to get the AI's to run away when within a certain distance or when seen. Like a coward would.
Second: Is there anything that can be done about a group of say 4 raindeer spawned with crux walking in a straight line all together in unison?
Third: the deer don't seem to pay attention to steepnes and walk up and down slight cliffs/hills without changing from their straight line path.
@BHS what are the chance you do a little bit of a visual script piece to make the AI do more complex movements/attacks ect..?
is this still implemented with emerald ai?
my ai companions i've also notice when following the player if i stop they carry on walking any ideas how to make them follow and stop when my player stops but also wander around?
@BHS I can't wait for the update. I'm really looking forward to the combat text.
BHS, thanks for the reply, I took a video of it happening and have a screenshot of the only collider on the AI. The transform for the projectile is well in front of the weapon. I have set the ranged projectile to many different prefabs, I'm using this one, cause it shows what is happening the best. I'm using the Opsive UCC if that makes any difference. The same thing happens when the AI's are shooting at each other. The video is here https://twitter.com/brion_holland/status/1193237590217900034?s=20
This is an example of what I am talking about. The character sometimes acquires the target and attacks, sometimes (more often than not) the AI just pushes the character around. This is using the Invector integration. I set it up exactly as directed in the tutorial. The tags and layers are correct otherwise I could not damage (or take damage) the enemy.
AI Pushing Player
I cant play hit animation on my "zombies". They recieve damage, with that all ok. But they just walking to player, dont play any hit animations. Help me please!
Cant wait for the update, looks great, mostly for the new sounds/particle effects Wanted to show a short vid of a fight with Dilophosarus, EAI has been a god send to the project:
Increase the mass of the player, on the rigid body?
@Nitrox32 please check your "stopping distance" (Ai Settings/Movement), it sets the distance that an agent will stop before waypoints or a target (or complete a attack animation).
that'll help too. I use invector, and had to increase the characters mass or the AIs to match as sometimes the AI slide into you and push you, or vice versa. this may be fixed now though. Not updated to the latest Emerald yet.
@julianr yea ive run into that prob before, my dinos were pushin the player around while attacking, and no damage dealt. So i adjusted the Stopping Distance (the attacks were actually behind me, and i could see inside the dinos body).
As soon as i set the dino farther away during attacks, damage was done, and the close up look was great.
whats the max amount of companions you can have ?
This should be possible with some custom modifications. The only limitation currently is that there's no way to manually trigger an attack. I plan on adding the ability to do this through code with the next update.
Make sure you have your tags and layers setup correctly. These are what allow AI to tell what is a target and what isn't. Also, if you want your AI to flee from the player, make sure you have AI Flees From Player set to Always. This is located under the Tag Options.
Herd functionality isn't yet added, but a work around could be to assign one of the 4 reindeer a the companion behavior type so the other 3 reindeer follow the 4th.
Use the Dynamic Wander Type. It allows you to control the max allowed steepness that waypoints can be generated.
I've considered this for a future update, but it wouldn't be for at least a few updates.
Not currently, but herd and breeding mechanics are what I have planned for the 2.4 update.
What animation is being used for firing? The AI seems to drop near the ground before or while firing. Unity colliders, when attached to the parent of the AI, do not follow animations. This may be why your projectiles are having issues (they may even be hitting the ground because of the AI dropping to the ground).
You also have a few errors in your Unity console, are these related to Emerald AI? If so, what are they?
They should stop where your player is according to their following stopping distance. If you are using Root Motion animations, ensure you have the Movement Type set to Root Motion in the Movement Settings.
Make sure your attack stopping distance is set high enough. I'll see if I can recreate this, but I've never encountered it with Invector.
AI will only play hit animations when not attacking or moving. This is to avoid player exploits where players can continuously trigger the hit animation and never allowing the AI to properly attack or move. If your hit animations are not working entirely, make sure they are enabled under the Animation settings and that you have applied hit animations to the hit animations list.
Awesome Looking great!
There's no cap. Each follower that a companion has is independent to that AI.
bhs i am using navmesh but i notice the companions get to close to my player and then walking into them and don't stop when my player does ?
Thanks Not sure about the tags as I set them up whilst setting the AI to attack. But they are set to Always Flee (but they dont) and steepness is set to dynamic and steepness setup also.
Thanks. I tried that already. Increasing the mass of either the player or the enemy had no effect.
I was able to make it work although I think I need more testing. I found that my stopping distance was high enough because my enemy would attack. If I stood there and didn't respond to the enemy attacks, the enemy would not try to push me around. However after I attacked the enemy would simply push me around. Changing the mass of the player had no effect. This is what I had to do to make it work. First, I had to disable the box collider that Emerald AI uses. I tried to remove this component but Emerald AI won't let me. I added a capsule collider to the AI and made its radius larger than the obstacle avoidance radius in the nav mesh agent. I'm not sure why it works now but I can say that if I turn on the box collider that Emerald AI needs, after the first player attack the AI just pushes my player around. A bug perhaps?
Stopping Distance is a big thing in that situation, and no, you cant remove the EAI box collider, but you can shut it off. Honestly changing/increasing the Mass wouldnt work in that senario, you think it would, but it doesnt. Glad you got it figured out, but just make sure that by increasing the capsule collider radius fits and doesnt cause any other probs down the line. Just as a side note, have you also tried decreasing the obstacle avoidance radius?
Best of luck bro
Maybe the hit animations should be put on another layer, like an "upper body" layer, so they can still play without having to stop general movement.
@BHS Another suggestion for something I hacked into my project for the time being. We have passive NPCs that required "Line of Sight" to allow the player to sneak up behind them to pick their pockets or steal from them. So I had to remove the restriction that forces passive AI entities to use the trigger detection type. I also had to hack in support for passive AIs to detecting the player without always require the " && EmeraldComponent.AIAttacksPlayerRef == EmeraldAISystem.AIAttacksPlayer.Always", as once again these are non-combat NPCs that we can sneak around. In our case, they aren't required to always attack the player.
You can also use Playmaker and have your AI start as Passive and then when some event happens change their Temperament so they attack.
Yea that's how I have it coded now, but I need Line of Sight always to ensure that the NPCs always have their native blindspots.
Yea, that's strange that he forces Trigger detect on Passive AI. That restriction should be removed.
would their be a way to say have the ai on aggressive or passive then when the player gets within distance make the ai change to a companion (like a taming method)?
The EmeraldAIPlayerDamage script has changed in the latest version, and I am not able to use the Integration video to get it correct for Invector Integration, damage to the player. I had it working in the previous version when the YouTube tutorial matched the script. The other scripts in the integration still match, and are working fine. What should the EmeeraldAiPlayerDamage script look like for the integration, now?
EDIT: I have damage Ai to Player working now, but I am only using part of the Integration tutorial, and completely ignoring the code segment the tutorial instructs me to insert.
Yes, you can do this in code. Or you could use my Playmaker actions, which have those actions coded for you.
ah right how would i go about doing this in code?
Well, you can download my Playmaker actions and just look at the code and copy and paste into your own scripts.
don't have playmaker would work without ?
Playmaker actions are just a way of wrapping up code to be used in Playmaker. So, you can just strip out the code from the Playmaker action and put into a regular script.
ah right brilliant where can i download ?
thank you is it the tame ai i need to integrate into mine ?
I did decrease the obstacle avoidance as well. That also seemed to help. It's now working about 90% of the time. I've got more tweaking to do but I on the right track. I'll post what I find out in case anyone else has this issue.