Script to verify if I am in battle

● ARCHIVED · READ-ONLY
Started by Nacura 14 posts View original ↗
  1. Hello

    Well again you need your help, I wanted to know there is a script that checks if I am in battle, example I need to make a derivation and I want to see if it is fulfilled, I want to consume X object, but when I consume this I will check whether I am in the battle or not.

    So that would be a script I need to verify if I'm in battle or not.

    Thank you very much everyone: D
  2. Code:
    SceneManager._scene.constructor === Scene_Battle

    Could use this in conditional branch checks etc.. :)
  3. @??????

    If it worked, thank you very much :D

    Please close threads thanks :3
  4. or the way the scripts do it is

    $gameParty.inBattle()


    I think I posted this on another thread of yours recently. To have a thread closed, you need to report the first post in the thread and ask the moderators to close it. Don't depend on them looking at the thread and seeing your post - it might not happen. Always report your first post when you're ready for the thread to be closed.
  5. I did not think of that at all lmao
  6. I only know it because I've had to search for it a couple dozen times :D
  7. @Shaz

    but the previous one works for me without problem, I'll try with yours
  8. @Shaz the last time I actually used the default battle system... or any 'battle' system... its no wonder i didnt know there was a check for it by default :D
  9. @Shaz @??????

    Create one, which checks if Actor X is in battle, and it works.

    $gameActors.actor(ActorsId).inBattle()

    Is this Script okay or not?
  10. You can just use $gameParty.inBattle() and that's enough :D Obviously, your battle scene will not appear if any of your actors is not in battle, right? :D
  11. @JamesRyan

    it is wanted to use the specific actor, but I do not take the script so I will use the short that left @Shaz
  12. In the worst case if you want to check if a specific actor is in battle, you can define a custom function:

    Code:
    Game_Actor.prototype.inBattle = function () {
    if ($gameParty.inBattle()) for (var i in $gameParty.battleMembers()) if (this == $gameParty.battleMembers()[i]) return true;
    return false;
    }
  13. @Poryg @Shaz @JamesRyan @??????

    The script is very long, and it does not take it full, so I'll use the one from Shaz that's shorter

    $ gameParty.inBattle ()

    Because I guess I will not have problems if I use this because I will only have 1 character to play, although I'm thinking of doing 2, but more zelda style I want to do so I will use 1. In total, the first temple I'm putting together and it's great.
  14. This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.