Show enemy's next move

● ARCHIVED · READ-ONLY
Started by Famicon80 8 posts View original ↗
  1. Hello everyone! In slay the spire enemy's telegraph what their next action will do, like so: 77aaf12ce1.jpg
    The big knight's the enemy and the thing above him is telling the player he's going to attack them for X damage this turn.
    Is there a way to replicate this in RPG Maker MV, perhaps having a state be the thing above the enemy's head showing their next move?
  2. Well if you're using default MV battles and want it to show while you are selecting your party's actions, it somehow cannot be done since afaik the enemy actions are only created after the party already chose their actions. In which case, it would need a rewrite of when the actions are created, which might cause some problems with other behaviors.
  3. You can definitely replicate this using Yanfly's Skill Core and Buffs & States Core.

    The following code will strict the enemy's skills to require a certain state to use. Then, when they use a skill, it removes the current state and randomly applies a new one - thus dictating which action they will take on the next turn.

    skill note
    <After Eval>
    var old = #
    // Change # to the skill's required state
    BattleManager._subject.removeState(old);
    var newstate = [X, X, X, X];
    // Replace any X with a state ID, can have as many as you want here
    var index = Math.randomInt(newstate.length);
    var choice = newstate[index]
    BattleManager._subject.addState(choice);
    </After Eval>

    <Custom Requirement>
    var x = #
    // Change # to the skill's required state
    if (user.isStateAffected(x)) {
    value = true;
    } else {
    value = false;
    }
    </Custom Requirement>

    The Buffs & States Core will allow you to show the state icon along with the stack number as indicated in your image. That part will have to be set up separately however.
  4. Wow thats a neat workaround, and you can even extend it to make more decent AI easily (though also limited by some factors since it runs directly after the enemy makes its its moves).
  5. I was trying to figure out how to do this for awhile, and that's a really easy and good solution.
    thank you @JGreene, that's pretty much what I wanted!

    EDIT: Is there a way to have the var newstate be some pre-made array of state ID's unique to each enemy in the database? Otherwise there would be lots of duplicate skills with the only difference being what states they apply.

    Also, if it chooses the same state twice in a row that states deleted and the enemy has nothing to do.
  6. Famicon80 said:
    I was trying to figure out how to do this for awhile, and that's a really easy and good solution.
    thank you @JGreene, that's pretty much what I wanted!

    EDIT: Is there a way to have the var newstate be some pre-made array of state ID's unique to each enemy in the database? Otherwise there would be lots of duplicate skills with the only difference being what states they apply.

    Also, if it chooses the same state twice in a row that states deleted and the enemy has nothing to do.

    For the pre-made array, you'd probably need some heavy scripting for that.

    And I've fixed the code. Just needed to add in an if else segment.

    code
    <After Eval>
    var old = #

    // Change # to the skill's required state
    var newstate = [X, X, X];
    // Replace the X's with state IDs, can have as many as you want here including duplicates
    var index = Math.randomInt(newstate.length);
    var choice = newstate[index]
    if (user.isStateAffected(choice)) {
    } else {
    BattleManager._subject.removeState(old);
    BattleManager._subject.addState(choice);
    }
    </After Eval>


    <Custom Requirement>
    var x = #

    // Change # to the skill's required state
    if (user.isStateAffected(x)) {
    value = true;
    } else {
    value = false;
    }
    </Custom Requirement>
  7. awesome, thanks again for this!
  8. Famicon80 said:
    EDIT: Is there a way to have the var newstate be some pre-made array of state ID's unique to each enemy in the database? Otherwise there would be lots of duplicate skills with the only difference being what states they apply.

    Yup, you can do this, just modify JGreene's code like this:

    Code:
    <After Eval>
    var old = #
    // Change # to the skill's required state
    var newstate = $dataEnemies[user._enemyId].meta.states.split(',').map(function(n){return parseInt(n)});
    // Reads the allowed state values from the enemy notetag
    var index = Math.randomInt(newstate.length);
    var choice = newstate[index]
    if (user.isStateAffected(choice)) {
    } else {
    BattleManager._subject.removeState(old);
    BattleManager._subject.addState(choice);
    }
    </After Eval>

    In your database, on each enemy in the notetag, you can write:
    Code:
    <states:X,X,X,X>
    (replace X with the different state IDs)