Current Skill used in Battle and target (Solved)

SOLVED


I want to add random text to the message of a skill. E.g., “(User Name) hits" + Target.name + " in the chest"/ "the left leg"/ "the right arm"/ etc.


1) Could you please advise how to define the skill currently used in a battle?


2) Secondly, how to find out the name of the target of this skill?
Answer to 1 (for someone's convenience)


BattleManager._subject.currentAction()._item._itemId


Returns the number of skill. Then find it in the $dataSkills, something like:


$dataSkills[BattleManager._subject.currentAction()._item._itemId].name




Answer to 2


BattleManager._subject.currentAction().makeTargets().clone()[0]._actorId
/////////////// OR//////////////
BattleManager._subject.currentAction().makeTargets().clone()[0]._enemyId


one of those returns ID of actor or enemy. Then a simple check whether the first Id or second Id exist.

Original thread: https://forums.rpgmakerweb.com/threads/current-skill-used-in-battle-and-target-solved.73916/