Indie Dev

Hello Guest!. Register a free account today to become a member! Once signed in, you'll be able to participate on this site by adding your own topics and posts, sell your games, upload content, as well as connect with other members through your own private inbox!

How to retrieve a skill id of the current action in battle?

Xilefian

Adventurer
Xy$
0.00
You want to look at Game_Action.
JavaScript:
var battler = BattleManager._subject; // Current battle subject
var skillId = battler.currentAction().item().id; // This works if we can guarantee a skill is being used

// If we can't guarantee it's a skill then we need to check first
var currentAction = battler.currentAction();
if (currentAction.isSkill()) {
    var skillId = currentAction.item().id;
    // We have the skill ID
} else {
    // It's not a skill being used
}
This is untested code, so hopefully that works for you, or at-least gets you on the right path.

If you want to use this in an event (such as for setting a control variable) you'd do:
JavaScript:
var a = BattleManager._subject.currentAction(); a.isSkill() ? a.item().id : 0
Again, untested code.
 
Top