I would suggest giving your topics more descriptive titles, your 3 last ones have been almost identical..
You could look up state engines .. idle .. move .. jump ..
Idle could set a timer, when it runs out, choose to jump or move, if move check which direction you can move and choose one, if jump then find a free tile to move towards and maybe do some shadow trickery along the way.
state .. state_next .. when state is changed then I set a state_start, which I set to false the next step..
you could do those direction / location checks in your move / jump states in a state_start moment
For the jump position, lengthdir in a direction towards player with some random deviation to aim and jump length, can div the position found and check if it is free a few times till you find it .. or give up and return to idle/move