In Control Variables -> Script enter this:
$dataEnemies[ID].params[0]
where ID is the id of the enemy of which you want to get the max HP.
E.g. if your bat has the id 0002 in the database,
$dataEnemies[2].params[0]
will give you the max HP of the bat.
If you want to access the other parameters,
param[1] is MMP
param[2] is ATK
param[3] is DEF
param[4] is MAT
param[5] is MDF
no, that is correct because by default enemies exist only during battlescreen
Looking through the .js files again, I think I understand the difference between the two methods now. The enemies referenced by Game Data -> Enemy are Game_Enemy objects which are only created when a Game_Troop is loaded - that's why they only exist during battle. And I completely agree that in this case it's much easier to just use the Game Data option for the variable 😉
But since the OP is talking about an ABS, I assumed that the event which sets the variable to the enemy's MHP would be on a map, not in a battle. $dataEnemies works there because it is not referring to Game_Enemy objects, but to the data saved in the Enemies.json file (loaded by the DataManager at the start of the game), which is accessible at any time.
Hope that makes sense 🙂
Thanks both. For me the solution was as identified by LadyBaskerville to use $dataEnemies[ID].params[0] as I am overworld in ABS.
How on earth do you discover things like the existence of dataEnemies. I cannot find it in the Help that ships with the game at all. Is it from looking in the .js and .json files directly?
You won't find it in the help file. It's in the scripts. rpg_objects.js is a good one, particularly a lot of the Game_Interpreter functions.
This might help you get started: