i’m using a boolean to detemine if the player is hiding or not, the booleans is set to true when hidden and false when not hidden, but when I print the state of the boolean in event tick it looks like it’s being set to true and false everyframe, and I don’t know why this is happening, I’ve already checked where the bool is being set and right now there is only 2 setters and 3 getters. could someone help.
those functions just change the collision and the visiblity of the player they’re not doing anything with the boolean. and the weird thing is that the hide and unhide work with no problem, the problem is when i want to reference this bool to change the behavior of my ai and that’s where it breaks.
i actually lloked it up and some people have had this problem aswell so maybe it’s bug in the engine?
i’ve had this problem in the past too, and i asked so many people about it but there was no solution to it. i ended up using a flip flop to do what i needed, another time i had to delete the variable and re create it and that fixed it, but this time it doesn’t work.
(1) to which class does your boolean “IsHiding” belong, so is it a variable of “Bed” or of “MainCharacter”?
(2) on which tick do you print it? In the tick of the “Bed” class?
(3) how many “Bed” objects do you have in your world?
Cause it seems like you have a “MainCharacter” class and a “Bed” class and the “IsHiding” seems to be inside the “Bed” class, not inside “MainCharacter”.
the variable belongs to the bed class and i’m printing it in the bed class itself. the character doesnt have anything to do with this variable. and there’s 3 instances of this class in the world
i think i know where the problem might be, is it because i have 3 instances in the world and each one prints diffrent instances of that boolean? cuz i see 1 true and 2 false
Think about the action required for the player to hide under the bed - how does it happen? Do we click on it? Bump into it? Is it randomly assigned (maybe it’s a puzzle game)?
The AI can ask the player.
I would actually broadcast it loud and clear and the AI gets to choose whether to act on it or not. Smoke and mirrors. All the way. Fake it until it breaks
regardless of what the ai is supposed to do, i wanna know why the code i’m using isn’t working, i loop through all the instances with a for each loop and check if is hididng is true, and as soon as i find the right one it should break the loop and do the rest of the code.
the rest of the code is just setting blackboard keys and then going to the break pin as u can see above. it wouldn’t break it if it doesn’t find the right instances.