JS line to edit the availability of a skill?

Is there a way to edit (in-game) when a skill is available, ie swap at will between "always", "never", "use in battle" and "use in menu"?
I think you meant to post this in another section. Moving to Javascript Support.
Definitely not one line. It would require a dedicated plugin.
You most definitely can do it, though it's a bad idea.

Just change $dataSkills[skillId].occasion to what you want (0-> always, 1-> battlescreen, ...).

Try it yourself:
Code:
$dataSkills[8].occasion = 1
This will make heal only castable on the battle screen in a default project.

It's a terrible idea outside of very few fringe cases though, as all data object changes only get reset when closing and restarting the game.
That means they persist along save and reloads as long as the game isn't closed. Use at your own risk, and only if you know what you're doing.
It's a terrible idea outside of very few fringe cases though, as all data object changes only get reset when closing and restarting the game.
That means they persist along save and reloads as long as the game isn't closed. Use at your own risk, and only if you know what you're doing.
That is why I said it required a dedicated plugin.
Yeah, just thought I'd mention it in case someone making a game where the player can't save or load is reading this.
In that case it's a valid solution, in all others, a terrible idea.

Basically, if you know what you're doing, you could use it when the player doesn't have the ability to save or load without closing the game, and get away with it.

Given this behaviour, you could probably make a horribly inefficient workaround by calling $dataManager.loadDatabase() when a file is loaded, that should reset database objects properly. Probably your best bet outside of a dedicated plugin.

Original thread: https://forums.rpgmakerweb.com/threads/js-line-to-edit-the-availability-of-a-skill.115720/