Hi, I’m new on the forums so hopefully this is posted in the correct area.
I’m using some lovely AI magic in my project but at the moment I’m having an annoying bug.
I’ve got AI characters that are supposed to go to a certain point, pick up an item, go to another point and wait for the player to interact with them. The bug occurs when the AI character is waiting for the player to interact with them. As the AI character is waiting, it continues to pick up items even though they should no longer have access to that part of the tree due to a blackboard decorator.
So this is my blackboard:
It checks if the AI state is DoneShopping 4 (false), after that it check if the AI is Paying 10 (false) and finally if the ai is NOT Paying 12 (true). I can see how this is a risky way of doing this but I’ts left like this after a long session of trying to figure out what the dickens is happening. Nonetheless so far this is working and BTT_WanderToPoint is being run.
So I pretty much instantly set the state to Shopping which should deny the blackboard entry from node 4 and 10 in my blackboard. (In this blueprint I give the AI a point to walk to and I tell it to pick up an item)
When the item has been picked up this part is finished with “Success”. (Don’t mind the magic number here, It’s temporary and will be addressed).
The AI will now go back to the blackboard check node 4 (false) check node 10 (false) and goes back into BTT_WanderToPoint
This time I check if the AI has more items to pick up. If not - I check if the AI has picked up anything at all and set the State accordingly. Both scenarios end in Sucess
The AI will now go back to the blackboard check node 4 (false) check node 10 (true) and enter BTT_GoToCashRegister
In BTT_GoToCashRegister the AI moves to another location and waits for player interaction. The state of the AI is now Paying and the AI loops thru the blackboard sequence until It has been interacted with.
This is where the problem lies. What I expect it to do is to wait until interacted with, switch the state and go into node 4 in the blackboard. What actually happens is that it waits, goes back into BTT_WanderToPoint, picks up another item, goes back to the blackboard and back into BTT_GoToCashRegiser in a loop until it is interacted with and finally goes into node 4.
I don’t have much experience with blackboards and behaviour trees at all so this might be a super dumb way of doing things but I can’t figure out how in the world the AI can get back into node 12 again since the decorator should block it if the state is Paying. Any help and tips are super appreciated! If more info is needed I’d be happy to supply it. I’m using version 4.18.3
Here is my BTT_WanderToPoint graph: BTT_WanderToPoint posted by anonymous | blueprintUE | PasteBin For Unreal Engine 4
And here is my BTT_GoToCashRegister graph: BTT_WanderToPoint posted by anonymous | blueprintUE | PasteBin For Unreal Engine 4
Thanks in advance!