Hello!
I've been obsessing over this for the past two days... lol I feel really dumb. But I really need to assign a variable according to a target enemy's level so that I can reference that enemy's level later. Can anyone help me with this? I think I'm going crazy!
It would also be useful if I could do the opposite, and assign a target enemy's level according to one of my variables. I tried using the plugin command, but neither the java script ($gameVariables.setValue(id)) nor the text call (\V[id]) seems to work with plugin commands.
plugin: Yanfly Enemy Levels
Thank you so much : )
Yanfly Enemy Levels - Need to assign target enemy level to variable
● ARCHIVED · READ-ONLY
-
-
To set an enemies level, you need to use javascript.
So to set an enemy level to a variable you do:
enemy.changeLevel($gameVariables.value(x));
To set an variable to an enemy formula:
$gameVariables.setValue(x, enemy.level);
Note however that enemy is place holder for some code. I don't know how or in what way you are targeting your enemies, is it a skill or item, an event, in what way do are you targeting said enemy.
Also I got the javascript evals of the enemy stuff in the help file under Lunatic Mode- New JavaScript Functions. -
Thank you!
Yes! The problem I kept having when trying to implement the java script (enemy.level) is usually "enemy is not defined."
So, you are saying that I need to replace "enemy" with code that defines it... haha makes sense.
How about I replace "enemy" with $gameTroop.members()[0] ?
I want to reference the enemy in the troop with index 0 (so the first enemy of the troop).
So, in order to send that enemy's level to a variable (in this case, variable 5), I'll use code:
$gameVariables.setValue(5, $gameTroop.members()[0].level);
It worked! -
Yes.
if it was a skill/item that a actor could used you could have used b.level assuming you were in lunatic mode, or in a damage formula