[FROG] Magic - Supercharge Your Class Mechanics!

@Blue001
Are you using FROG Core with it? Pretty much all of my plugins need that. I ran a test on a newly created 1.6.1 project with only my core and this plugin included without changing any of the default parameters. I didn't get a crash. It didn't actually do anything as none of the classes were configured to do anything.

I try to write my code to remain compatible with 1.5+ because I know a lot of devs are still on this version although there is a chance that I accidentally used some syntax that isn't supported in that version. The error you received doesn't make a lot of sense as drawSkillCost is definitely a function tied to the Window_Base object. I have run into this type of thing before when hitting an incompatibility with a Yanfly plugin but on its own, it doesn't make much sense. That function should exist.

You'll probably want to leave Save Magic Object set to false. This object is the plugin parameter data and turning this on will save this info when a game is saved and load it back when a game is loaded. You only want this on if your game changes the plugin parameter data in-game and you need those changes to persist throughout the rest of the game. This is a feature that I include in all of my plugins, mostly for those who know JavaScript. This plugin stores most of the info it needs with each actor (that gets saved by default) so the Save Object option isn't as useful in this plugin as it is in some of my other ones.
Hm. Ill go through everything to make sure we are having the same results....
I'm using RMMV 1.6.1, On windows 10 (not sure if that matters.)
I started a new project. No other plugin EXCEPT Frog Core. (v1.0.2)
Frog Magic (v0.9.02) is underneath Frog Core in the plugin list.
I changed 0 parameters in Frog Magic plug in set up.
Started the project immediately in test mode, no changes to the games database entries
Opened party menu. Went to the skill screen.

Error (with console info below)

TypeError: this.changeFontSize is not a function
at Window_SkillList.drawSkillCost (FROG_Magic.js:2356)
at Window_SkillList.drawItem (rpg_windows.js:2211)
at Window_SkillList.Window_Selectable.drawAllItems (rpg_windows.js:1256)
at Window_SkillList.refresh (rpg_windows.js:2237)
at Window_SkillList.setStypeId (rpg_windows.js:2149)
at Window_SkillType.update (rpg_windows.js:2066)
at Window_SkillType.update (FROG_Magic.js:2290)
at rpg_core.js:7035 at Array.forEach (<anonymous>)
at WindowLayer.update (rpg_core.js:7033)
SceneManager.catchException @ rpg_managers.js:1949
SceneManager.update @ rpg_managers.js:1910
requestAnimationFrame (async)
SceneManager.requestUpdate @ rpg_managers.js:1896
SceneManager.updateMain @ rpg_managers.js:1988
SceneManager.update @ rpg_managers.js:1907


I also tried to test a battle in the troop editor. Had the same error.
But different console info. ?

TypeError: this.changeFontSize is not a function
at Window_BattleStatus.drawGaugeAreaWithTp (FROG_Magic.js:1627)
at Window_BattleStatus.drawGaugeArea (rpg_windows.js:5523)
at Window_BattleStatus.drawItem (rpg_windows.js:5496)
at Window_BattleStatus.Window_Selectable.drawAllItems (rpg_windows.js:1256)
at Window_BattleStatus.refresh (rpg_windows.js:5490)
at Window_BattleStatus.initialize (rpg_windows.js:5468)
at new Window_BattleStatus (rpg_windows.js:5456)
at Scene_Battle.createStatusWindow (rpg_scenes.js:2383)
at Scene_Battle.createAllWindows (rpg_scenes.js:2365)
at Scene_Battle.createDisplayObjects (rpg_scenes.js:2351)
SceneManager.catchException @ rpg_managers.js:1949


Seeing that the skill window error is for drawing skill cost, and when I do have other plugins on and this all work the one thing I'm missing is skill cost... it can't be a coincidence.
@Blue001
I'll take another look at it later on tonight. I should get the same results as you running through the steps as you detailed. Chances are, I'm missing some exception handling that should be easy to fix.

Edit:
This is weird. changeFontSize is a custom method that I added to Window_Base. It is located in FROG Core. I'm not getting any crashes following the exact steps you detailed either. I can't see any reason why a new project with just those two plugins enabled would crash like this. It doesn't make any sense to me.


Edit 2:
Never mind. Apparently, I added this method to my FROG Core and didn't update the Github repository with the change. Now that explains it. I will update this shortly. Sorry about that. I totally screwed up there.

