Edit FSM resets custom agent

NodeCanvas Forums Support Edit FSM resets custom agent

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #12181
    patientzerogames
    Participant

    Hi

    I noticed that if you start a fsm like this StateMachine.StartGraph(this.agent, Blackboard, false, OnFinish); where the agent is on a different GameObject than the FSM itself pressing the “EDIT FSM” button during runtime will reset the agent of the graph to the GameObject of the FSM.
    To fix this I edited the following lines in the GraphEditor.cs to use targetOwner.graph.agent instead of just using the targetOwner.
    183:
    rootGraph.agent = targetOwner.graph.agent;
    192:
    current.agent = targetOwner.graph.agent;
    212:
    var window = OpenWindow(owner.graph, owner.graph.agent, owner.blackboard);

    I’m not 100% sure this does not introduce problems in other situations. But for now everything seems working fine.

    #12187
    Gavalakis
    Keymaster

    Hey,
    Hmm. I am not sure I understood the case when this happens.
    Do you mean when manually starting a Graph which graph is though already assigned on a GraphOwner, but you provide a different agent?
    Thus basically doing something like this:

    ?

    Please let me know.

    Join us on Discord: https://discord.gg/97q2Rjh

    #12193
    patientzerogames
    Participant

    Yeah, pretty much like that.
    In our game we have several objects that specify how an agent should behave while interacting with it.
    For example the movement etc is controlled by the agent itself (but not via nodecanvas but our own AI system), but if a designer for example places a car somewhere in the scene we want the agent to execute the graph that is attached to the car (play the “get in car animation” etc and also set and get some variables from the cars blackboard).
    Or is there a better way to do that?

    #12198
    Gavalakis
    Keymaster

    Hello again,

    Thanks for clarifying. So your goal here is to have reusable graphs in the scene for say interactable objects, where each such interactable object has a graph assigned to denote how to interact with this specific object.
    This is quite interesting indeed, but a bit different than how a GraphOwner currently works in the sense that the graph assigned to the GraphOwner is meant to control that GraphOwner itself.

    I will take a look at making what you want to do easier since I find this a very good use case of NodeCanvas 🙂
    Maybe I could create a mini system for interactable objects like what you are after here so that everything is more streamlined.

    I will also investigate the editor code changes you suggest, just to confirm if they impose any other issues and if not I will put them in the next version as well.

    Thanks for bringing this matter up.

    Join us on Discord: https://discord.gg/97q2Rjh

    #12200
    patientzerogames
    Participant

    Thanks for looking into it!

Viewing 5 posts - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.