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
Script to verify if I am in battle
● ARCHIVED · READ-ONLY
-
-
Code:
SceneManager._scene.constructor === Scene_Battle
Could use this in conditional branch checks etc.. :) -
-
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. -
I did not think of that at all lmao
-
I only know it because I've had to search for it a couple dozen times :D
-
-
@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
-
-
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
-
@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 -
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; } -
@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. -
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.