Script Command for enemy stats?

I'm looking for a way to call an Enemy's ID number in the database and have it's stats recorded into the variables of my choice.

So I've been peaking into the enemy.json file and I can see the information I'd like to get at, but I'm not sure how to go about it.
Code:
{"id":1,"actions":[{"conditionParam1":0,"conditionParam2":0,"conditionType":0,"rating":5,"skillId":1}],"battlerHue":0,"battlerName":"Bat","dropItems":[{"dataId":1,"denominator":1,"kind":0},{"dataId":1,"denominator":1,"kind":0},{"dataId":1,"denominator":1,"kind":0}],"exp":0,"traits":[{"code":22,"dataId":0,"value":0.95},{"code":22,"dataId":1,"value":0.05},{"code":31,"dataId":1,"value":0}],"gold":0,"name":"Bat","note":"","params":[200,0,31,32,33,34,35,36]}

The very first value "id" is the enemy's database number, then all the way at the end "params" is it's actual battle stats. [HP,MP,ATK,DEF,M.ATK,M.DEF,AGL,LCK]




Edit: GOT IT!


var x = ($dataEnemies[ID].params[0]);

$gameVariables.setValue(Variable, x);

with "ID" being the enemy's database number. The number after params being the whichever stat you want to measure out of the array, (0=HP 1=MP,2=ATK, etc..) and the Variable being whatever variable you wanna record to.

I'm sure it looks simple to anyone who knows what they're doing but I spent the better part of the day reverse engineering it.
Big thanks for editing it so we could get the answer and giving the explanation with it ^^

Original thread: https://forums.rpgmakerweb.com/threads/script-command-for-enemy-stats.82325/