Check whether in/out of battle.

Hello again! ><

Was looking to see if there's a battle check that can be used to make a common event I have for a move behave differently in/out of battle, to avoid any mess ups.

Any advice?
The correct syntax to look for this is: $gameParty.inBattle()

This will return 'true' if you're in battle and 'false' if you're not, so if you're using it inside a Common Event (rather than inside a plugin or a battle formula), just copy and paste that into the "Script" option of a Conditional Branch event command ("Script" is on page 4 of the Conditional Branch dialog).
How is the common event called and what does it do?
Yes, there are ways to check if you are on the battlescreen or on the map (they're even using different interpreters for event handling on map and on battlescreen), but because they are using different interpreters there are differences and we can help better if we know what you want to do instead of how you want to do it.
The correct syntax to look for this is: $gameParty.inBattle()

This will return 'true' if you're in battle and 'false' if you're not, so if you're using it inside a Common Event (rather than inside a plugin or a battle formula), just copy and paste that into the "Script" option of a Conditional Branch event command ("Script" is on page 4 of the Conditional Branch dialog).

Thank you 🙂 thought it would be something annoyingly simple haha. That did the trick.

How is the common event called and what does it do?
Yes, there are ways to check if you are on the battlescreen or on the map (they're even using different interpreters for event handling on map and on battlescreen), but because they are using different interpreters there are differences and we can help better if we know what you want to do instead of how you want to do it.

Ah sorry, I have a habit of asking piece by piece so I have a chance to work things out through fiddling ><;;. I am making a move that gives a "fire" state in battle but outside of battle can be used to convert items.

edit// I did have an issue but it turns out the Attack Element command only affects "normal" attacks and not attacks with the Physical element? How odd :c.
Any skill can either have its own element, or be set to use the element assigned to the actor (usually by weapon, but can be state or whatever as well). "normal attack" is the setting that tells the skill to use the element on the actor data.
Ant the attack element trait is the trait that assigns the element to the actor by whatever trait list you decide on.
Hmm one more thing has cropped up, although its more of an annoyance for the time being.

In battle, I need to be able to target an ally - but in the menu, since the common event calls items rather than actors, selecting an actor seems pretty odd :c. Is there any way to get the best of both worlds or should I dig for a more complex solution.

Nt that its bothering me just yet XD.
standard solution for targeting with common events is to have the skill itself apply a new and invisible "target" - state that does nothing, then have the common event check every actor for the state to find the one targeted.
standard solution for targeting with common events is to have the skill itself apply a new and invisible "target" - state that does nothing, then have the common event check every actor for the state to find the one targeted.

Hm I'm not sure I understand (or perhaps I haven't been clear enough).

From the menu the skill would only need clicking with no need to select a target. This is because the skill does not apply the state outside of battle and has its own custom common event to run.
In battle, I need to be able to pick a target to choose who to apply the state to.

Wouldn't I need to choose an ally to target in order to give them the "target" state? In which case that route isn't needed as the attack already does its job there.
an attack is a skill - and yes, you need the skill to choose a target for this to work. But you would need that anyway, and there should be no problem to set that on the skill that calls the common event.
But yes, a skill can be set only to one case - you would have to set it to select a target outside of battle even if that is only needed inside battle.

Anything else will require a custom plugin or a completely different approach
Thanks, I guess I'll put up with it for now and do some tweaking as I go. At least the feature is functional even if it's not optimised. 🙂.

Original thread: https://forums.rpgmakerweb.com/threads/check-whether-in-out-of-battle.77457/