This is probably a dumb question but I am not sure of the correct way to do this. I have a while loop that is set to repeat until a variable is changed. When it is called, it crashes because it detected an infinite loop. What is the correct way to do this?
I have to be honest I’m not quite sure why you are doing this? Are you asking about while loops in particular? Or how to possess a pawn properly.
While loops are not really meant for this kind of thing because it will hit the cap before that condition changes.
If you are wanting to know when your pawn is possessed there is an event in the controller called OnPossess that will fire as soon as that pawn is possessed allowing you to run logic after that if that is all you want it for.
If I’ve completely missed the mark let me know and I’ll try and help you with a more specific answer.
More info on whileloops Blueprint Essentials: While Loops | 13 | v4.2 Tutorial Series | Unreal Engine - YouTube
Thanks for the answer. I am really just trying to play an event when the character is possessed. In the player controller I cannot find OnPossess and in the character when I use Possessed it runs on server when I am looking for it to run on client. Is there something I am missing?
There’s an event in the controller class called OnPossess and OnUnpossess, I’m not sure why they aren’t showing up for you but it definitely sounds like what you’re after.
Hook Up the ist valid Into a Not and that Into the while condition. If you are looking for the posessed Event have a Look at the other answers, thats the way to go