Script/JS syntax to check if a skill is instant cast? (Yanfly.22)

● ARCHIVED · READ-ONLY
Started by EricW 3 posts View original ↗
  1. Hi,
    I'm wondering if there's any way to determine thru javascript if a skill the actor is using is instant cast or not (Using Yanfly's Instant Cast Plugin)?
    something like
    if (this.isInstantSkill)
    so that code only runs if the skill is instant
  2. Not sure if it will work but try this:
    Code:
    if (actor.isInstantCast(item)) {
     // Do stuff
    }
    You need to specify which actor it is and the item/skill you are checking for.
  3. How does one reference an item?
    I'm currently using
    var user = actor.currentAction();
    var skill = action.item();
    but action and skill are both undefined when i print to console.

    code is
    <Custom Action Start Effect>
    var Q1 = 74;
    var Q2 = 75;
    var Q3 = 76;
    var Q4 = 77;

    // Check if the action exists, is a skill
    if (action && action.isSkill()) {
    var action = user.currentAction();
    var skill = action.item();
    if(user.isInstantCast(skill)){
    if (user.isStateAffected(Q4)){
    user.removeState(Q4);
    user.addState(Q3);
    }
    else if (user.isStateAffected(Q3)){
    user.removeState(Q3);
    user.addState(Q2);
    }
    else if (user.isStateAffected(Q2)){
    user.removeState(Q2);
    user.addState(Q1);
    }
    }
    }
    console.log(user.isInstantCast(skill));
    console.log(user.currentAction());
    console.log(action);
    </Custom Action Start Effect>