Reset BB variable if FSM transition is not possible

Forums 💬 NodeCanvas 🗨️ General Discussion Reset BB variable if FSM transition is not possible

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #13771
    laymelek
    Participant

      Hello,

      On my character I have 3 States. “Idle”, “Alert”, “Suspicious”. I have a BB Vector3 variable called NoiseLocation. If a noise source is close this variable is set to noise location. If Character is in “Idle” state Condition checks this NoiseLocation and if not NULL goes to “Suspicious” State. But if its in “Alert” state should not react. So there is no transition from “Alert” to “Suspisious”. But since NoiseLocation is not NULL after some time if Alert state changes to Idle, my character becomes suspicious because of a noise which is registered long time ago. How can I avoid that? Can I set NoiseLocation to NULL if transition to Suspicious state is not possible from current state?

      #13773
      Gavalakis
      Keymaster

        Hello and welcome.

        Just so we are on the same page here, can you please clarify what you mean by setting the Vector3 to null since normal Vector3 can’t be set to null (it’s a value type)? 🙂 Do you mean that you are setting the BBParameter object itself to null?

        Other than the above and into your question, one solution, would be to use a “Super Action State” instead of a normal “Action State” for “Alert” and have your variable set to null when the state Exits, by having an action task which does this, added in the “Super Action State” “On Exit Action List”.

        If you are making custom action tasks, then the above could also be achieved in a normal “Action State” and by overriding the Action Task “OnStop” method, which is called when the action is stopped. An action can be stopped either because the EndAction method is called, or because the state in which it is attached has ended.

        Let me know if that works for you, or if you need any further help.
        Thanks.

        #13772
        laymelek
        Participant

          After investiong more time and understanding NodeCanvas better I redesign my graphs and its working now… Thanks for the reply anyways..

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