JS line to edit the availability of a skill?

Indinera

Indie Dev
Veteran
Joined
Mar 13, 2012
Messages
1,770
Reaction score
729
First Language
French
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"?
 
Last edited:

bgillisp

Global Moderators
Global Mod
Joined
Jul 2, 2014
Messages
12,500
Reaction score
12,783
First Language
English
Primarily Uses
RMVXA
I think you meant to post this in another section. Moving to Javascript Support.
 

Poryg

Dark Lord of the Castle of Javascreeps
Veteran
Joined
Mar 23, 2017
Messages
4,038
Reaction score
10,250
First Language
Czech
Primarily Uses
RMMV
Definitely not one line. It would require a dedicated plugin.
 

Astfgl66

Veteran
Veteran
Joined
Jan 5, 2016
Messages
675
Reaction score
518
First Language
French
Primarily Uses
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.
 

Poryg

Dark Lord of the Castle of Javascreeps
Veteran
Joined
Mar 23, 2017
Messages
4,038
Reaction score
10,250
First Language
Czech
Primarily Uses
RMMV
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.
 

Astfgl66

Veteran
Veteran
Joined
Jan 5, 2016
Messages
675
Reaction score
518
First Language
French
Primarily Uses
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.
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

I should have listened to RPGMAKER Meme thread. I should have backed up my data. The Orphan of Time, my WIP, is completely gone, all those hours of work are completely gone :(
God what was my life before smartphones (I had a grandma's phone before wednesday)
Stream will be live shortly with The Witcher 3! Feel free to drop by!
I have a specialized class on intellectual property this semester (on Patent and Trademarks, Copyrights is next semester). Only had a quick overview of that in previous business law classes. I'll be able to help more people here when it comes to knowing what to do and your rights for intellectual property!
When you wanna write another pedantic post of your views on game dev... but your cousin and aunt have invited you to bowling

Forum statistics

Threads
93,380
Messages
911,833
Members
122,876
Latest member
leproso911
Top