playMaker

Author Topic: Bool test doesn't test ? [SOLVED]  (Read 3220 times)

inediblered

  • Playmaker Newbie
  • *
  • Posts: 13
Bool test doesn't test ? [SOLVED]
« on: November 19, 2013, 08:46:39 AM »
Hello, I've got this set up :



and I know that the bool is moving from true to false in game but in this FSM it always get stuck at Undetected/false, any help ?
« Last Edit: November 19, 2013, 11:13:46 AM by Alex Chouls »

Lane

  • Administrator
  • Hero Member
  • *****
  • Posts: 2511
  • Mender of the past
    • Cleverous
Re: Bool test doesn't test ?
« Reply #1 on: November 19, 2013, 08:52:18 AM »
The bool starts with a false value, if it runs this check before the value can be changed then it will always fire Undetected immediately at runtime. Better to not fire anything for Undetected so it stays in the state. Vice versa for the Detected state.
Products by Cleverous
|| Vault Core : Database
|| Vault Inventory : Multiplayer Inventory
|| Vault Attributes : Character Stats
|| That Hurt! : Dmg Floaties
|| Quinn : 3D

inediblered

  • Playmaker Newbie
  • *
  • Posts: 13
Re: Bool test doesn't test ?
« Reply #2 on: November 19, 2013, 08:58:16 AM »
so what do I do if I want to do something like this:

If "enemy_is_detected" = true - do this

if "enemy_is_detected" = false - do that

I'm trying to understand what you wrote but I have to admit is a tad confusing, sorry :(

Lane

  • Administrator
  • Hero Member
  • *****
  • Posts: 2511
  • Mender of the past
    • Cleverous
Re: Bool test doesn't test ?
« Reply #3 on: November 19, 2013, 09:05:39 AM »
Sorry that was confusing =/

To simplify: Why is the checking state there at all? You can have either a true(detected) state OR a false(undetected) state and in those states its simply reading to see if the bool is true or false. You could just have a Detected and Undetected state of the system, using the bool test to switch between the two when necessary.

The other thing was that when the game is run, lots of things happen fast but its still first come first serve so when this particular state is processed it checks the bool and immediately sees that it is in the False (default, 0) state and also sees that you told it to fire the Undetected event when it is false... So it does. Regardless of the state that the bool might later be in after a few more milliseconds. I think that is whats happening.
Products by Cleverous
|| Vault Core : Database
|| Vault Inventory : Multiplayer Inventory
|| Vault Attributes : Character Stats
|| That Hurt! : Dmg Floaties
|| Quinn : 3D

inediblered

  • Playmaker Newbie
  • *
  • Posts: 13
Re: Bool test doesn't test ?
« Reply #4 on: November 19, 2013, 09:28:20 AM »
I thought that is what I was doing and now I do understand what you meant before ! Thank you :) but I still don't get why after the first check is doesn't recognize that the bool is true if is set to every frame.

The set up right now get's a bool from another FSM and then checks if the bool is either true or false and then gives a result, at least that's what I was thinking but I guess my logic is faulty in some way sigh, is there a better option to do this ? forever learning :)

Lane

  • Administrator
  • Hero Member
  • *****
  • Posts: 2511
  • Mender of the past
    • Cleverous
Re: Bool test doesn't test ?
« Reply #5 on: November 19, 2013, 09:37:12 AM »
It only does the actions of the current state that the FSM is in, so on Start you're entering the Checking state, then you immediately exit and do not return. That's why the state is obsolete, you could simply transition between the Detected and Undetected state by doing the Get FSM Bool and Bool Test in each of them and sending an event on the result of the bool but sending no event if it is in the correct state.

For example in the detected state, you can send Undetected if its false, but don't send any event if it is true so it effectively stays in the Detected state until the bool changes to false.
Products by Cleverous
|| Vault Core : Database
|| Vault Inventory : Multiplayer Inventory
|| Vault Attributes : Character Stats
|| That Hurt! : Dmg Floaties
|| Quinn : 3D

inediblered

  • Playmaker Newbie
  • *
  • Posts: 13
Re: Bool test doesn't test ?
« Reply #6 on: November 19, 2013, 09:56:42 AM »
thank you very much !!! I fixed it following your instructions !   ;D