FROG Core has been updated to v1.0.3. That should fix the issue.
Thanks for the fix, it worked great!

... So a couple small requests. If possible?

1. Any way we could have a way to have icons set for every spell level? So one of those option screens where it has all the levels on the left and on the right we can set an icon id? I'd like to give a graphical version of L0 / L1 / etc. Or at the very least a way to shift it so there is no Lv 0 and starts at Lvl 1?

2. Along the same lines, any way you can have the spell cost on spell slots show the current charges allowed for that level before the Cost type?
So.... [Fire 3/L0] so players don't have to rely on the 4/3/2/1/0 at the top of the screen?
1. Any way we could have a way to have icons set for every spell level? So one of those option screens where it has all the levels on the left and on the right we can set an icon id? I'd like to give a graphical version of L0 / L1 / etc.

I sort of felt that having icons on both the left and right was a little too cluttered. It could be added if you really want it. I did notice when I installed Yanfly's Skill Core that it put some icons on the right. I'm not sure what they mean or if they could be configured to work the way you want (or if you're even using that plugin) but it might be an option. But...

Or at the very least a way to shift it so there is no Lv 0 and starts at Lvl 1?

This is already possible. An example can be found with the Paladin class in the demo. The basic idea is, use 0 for all zero-level slots (Spells Per Level, Spells Known etc). So 0/3/2 would show up as 3/2 and indicate 3 first level spells and 2 second level spells. Any slot that a caster has 0 spells in is ignored from the display. Of course, this means that if they received 3rd level spells but no 2nd level spells, the display would only show the first and third slots but I can't see why anyone would want to do this.

2. Along the same lines, any way you can have the spell cost on spell slots show the current charges allowed for that level before the Cost type?
So.... [Fire 3/L0] so players don't have to rely on the 4/3/2/1/0 at the top of the screen?

Yes. I just added a %2 code for the Spell Slot indicator that converts to the number slots remaining so it'll be easily configured to %2/L%1 or whatever you want. It'll be in the next update.

From before...
3. I'm only seeing the first number from 3/1/1/1/1/1/1... Shows "3" in my mp area.

The order this plugin checks to find an actor's max spell level is as follows.

If the Max Spell Level parameter is set, it'll use the value that corresponds with the actor's current level no matter what it says. If that's not filled in, which is probably most of the time, it'll check the highest slot for Spells Per Day, Hybrid Retrieve and Spells Known and look down level by level until it finds a one that's greater than zero. That's the max level it uses in this case.
Awesome on the 2% thing, super helpful!

As for the other thing, I Honestly want my 0's to display at all times like it did in FF1. hmmmm.
Spoiler: See image
ffmenu.jpg
As for the other thing, I Honestly want my 0's to display at all times like it did in FF1. hmmmm.

Done ... as an option you'll have to enable. Will also be in the next update.
Frog Magic has been update to v0.9.03!
  • You can now use the number of spell remaining in the Spell Slot Indicator formula with a %2 (Spell level is %1).
  • New option to list the zeros for spell levels that haven't been obtained yet.
  • Bug fix or two.
Oh man... I forgot to set the Save Magic Object thing and updated the plugin and lost all my setup. XDDD
Thankfully I had only set up one spell list, and 4 spells.

Edit... never mind.I'm just silly. I added the plugin twice. XD
@Blue001
That sucks. As long as you don't remove the plugin and re-apply it, it shouldn't wipe your configuration. There's also a way to make a back up by making a copy of your plugins.js file periodically. It's probably a good practice to get into the habit of with my plugins. I heavily utilize the capabilities of the 1.5 plugin parameters as I can't really think of a friendly way to store that much data by other methods. Sorry about that, though. Hope that doesn't happen again.

Edit: I just realized that you referenced Save Magic Object. That's for in-game changes. Because the plugin parameters are stored in the $frogMagic JSON object, it's properties can be changed through JavaScript. A plugin parameter value that a game starts with can change (through the Script Command and some custom JavaScript) while the player is playing the game. But these changes are lost unless the object is saved along with the rest of the save data before the game is shut down. That's what this option does. It doesn't allow you to save your plugin parameters if they're deleted from the editor. That needs to be manually backed up. No plugin parameter can do that.
This, and all your other D20 based plugins, are amazing. I encourage development.

Inevitably, being the newbie that I am, I ran into a problem. It's probably a really easy solution that I'm just overlooking but I've been running into the same thing for the past hour or so and I can't figure it out. When I playtest the game, before I even get to see my start screen, it immediately tells me "Cannot read property 'maxSpellLevel' of null". Now, I've only set up a single class (5e Druid) so far with a single spell list using the Hybrid Caster Type, the Spell Slots Resource and All Spells Default Known.

I've found two mentions of Max Spell Level, one under the magic system setup under the class setup, which I noticed in the demo is used only for the spontaneous casters and empty for everyone else, and one under the spell list set up which is automatically set to 9 and is 9 for each of the spell lists you've set up.

Am I missing a Max Spell Level somewhere or did I make a mistake somewhere else?
Thanks in advance for your time.
@Holyhalo
Can you press F12 after getting this error and sending me the error message from the console? That might help me track down what's going wrong.
This is what I get
Spoiler: Error
TypeError: Cannot read property 'maxSpellLevel' of null rpg_managers.js:1949
at Game_Actor.initializeMagic (FROG_Magic.js:1784)
at Game_Actor.setup (FROG_Magic.js:1731)
at Game_Actor.initialize (rpg_objects.js:3408)
at new Game_Actor (rpg_objects.js:3393)
at Game_Actors.actor (rpg_objects.js:4587)
at Game_Party.<anonymous> (rpg_objects.js:4871)
at Array.forEach (<anonymous>)
at Game_Party.setupStartingMembers (rpg_objects.js:4870)
at Function.DataManager.setupNewGame (rpg_managers.js:219)
at Function.DataManager.setupNewGame (FROG_Magic.js:1437)
@Holyhalo
Check to make sure that your Class Config has a Spellbook name that matches the name of a Spell List. The error you received appears to indicate that the class is configured but it's not able to match up the Spell List. I will update my code so that it fails more gracefully in this scenario but I believe that you can fix this by establishing this link between the two. Let me know if this was the issue.
It's working now, thanks. I managed to set up my Hybrid caster. I noticed that once his spells are prepared I have no way to change that. Is it possible to swap out individual prepared spells? In the demo, the cleric has to re-prepare all 12 of his spells every time you use the crystal/"take a long rest". Is it possible to manually unprepare a single spell and then prepare a new one instead? Or, when you rest, rather than losing all your spells, have the opportunity to swap out prepared spells as needed?
@Holyhalo
Not yet. I still need to come up with a good way to make this process easier to manage. Obviously, I can't just let all prepared casters swap around spells at any time. That wouldn't emulate D&D very well. I've thought about some option that would let you re-memorize the previous day's spells but there's a couple issues I had with implementation. If it's automatic, how do I set a deadline on when the re-memorized spells are committed to memory and when they can be cleared out and manually chosen as usual? Also, what happens if an actor only ends up memorizing half their spells and leaves the rest open (which is perfectly doable in the current system as well as in D&D). This one might not be a big deal as the slots could probably just remain open. My current line of thinking revolves around plugin commands that could manually enable some sort of menu options that allow the actors to reset all of their spells and then add and remove them at will and then manually disable this ability when needed. This would require a ton of work on my part to get all these new menu options and associated functionality developed and tested. It would probably take a few weeks of dedicated work just to make it somewhat easier to maintain prepared and retrieved spells.

As you can see, there's a lot of things to consider here that are just kind of hand-waved away when dealing with its pen and paper counterpart. In D&D, a player can just state to the DM, "I'll just keep my same spells". Or they might erase a couple off their handwritten list and jot in a couple new ones to replace them after a night's rest. This becomes a lot more challenging when it had to be physically coded into the engine. I haven't settled on a solution yet so I decided to release the beta without one at the moment. Right now, it just clears your list and you have to go in and choose your spells for the day. I know it can be better but it'll have to do for now. I'm hoping to have something in place before I call this plugin Version 1.0.
It does sound much easier to say it than to code it. Perhaps a (temporary) solution could be to prompt for a spell reset when you use the healing crystal/rest/inn/camp? Whether that would be a party wide prompt or one per actor depends on how easy it would be to check if someone is a prepared or hybrid caster. Anyway, probably just a newbie thought, back to class designing and waiting for version 1.0.
Thanks again for the help.

EDIT: Is it possible to have a class that learns or prepares a certain amount of spells, no matter their level? For example, they can learn/prepare 2 0-level spells/cantrips and then 5 more spells from all the spells they currently have spell slots for/access to? So, if they have -/4/2/1 Spell Slots they could prepare 2 0-level spell and 5 spells total from all their 1st, 2nd and 3rd level spells that they know/have learned. If they wanted they could choose 1 1st level spell, 1 2nd level spell and 3 third level spells, even though they only have on 3rd spell slot per rest or any other variation on that.

EDIT 2: How would I go about setting up spells that can be cast using higher level spell slots to deal more damage/target more enemies? Should I just make a lvl1 Spell A that deals 5 damage and a lvl 2 Spell A that deals 10 damage or is there a way to set this up within your plugin?
EDIT: Is it possible to have a class that learns or prepares a certain amount of spells, no matter their level? For example, they can learn/prepare 2 0-level spells/cantrips and then 5 more spells from all the spells they currently have spell slots for/access to? So, if they have -/4/2/1 Spell Slots they could prepare 2 0-level spell and 5 spells total from all their 1st, 2nd and 3rd level spells that they know/have learned. If they wanted they could choose 1 1st level spell, 1 2nd level spell and 3 third level spells, even though they only have on 3rd spell slot per rest or any other variation on that.

EDIT 2: How would I go about setting up spells that can be cast using higher level spell slots to deal more damage/target more enemies? Should I just make a lvl1 Spell A that deals 5 damage and a lvl 2 Spell A that deals 10 damage or is there a way to set this up within your plugin?

I second both of these, as they would be very useful for a project I'm working on, which uses a spellcasting system similar to the above, like 5th edition D&D.

Basically, you can prepare a spell, provided you know it (for Wizards) or it's in your spell list (for all the other prepared casters), but when you cast it, you can choose to cast it at its normal level spell slot, or you can cast it at a higher level to get a more advanced effect, longer duration, etc.

For example, you could cast magic missile as a 1st-level spell, and it deals three shots of 2-5 damage. But if you cast it from a higher-level slot, you get an additional shot of 2-5 damage for each extra level. So, you could cast it as a 5th level spell and dish out 7 shots of damage instead of 3, since you're casting it at +4 levels.

Clumsy UI mockup below:

Spoiler
clumsy mockup.png

For the second part, I'll reference 5th-edition D&D again:

Spontaneous casters (Sorcerers, Bards, etc.) work like in the plugin as it is now, except that they can learn spells of whatever levels they can cast, without worrying about learning X spells at level Y. So if a Sorcerer levels up, but none of the spells he has at the highest level he can cast look appealing, he can just go nab that spell from a few levels ago that he didn't pick earlier.

Another related thing that Spontaneous casters can do in 5th edition D&D is replace an existing spell with a new spell any time they learn a new spell. That is, they learn a new spell, and then they can optionally "forget" a spell to learn an extra one. Since you don't need to worry about knowing a large number of spells at each level, it frees players from having to track multiple different versions of spells, and lets them choose from a broader variety of spells than a normal Vancian system.

The easiest way I can think of to implement it would be to add a section in a spell's entry that lets you reference other skills (maybe just a list of skill IDs for the enhanced versions), and have the separate skills be obfuscated into a menu that just chooses from them and uses a spell slot like normal for that version of the skill.
I did some looking, and I was able to approximate D&D 5th edition spellcasting with SumRndmDde's Skill Extender plugin.

I made the dummy extender skill for it, and then created a specific version for each possible level of the spell. It even shows proper costs and consumes slots correctly! This introduces the issue of Spell learning now no longer being done through FrogBoyMV's menu, but I think I can cover learning and preparation with Yanfly's Skill Shop and Equip Skill, respectively, to create something very much like 5th Edition D&D. Images below:
Spoiler
alu9Fdq.png


4XLv6iG.png
@Frogboy is there a reason you chose to limit Power use maximums to plain numbers, rather than formulas, inside spell lists? (Performance?)

The only way to currently change a powers use max for an actor (once it is learned) is through plugin command. (Unless I'm missing something, which is often) That seems a bit... static. 😉

Thanks for your time!

Original thread: https://forums.rpgmakerweb.com/threads/frog-magic-supercharge-your-class-mechanics.99243/