Issue changing between states in Blackboard

Hello! I’ve been following a tutorial on how to create an AI with vision, running towards the player if it is in sight, but for some reason, I’m unable to change between my two states (AggressiveCombat & Idle). Something does happen though, which makes me even more confused. Here’s a video of what happens when it should change states

[- YouTube][1]

Here’s a snippet of the blueprint where the state changes occur:

Usually what I do/What I was taught by the bignames is SetBlackboardKeyAsText

Then you can type in the state using the literalText node.

Let me know if you cant figure that out and I’ll dig out some old AI projects. IT looks like it should work though, it could be an error in your logic. Your BTT or whatever your creating has a failure/non failure at the end? Hope this helps

Don’t forget to accept an answer that best clears your question up or answers it so when the community finds your question in the future via search/google they know exactly what you did to fix it/get it going.

There’s a “Set Blackboard Value As String”, is that the one you mean?
But yeah, I think it’d be easier if you dig up those projects, please and thank you :slight_smile:

It’s not a BT Task, but a BT service, so it seems I can’t add a “finish execute” at the end.

From what I can see on the video your problem is that the first task of the selector you’re showing there (the one with Vision service) is succeeding it’s execution, and since it’s parent is a selector it means it just finishes, not executing next child (by design). You just need to structure your BT differently. Is the first task is “state selection” and it always succeeds consider using a sequence, and have the other child be a selector with “idle” and “aggressive” branches.

BTW, a hint here: place the higher priority branch (“aggressive” I presume) on the left, and have it’s condition decorator set to Abort both. And leave idle as a condition-less fallback. It’s more robust this way :slight_smile:

Let me know if there’s anything unclear.

Cheers,

–mieszko

Hi Mieszko, do you mean like this?

Because that doesn’t seem to work either :confused:

ok, but how doesn’t it work? :slight_smile: Would you mind recording another video, just from the BT debugger? The previous one was very enlightening.

Well, it does exactly the same thing as the previous video. It shows the value of State as “MAX” when the player is not in vision, and it shows as “none” when the player is in vision

I’ll do you a better one and send you the BP, since I have been following a tutorial and just can’t see what’s going wrong there… 2 sec

Keep in mind that I’ve been following a couple of different tutorials to get to this

I was having the same problem in 4.9 in setting state of player. I switched back to 4.8 and the same blueprints worked correctly.

It seems fine. I strongly encourage you to debug your blueprints in this case, both the Vision service and Set Player Position. Or share your project with me. Or a stripped down version that exhibits the same behavior.

Here is a stripped down version with only the needed BP’s for it to work.

https://drive.google.com/file/d/0B62a0mseJ9bGTXZMRnRVNko0Zjg/view?usp=sharing

As ambhar wrote, maybe it could be an issue with 4.9, since his problem disappeared when he switched back to 4.8?

It actually calms my mind hearing that “it seems fine” from someone who actually knows what they’re talking about… I’ve been combing through the code forever trying to find the issue! :smiley:

So thanks to that repro project of yours I was able to nail it down, and it turns out there’s enum-to-byte blueprint conversion issue. I’ve already filed a ticket for the blueprints team to have a look at it.

The only workaround I was able to find was not to use enums for now. Just use Int or Name keys instead.

I’m terribly sorry, and thank you very much for supplying us with repro project which made finding and reproing this bug a trivial. Thanks!

–mieszko

That’s both sad and great to hear! Sad that we won’t be able to use enums for now, but great that we got to the bottom of the issue :slight_smile:

Hi Mike :slight_smile:
I was not in a hurry to try 4.9 so i did not update during the previews, but decided to update only efter the official release.
The project started as 4.8 and was converted to 4.9 official

Hi Beslind,

We believe we hava fix for this. You can check it out here: b53db70. To be clear, we think this was only occuring with enums that were saved from a 4.9 preview build. Is that possibly the case here? I want to make sure we correctly resolved the issue.