Run away mechanic

I want to create an event where when a character is below 20% HP, they will run away from the party

Is there a way so that common events can work according to certain HP percentages?
$gameActors.actor(id).hpRate() <= 0.2 or around that.
this works in MV, maybe MZ is equal for checking.
$gameActors.actor(id).hpRate() <= 0.2 or around that.
this works in MV, maybe MZ is equal for checking.
thanks, I'll try it

Original thread: https://forums.rpgmakerweb.com/threads/run-away-mechanic.173888/