HELP! How do I reference an enemy outside battle?

Hi All!!

This should be easy but I dont get how to...basically, all I want is to know the enemie´s element rate. So in battle, All I have to do is $gameTroop.members()[INDEX].elementRate(X);

But outside battle, I know I can reference an enemy by $dataEnemies[ID], but If I try $dataEnemies[ID].elementRate(X), doesnt work.

So, how can I get the element rate of an enemy outside of battle?

Thanks!
Try typing in this in the console to see what traits show up. This would be for enemy 2, first trait:
Code:
$dataEnemies[2].traits[0]

If your elemental rate is in position 3 of traits in the enemy database, you would reference 2 inside of the brackets for traits.

After the traits[number], you should be able to use the items below to get more info:
.code
.dataId
.value1
.value2

When I get home, I can give you more info.
Using the elementRate method would be easiest, since it guarantees the value would be calculated the same as in battle, including any plugin features. You'd need a Game_Enemy instance for that, though.

You could try this:
JavaScript:
const nme = new Game_Enemy(1, 0, 0); 100 * nme.elementRate(2);
I.e. "make a new instance of enemy ID 1 at X = 0, Y = 0 and get 100x their rate for element 2". E.g. it would return 100 for 100% rate.

Original thread: https://forums.rpgmakerweb.com/threads/help-how-do-i-reference-an-enemy-outside-battle.164677/