News Forums RAIN General Discussion and Troubleshooting Custom Behavior Tree Actions

This topic contains 5 replies, has 2 voices, and was last updated by  Other-Jeff 1 month, 2 weeks ago.

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #39659

    Other-Jeff
    Participant

    OKay,

    My next task is to create a number of behavior tree actions to trigger MOB actions like “attack”.

    I assume I inherit from BTActionNode. What else do I need to do to make the editor and system aware of my new action?

    #39668

    Other-Jeff
    Participant

    I gave the class a [RAINAction] property but that didnt seem to help

    #39670

    7BiTStudios
    Participant

    You can create your own Action by selecting “Create Custom Action” while having a Custom Action Node selected.
    http://i.imgur.com/SMbNuo6.png
    Use public Expression fields to display Expressions in the inspector.

    Simple example:

    using RAIN.Representation;
    using UnityEngine;
    using RAIN.Action;
    namespace LordsAndLegends.AI.Actions
    {
        [RAINAction]
        public class DebugLog : RAINAction
        {
            public Expression Message = new Expression();
            public override ActionResult Execute(RAIN.Core.AI ai)
            {
                Debug.Log(Message.ToString());
                return ActionResult.SUCCESS;
            }
        }
    }

    The RAINAction class provides several virtual methods you can override.

    #39676

    Other-Jeff
    Participant

    Thanks, saw that just last night. I wish the tree would show them individually rather then just as generi “action” where you have to inspect it to see what it is…

    #39677

    Other-Jeff
    Participant

    Is there a way for me to show the name in the behavior tree of the custom action? The wiki looks like there is but it doesnt explain how?

    #39681

    Other-Jeff
    Participant

    Okay i found the name field… but having to set it for each node is ugly

Viewing 6 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic.