Skill Abilities

This is my first time using this forum so I don't know if this belongs somewhere else or was already asked before, but here goes. I'm trying to make a ton of my own abilities for my game, some of which have completely different uses in and out of battle. For instance, the ability I'm struggling with is a teleport. In battle, the user's party will just flee. Out of battle, you will be able to return to the overworld map. I have it coded in a way this works, until exiting my first battle. After that, the skill won't work out of battle. I know it has to do with the way my conditional branches are set up, but I can't seem to figure it out.

Also, I don't have a good name yet so, ignore the Japanese I guess...
If anyone is curious, I think it roughly translates to "A Kitsune's/Fox's Trial"
I could be horribly wrong...
What I'd do is run a common event at the start of every battle that checks whether an actor has the skill equipped, and if so, forget that skill and learn the battle version of the skill (requires 2 database entries for the skill, 1 for on-map, 1 for in-battle).
At the end of each battle, run a similar event that checks for these skills and swaps them back to on-map skills.
my thing for this was plugin related.
learn 2 versions, field version has <hide in battle>, battle version has <hide in field>
it looks like the MZ plugin version is visustella's skill/state core in the skill accessibility notetags.

edit: i see in your event that you turned on an 'else' branch in the 2nd check and never used it.
dont think it should be causing any issues but would still fix that anyways.

you also dont have a condition checking if teleporting should be disabled
this would be a switch you just turn on when you dont want them teleporting.

an event version i would get someone with script knowledge to help make 1 check for 'party in battle'
conditional branch: 'script' (edit2: thx @caethyril)

and i see that your teleport is using fixed numbers, this fine if its only a 1 dungeon game.
could also be good practice using position variables here for bigger project warp/teleport and puzzles.
my thing for warp is the transfer event going into a dungeon sets 3 variables "tpMapID" "tpX" "tpY"
(and turns off the restrict warping switch)
then the warp out of dungeon event uses those 3 variables instead of fixed numbers to warp outside the dungeon entrance (and turn on the restrict warp switch again because exiting a dungeon)
The game remembers the last troop encountered per session, that's why your approach breaks after one battle.

A non-plugin option could be to use Conditional Branch > Script: $gameParty.inBattle(), e.g.

◆If:Script:$gameParty.inBattle() ◆Comment:Battle effects ◆Abort Battle ◆ :Else ◆Comment:Map effects ◆Text:None, None, Window, Bottom : :Return to the overworld? ◆Show Choices:Yes, No (Window, Right, #1, #2) :When Yes ◆Transfer Player:Overworld (11,9) ◆ :When No ◆ :End ◆ :End

Original thread: https://forums.rpgmakerweb.com/threads/skill-abilities.139153/