RMMV - Get Selected enemy ID in Battle.

● ARCHIVED · READ-ONLY
Started by Landazar 3 posts View original ↗
  1. I have small problem with code, to be precise I need to get currently selected / targeted enemy ID in battle, regardles of number enemies on the field, let me show you:
    Since I'm using Action Sequence skill (by Yanfly's Engine Plugins) I need substract enemy's def/mdf from damage formula, but that damage is stored in variable.

    This is currently written script:
    Code:
        var BaseDamage = 80
        var targetEnemyId = /* ???? */
        var def = $dataEnemies[targetEnemyId].params[3]
        var ActorID = 5
    
        $gameVariables.setValue(5, Math.floor($gameActors.actor(ActorID).level * (BaseDamage + $gameActors.actor(ActorID).atk)) - def)
    How Do I set var targetEnemyId to get selected enemy ID to fully read it's def?
  2. Are you talking about enemy ID or enemy Index?
    Enemy ID is the ID number on the enemy tabin the database
    Enemy index (or troop index) is the number which of the enemies in a troop is being targeted.

    They are connected but not identical (every enemy in a troop can have the same ID if it is a swarm of the same enemies, but each will have their own index number), and a lot of people who have problems in that area usually have problems because they confused one with the other.
  3. Hmm, now I'm a little bit confused... I wan't to get selected enemy params via selecting target with skill, like this