Emerald AI Integration

DocQ

Member
as default it is set to untagged when initially making the character, and the character works fine, but changing it makes it weird out. I will keep trying to figure it out, thanks again for your time. 2017 has always been more stable but the speed of 2018.2 along with VS pro and the biomes tempted me to 2018. Oh well, thanks for your time.
 

magique

Active member
Sorry I can 't help more at the moment. I'd have to try on 2018 to see if I get the same issue.
 

DocQ

Member
seems I spoke too soon, everything works now, except my player is not being damaged by the ai character when it attacks me, what causes this?
 

magique

Active member
seems I spoke too soon, everything works now, except my player is not being damaged by the ai character when it attacks me, what causes this?
Can you verify that the Capsule collider layer is set to Character?
 

magique

Active member
I double checked and if the Tag and Layer are not correct then the AI won't attack so you must have that correct. So if the AI is attacking then the only other piece to make it work is the DamagePlayer function in Emerald_AI. It should look like the following:

C#:
    public void DamagePlayer(){
        var tpcHealth =
        CurrentTarget.GetComponentInParent<Opsive.UltimateCharacterController.Traits.Health>();
        if (CurrentTarget != null && tpcHealth)
        {
            tpcHealth.Damage(CurrentDamageAmount);
        }
    }

To see if it's getting to this function you can add a debug statement like I have in the integration documentation.
 

DocQ

Member
that was it, leaving in the previous code and just adding that part was the problem, you need to comment out the old stuff and just have your statement in there. Thanks a lot for all your help.
 

magique

Active member
that was it, leaving in the previous code and just adding that part was the problem, you need to comment out the old stuff and just have your statement in there. Thanks a lot for all your help.
Ah, I thought it could be left in. Sorry for that. Glad you got it working.
 

GearedGeek

Active member
It appears that with the newer version of Emerald AI it has broken this script.

Code:
Assets\Custom\Scripts\OpsiveBridge.cs(6,13): error CS0246: The type or namespace name 'Emerald_AI' could not be found (are you missing a using directive or an assembly reference?)
 

GearedGeek

Active member
I noticed I'm having an issue where the AI is sliding backwards when trying to hit it with a sword. Everything was set up using the managers and wizards to create the player and AI.

EDIT: So I figured it out. It was the backup feature of Emerald AI that is why the AI was sliding backwards.
 
Last edited:

magique

Active member
There is a slight bug in the new instructions. I've updated the docs. The change is in the OpsiveBridge script. Change the Damagae call to the following:

_emeraldAI.Damage((int)amount, EmeraldAISystem.TargetType.Player, originator.transform);

The original instructions worked for AI using Closest detection method, but those with Line of Sight would not fight back.
 

Attachments

  • Opsive_V2_EmeraldAI_Intgration.pdf
    63.2 KB · Views: 93

GearedGeek

Active member
I'm glad you found it because I have noticed the bug where I can shot the AI in the back and it would start attack right in front of it.
 

GearedGeek

Active member
@magique I have noticed that the player can move through the AI like there is no collider. Is that normal? You mainly noticed it when you have doing a melee attack. The player will step through the AI when attacking.
 

DocQ

Member
@magique I have noticed that the player can move through the AI like there is no collider. Is that normal? You mainly noticed it when you have doing a melee attack. The player will step through the AI when attacking.

Does your AI have 1 or 2 colliders on them? If just 1, that might be the collider to detect damage, and used as a trigger instead of a collider to keep you from going through it. If using physics, them make sure you have 2 colliders, 1 for trigger to damage AI, and 1 for not going through the object. If your using strictly navmesh for movement, make sure the AI has a navmesh agent/obstacle on it so your player doesn't go through it.
 

GearedGeek

Active member
I have noticed that the ranged AI are having a hard time trying to target the player. I have enabled the debug options for the AI and there are a lot of obstructions from the CapsuleCollider as well the player's legs. So the ranged AI will just stand there and rotate with the player but will no shoot.

And when I change the Player Offset Y Position the ranged AI will still not shoot.
 
Last edited:

magique

Active member
I have noticed that the ranged AI are having a hard time trying to target the player. I have enabled the debug options for the AI and there are a lot of obstructions from the CapsuleCollider as well the player's legs. So the ranged AI will just stand there and rotate with the player but will no shoot.

And when I change the Player Offset Y Position the ranged AI will still not shoot.
I haven't tried ranged AI myself so I'll have to test that and see what might be the problem. Unfortunately, I'm working on another project atm and don't have anything set up to test for this so it might take some time to get to it.
 
Top