MZ Error in script call?

I have no idea how to get any script call, or variables to function the way i want to with a particular issue i have come across.
I've managed to script a few things on my own trying to understand the language and banging my head through concrete trying to fix syntax errors and the like, but this one i cannot solve. No other forum or page has the answer so i am making another request (i still don't exactly know where this post is supposed to go).

I have been trying to get the game to read the actors (preferably all of them) Hp relative to the their Max Hp and to change the face image displayed, including in battles, when their health is above 50%, below 50%, and below 25% respectively.
I've tried many workarounds but if i could get a solid solution, even if it's difficult it would be greatly appreciated.

Images attached are the characters face images, and a mix of script calls, variables, and common events i've tried. i also tried making a script in webstorm but i really didn't know how to get it to read.

The last attempt left my character face image stuck on 4 so i feel like it must be getting close X)
your conditional branch isnt doing anything with your variable in the first 2. you made the variable the actor's hp%, but your conditional branches just use the actor's max hp.
for the last one, youre using a variable in the conditional branch but its the wrong one. you started with variable 35, did all your calculations on variable 34, and then used 35 in the end

but also, since youre already using script in your conditonal branches you can skip the control variable commands. use $gameActors.actor(x).hpRate() to check actor x's hp% in one step. the value is a decimal, so compare against .5 instead of 50.
your conditional branch isnt doing anything with your variable in the first 2. you made the variable the actor's hp%, but your conditional branches just use the actor's max hp.
for the last one, youre using a variable in the conditional branch but its the wrong one. you started with variable 35, did all your calculations on variable 34, and then used 35 in the end

but also, since youre already using script in your conditonal branches you can skip the control variable commands. use $gameActors.actor(x).hpRate() to check actor x's hp% in one step. the value is a decimal, so compare against .5 instead of 50.
I will give this a try.
your conditional branch isnt doing anything with your variable in the first 2. you made the variable the actor's hp%, but your conditional branches just use the actor's max hp.
for the last one, youre using a variable in the conditional branch but its the wrong one. you started with variable 35, did all your calculations on variable 34, and then used 35 in the end

but also, since youre already using script in your conditonal branches you can skip the control variable commands. use $gameActors.actor(x).hpRate() to check actor x's hp% in one step. the value is a decimal, so compare against .5 instead of 50.
No matter how i write it, i now only get this error message whenever i enter a battle. It's like it's not reading the file even tho it is clearly there and with no typos. I really can't understand the issue it's having
i now only get this error message whenever i enter a battle
are you sure that the code in that event is being ran? do you have a troop event or a plugin that plays that common event as battles begin? the error says that the game went looking for a file named "mcfemale face", not "mcfemaleface".
did you try to set the actor face elsewhere too? Or maybe set the actor's face in the database to "mcfemale face", and then changed the filename but didnt update it in the actor's page?
are you sure that the code in that event is being ran? do you have a troop event or a plugin that plays that common event as battles begin? the error says that the game went looking for a file named "mcfemale face", not "mcfemaleface".
did you try to set the actor face elsewhere too? Or maybe set the actor's face in the database "mcfemale face", and then changed the filename but didnt update it in the actor's page?
That was indeed the issue with the error message but after fixing it, it still won't update the image. Gonna just keep working at it i suppose
it still won't update the image. Gonna just keep working at it i suppose
you nested your conditional statements. right now, itll only ever set the actor's face to face 0 above 50% or face 4 when its exactly at 50%.
you nested your conditional statements. right now, itll only ever set the actor's face to face 0 above 50% or face 4 when its exactly at 50%.
So should i use an else branch in it or separate it into a different branch?
use an else branch.
you can do either of those, but when theres only 2 possibilities, there will always be one thats true, and both are mutually exclusive, theres no reason to have separate branches
use an else branch.
you can do either of those, but when theres only 2 possibilities, there will always be one thats true, and both are mutually exclusive, theres no reason to have separate branches
unfortunately, neither of these calls are working still. I don't get any errors, but it doesn't change the image. I tried setting it as a parallel common event in the map and I also tried to set it in the battler or the event as well, but none seem to respond to it.
neither of these calls are working still
didnt notice it but you also you left out the parenthesis
use $gameActors.actor(x).hpRate()
as in$gameActors.actor(x).hpRate() > .5
EDIT: and youve removed the quotes around the file name. so when it does get to run that code, itll give an error there in that first one
didnt notice it but you also you left out the parenthesis

as in$gameActors.actor(x).hpRate() > .5

didnt notice it but you also you left out the parenthesis

as in$gameActors.actor(x).hpRate() > .5
EDIT: and youve removed the quotes around the file name. so when does get to run that code, itll give an error there in that first one
I was just trying things. It's been put back. Also i got it to work after with what you said, hpRate() > .5
It runs exactly as intended in the map. Now i just gotta figure out how to get it to run in the battler. I assume i just run it as a common event in troops page in the database, but we'll see.
Thank you! I made progress so it's been helpful
I hate asking for more help on this but i still can't get the script to run how i need it to after multiple attempts.

So I'm trying to get a common event to always run during battles. Is there any way to do this effectively? I managed to get it to always run on the map, but the main goal was to get it to be more dynamic and happen during battles.

The script call checks for the players hp and changes the image displayed based on the players current hp.
Since this is still related to your last issue, the threads will be merged.
So I'm trying to get a common event to always run during battles. Is there any way to do this effectively? I managed to get it to always run on the map, but the main goal was to get it to be more dynamic and happen during battles.
note that parallel common events do not run automatically in battles. just on the map. Calling them via a troop event works, but then that brings up the other issue.
your logic for the conditional branches is still flawed and your else is impossible to execute. youve said it should run only if the actor's hp% is both not above 50% and is above 50%. Its already in the else for the actor's hp being above 50%, it doesnt need any further condition as by getting there, their hp must already be equal to or below 50%
Since this is still related to your last issue, the threads will be merged.

note that parallel common events do not run automatically in battles. just on the map. Calling them via a troop event works, but then that brings up the other issue.
your logic for the conditional branches is still flawed and your else is impossible to execute. youve said it should run only if the actor's hp% is both not above 50% and is above 50%. Its already in the else for the actor's hp being above 50%, it doesnt need any further condition as by getting there, their hp must already be equal to or below 50%
I shared the wrong image on accident. I fixed that prior. Idk why it sent that one. So I'll attach the correct one here.

I want the image to cycle back tho when the hp is above 50%. The goal is for the image to be set based on how much health they have, in like a dynamic way where it always reflects the amount of hp they have.

Original thread: https://forums.rpgmakerweb.com/threads/error-in-script-call.179164/