When I say ‘selected’ I mean the skill that the cursor is currently over in the battle skill menu.
I tried this: return BattleManager.inputtingAction().mp; but it didn’t work. I don’t know much about scripting.
When I say ‘selected’ I mean the skill that the cursor is currently over in the battle skill menu.
I tried this: return BattleManager.inputtingAction().mp; but it didn’t work. I don’t know much about scripting.
BattleManager.inputtingAction() is a Game_Action, not a Game_Battler. Things like mp only exist on a Game_Battler.
There’s nothing in the Game_Action to return the cost, so you’ll need to get a bit creative:
let action = BattleManager.inputtingAction();
let a = action.subject();
let skill = action.item();
let mpCost = a.skillMpCost(skill);
If you need it to be all in one line, it’ll look like this:
BattleManager.inputtingAction().skillMpCost(BattleManager.inputtingAction().item())
Or you could slightly simplify it with a function:
(a => a.subject().skillMpCost(a.item()))(BattleManager.inputtingAction())
Thank you for your help! What you suggested gives me this error: “cannot read property mpCost of null” I know for sure that the skill highlighted has an MP cost, so what could be the issue?
I’m not sure what you wrote exactly, but indeed mpCost does not exist. It is skillMpCost.
That’s the error I get when trying to use the one line function while selecting a skill in battle. Interestingly I’ve had it say the same but with ‘skillMpCost’ instead of ‘MpCost’ when using the first one line script, but the second has always thrown ‘MpCost’ in the last couple hours I’ve been messing with it. Any ideas?
So basically what you’re saying is that you used the second line as-is, and it definitely says skillMpCost, but you’re still getting an error about mpCost, right?
If so, that likely means you’re calling it at an unsupported time. I think what you’ll need to come up with is something to replace the BattleManager.inputtingAction() part which will work at the time you need to call this. And if you’re trying to get it while the player is selecting an action (which, in retrospect, it actually sounds like you are), you’ll need a fairly different approach.
In other words, I’ll need more information from you about where you’re putting this script.