Is there a way for the MP cost of a skill to be determined by a variable? A rough formula would be "v[n] = MP cost".
Variable in a formula as an MP cost?
RGSS3 Script Requests
Code:
a.mp -= v[n]
Where would I paste this in the database?
oh, sorry 😀
In the formula section of the desired skill or item. You can use any valid javascrip there, and a few objects are available. you have access to the attacker, which has mp. its just a case of reducing the mp..
the ; in the formula signifies a new line to the game interpreter. so it would do the damage, then take the mp (but it would seem to be the same time to the player)
Hope this helped :*
In the formula section of the desired skill or item. You can use any valid javascrip there, and a few objects are available. you have access to the attacker, which has mp. its just a case of reducing the mp..
the ; in the formula signifies a new line to the game interpreter. so it would do the damage, then take the mp (but it would seem to be the same time to the player)
Hope this helped :*
Thank you so much!
np, hope it works, I havent messed with the formula box of mv much - it woulda worked for ace though 😀
@Cuddlebuns @??????
Unfortunately the Diabolical Codemaster made a tiny but important mistake...
The damage done is always the last number processed in the damage formula, so the cost reduction needs to come first:
Additionally, while this does reduce the MP by the cost, the engine no longer prevents the use of the spell if the actor has less MP than set in variable 5, he would always be able to case this skill even with 0 MP (because the skill cost itself needs to be set to 0)
To prevent that you'll need a script that allows for different skill costs - for example the one from Yanfly or from Tsukihime.
That would even allow you to set items as skill costs in addition to MP and TP however
Unfortunately the Diabolical Codemaster made a tiny but important mistake...
The damage done is always the last number processed in the damage formula, so the cost reduction needs to come first:
Code:
a.mp-=v[5]; a.atk*4 - b.def*2
Additionally, while this does reduce the MP by the cost, the engine no longer prevents the use of the spell if the actor has less MP than set in variable 5, he would always be able to case this skill even with 0 MP (because the skill cost itself needs to be set to 0)
To prevent that you'll need a script that allows for different skill costs - for example the one from Yanfly or from Tsukihime.
That would even allow you to set items as skill costs in addition to MP and TP however
Well, there you go lol
My oopsie 😀
My oopsie 😀
This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.
Original thread: https://forums.rpgmakerweb.com/threads/variable-in-a-formula-as-an-mp-cost.109465/