Scripting: Using a variable to find a level

I'm trying to make a priest that is designed to remove certain conditions from a character for a price.  I've figured out how to get the variable to determine who needs healed, but the problem is that I want the recipient's level to affect the price.  Basically, I have the variable of the actor, and now I need to determine their level and put it into another variable, then do the math from there.


So the question is: How do I use the actor variable to create the level variable?  I probably need to use JavaScript, but I don't know how to tell the game to look at the variable.
Control variable, Game Data, Actor, Level


That should do it, I think


If you show me screenshots of how you have it set up, I could help you make it more specific if this didn't help
I tried that approach, but the issue is that I used a variable to determine which party member to choose by position.  For instance, the character in Position 2 isn't always the same, so I had to use a variable to determine who is currently there.  I can't figure how to use that variable to find that character's level.  Your approach would work if character formation was always the same, but it isn't in this game.

PriestEvent.png
$gameActors.actor(2).level   In that call, you determine the level of the actor whose ID is in those brackets. You need to put your variable in those parenthesis. So if you're storing actor position 2 in variable 8, your call will need to be


$gameActors.actor($gameVariables.value(8)).level     


That's the call you need, but obviously you need to change the variable/s to the one you're using, unless it happens to be 8 lol
OK, that helps, but I may have a new problem now.  Now I need to figure out how to determine if that actor is knocked out or has whatever condition needs cured, then create an event to say they don't need help if they aren't.  I think I may need to learn more scripting with conditional branches.  I'll try that on my own for now, though.  Thanks for the help.
Use this extremely useful page. All of the stuff on the right is script calls that work in MV. You can get a lot done with it and learn a bit about scripting while doing it
Well, I figured out how to make the priest work.  That scripting page did help, but part of it just required trial and error to make it work.  Anyway, thanks for the help.

Original thread: https://forums.rpgmakerweb.com/threads/scripting-using-a-variable-to-find-a-level.60338/