Forum rules - please read before posting.

Integration with Emerald AI

edited June 2018 in Engine development
Hi.

Please help me integrate AC with Emerald AI.

ps. I have Invector too and I will integrate Emerald with Invector, but I read of other people couldnt match AC with Emerald. If it is enough to integrate with Invector I will do it so. But shouldn't I have some special AC components on my animal's NPC's or maybe a small script ?

Thank you!

Comments

  • In what way, exactly, are you looking to integrate the two together?

    If an animal NPC doesn't talk or interact with the player, there's no need to make it an "AC" NPC.  And if it does, but another asset controls its movement completely, then you can set your NPC component's Motion Control to Manual, and Animation engine to Custom, and have the other asset take over.
  • Hi Chris.
    I want to use the emerald AI functionalities to create factions and behaviours for enemies. Can you please help integrate it ?
    Thank you!
  • edited July 2018
    I followed what you told me: set the enemy and my companion as NPC with Custom animation and motion control manual.
    I put them both as tag enemy and on layer Navmesh I have these behaviours:
    - my companion and the enemy fight eachother and they take dmg both !! yey !!
    - the enemy is following me but does not do any attack on me

    - I have this error in the console:
    ""CalculatePolygonPath" can only be called on an active agent that has been placed on a NavMesh.
    UnityEngine.AI.NavMeshAgent:CalculatePath(Vector3, NavMeshPath)
    Emerald_AI:Initialize() (at Assets/Emerald AI 2.0/Scripts/System/Emerald_AI.cs:620)
    Emerald_AI:Start() (at Assets/Emerald AI 2.0/Scripts/System/Emerald_AI.cs:577)
  • edited August 2018
    That's an error coming from Emerald AI - not AC.  For help with this error message, you'll have to contact that asset's developer.
  • edited August 2018
    Ok, but how to setup an enemy NPC in AC, so that my player takes damage ? Or there is no special setup besides the ones you told me ?
    Must I have collider / rigidbody on my player ? (I use character controller setup as in your Demo).
  • edited August 2018
    AC is for traditional, non-combatative adventure games.  It has no concept of "enemy" types or "player damage".  All such systems must be added on separately.  How you do that is down to your own needs: the asset you're using, the extent to which the systems are used, and how they interact with the systems in AC.  There is, unfortunately, no "one size fits all" approach to this.

    If an "enemy NPC" in your game does not interact with the player in the "AC way" (speaking, hotspot etc) then I do not suggest you involve AC.

    If you want to store the player's "health" as an AC Global Variable, you can update/check it's value through custom script - see the front page of the scripting guide.  I don't recommend doing so unless you need AC to access it, however.

    Once the player is considered "dead", you can use AC's Engine: End game Action to restart the game if need be.

    A collider and rigidbody is not necessary for AC to control your player, but it may be necessary by Emerald AI or whatever system you use to enable combat.
  • the enemy is coming to my player to att me
    he is just not hitting me
    i have character controller and no rigidbody nor collider
    ----------------------
    i made him attack me by setting the player on navmesh layer too
    i dont see any dmg but i think its becasue of not having something defined about it
    I will check what you told me about the health and ask for more help if i dont succeed :) thank you!
  • I tried to use their script controller because it has movement settings and some other nice settings, but I failed misserably :( Setting the player with Custom and Manual and the bellow code, makes him not moving :(
    Can you please advise or give some hints ?

    using UnityEngine;
    using System.Collections;
    using System.Collections.Generic;
    using UnityEngine.UI;
    using UnityEngine.AI;
    using UnityEngine.Events;
    using AC;

    public class CustomControllerLink : MonoBehaviour 
    {
    private Emerald_AI emeraldCharacter;
    private Char acCharacter;

    private void Start ()
    {
    emeraldCharacter = GetComponent <Emerald_AI>();
    acCharacter = GetComponent <Char>();
    }
    private void Update ()
    {

    if (KickStarter.stateHandler.IsInGameplay () || acCharacter.IsPlayer || !acCharacter.IsMovingAlongPath () || KickStarter.settingsManager.movementMethod == MovementMethod.Direct)
    {
    // emeraldCharacter.SingleDestination = acCharacter.GetTargetPosition (true);
    emeraldCharacter.AIAgent.destination = acCharacter.GetTargetPosition (true);

    //emeraldCharacter.TargetDirection
    }
    }
    }
    (tried without the wrapper too and same result /// i used the wrapper from your example in mirror becasue i want the exact oposite: to have a direct moving player moving as the other asset controller)

    thank you!


  • edited August 2018
    I really can't advise you on issues that occur with another asset.  The "enemy attacking the player" behaviour is not to do with AC - again, you need to contact the other asset's developer for support.

    I would recommend, however, that you keep your Player object within the scene file itself - as opposed to being spawned in at runtime via the Settings Manager's Player prefab field.  This is often easier for integrations that rely on other objects that communicate with the player.

    Is that script intended for the player, or an NPC?  What is the intended movement type - Direct or Point And Click?  If the movement is Direct, and the other asset has its own Direct movement system, there shouldn't be a need to read AC's target position unless you're in a Cutscene.  At all other times, the Player's destination and motion should be controlled entirely by the other asset.

    Something like this:

  • edited August 2018
    It seems there is no need to integrate the emerald AI controller because I have yours and the movement is Direct and it is player. 
    The problem is that I am taking dmg on health bar, but even if i have on their playerhealth.cs a debug script I still dont see anything.

    LE: had some other small errors that I solved in the meantime. I also made the player hit the enemy with easy setup from Emerald objects. But the popping dmg on my player I still cant do it :)
  • PlayerHealth.cs is not an AC script.  Again, you must contact the appropriate author for assistance.
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.