Currently I'm making an item called a Flash Orb which randomizes a number with the maximum of 3 and minimum of 1 to check if it's 1 to teleport to the start (I'm making a game with courses and a hub), the question is, how do you check if the player is in battle? 🤔
How do you check if the player is in battle?
RPG Maker VXAce SupportAaaarghhhh! There is a method/variable you can use that tells you, but I don't have Ace with me so I can't look it up.
Try $game_party.in_battle or $game_party.in_battle?
If not, open up the scripts (F11) and do a global search (control+shift+f) for in_battle.
You could also check if the current scene is Scene_Battle, but I can't give you the exact command for that either, for the same reason.
Try $game_party.in_battle or $game_party.in_battle?
If not, open up the scripts (F11) and do a global search (control+shift+f) for in_battle.
You could also check if the current scene is Scene_Battle, but I can't give you the exact command for that either, for the same reason.
SceneManager.scene_is?(Scene_Battle) to test if the current scene is the battle.
I suppose the check to battle is simply to prevent the use of the item, as transfers don't work in battle?
Then don't check, just make the item unusable in battle in the database.
Then don't check, just make the item unusable in battle in the database.
Shaz got it right: $game_party.in_battle will return true or false based on whether you're in battle.
But if all you want to do is disable the item's usage while in battle, you definitely want to go the route that Andar suggested instead.
But if all you want to do is disable the item's usage while in battle, you definitely want to go the route that Andar suggested instead.
I didn't read the whole thread. I didn't realize you just wanted to disable an item while in battle. Definitely better to just change its properties, as mentioned above.
Original thread: https://forums.rpgmakerweb.com/threads/how-do-you-check-if-the-player-is-in-battle.42379/