Hi, i'm looking for a formula for a skill which recovers mp that restores the amount equal to cost of the last skill used. So for example if someone used a skill which used 5 mp say on the previous turn, this skill would recover the users mp by 5. Any clues?
MP recovery skill
● ARCHIVED · READ-ONLY
-
-
Try the following, although it may use up some states, but not too many (and if you really wanted to use a ton of states you can use a database extender):
Use this to apply a 2-turn state to the user after use https://github.com/Archeia/YEARepo/blob/master/Battle/LOP_Destruction.rb
(note, you need this as well https://github.com/Archeia/YEARepo/blob/master/Battle/Lunatic_Objects.rb )
so say skill 150 would apply state 50 "30 Mp Used"
and then use this script for custom costs https://github.com/Archeia/YEARepo/blob/master/Gameplay/Skill_Cost_Manager.rb
then put this in the skill comment box
<custom cost requirement>if self.state?(50) then mp += 30 end;if self.state?(51) then mp += 20 end;if self.state?(52) then mp += 4 end;</custom cost requirement><custom cost perform>if self.state?(50) then mp += 30 end;if self.state?(51) then mp += 20 end;if self.state?(52) then mp += 4 end;</custom cost perform>
and soforth
and say if you want it so that this healing move costs 5 tp then just add
tp -= 5;
as well.
Mind you, you have to put in MP Cost/ TP cost in the formula manually.
I personally like to use
http://crystalnoel42.wordpress.com/2013/07/05/crystal-engine-extra-stats/
then have these stats:
hpc, mpc, tpc
for HP Cost, MP Cost, and TP Cost and have it so that the minimum for those stats is 0 and the maximum is 999
and have it so that it's say
if self.state?(50) then mp += 30 end;
if self.state?(51) then mp += 20 end;
if self.state?(52) then mp += 4 end;
self.tp -= 5 * xstat.tpc / 100;
since I hate working with "float" values like the normal mp cost because half cost isn't "50", it's 0.5 and there's no such thing as HP Cost without scripts.
Mind you, you can have it so that the requirement for skills and the cost of skills are different. I'm sure you've played plenty of games where you MP is depleted when low but you still get to cast spells. -
I have a lot of skills :) that would be one way of doing it but isn't there a script i could use like "last_action.item_mp_cost?" or something?
-
Well I mean how many different numbers for MP Costs do you have?
And I wouldn't know. I don't know if the game stores that. I know it stores the last action used.
Move costs vary so I wouldn't think that the game would have a definite way of keeping track of that. But I'm not a scriptor. -
Ah ok, i'm pretty sure there is a way to call the last skill used but I don't know what it is. I have about 50 + skills so yeah a lot of states haha
I've looked at Modern Algebra's "mime script" which sorta does something similar in a way. Having loads of states isn't something I really wanted to have seeing as the skill itself is a activated by a state cast by a previous skill :) -
you could get a custom script to do that, but it will require a bit more on information - because no, there is no method to identify a skill used in a previous turn by default.
The first part of the skript has to change the skill handling, so that the curren't skills cost are stored in a variable (by the way - last skill used by party or last skill used by actor? if actor, it'll be more than one variable).
Then the other skill could access that value and restore the MP. -
can't this just be done without a script?
have every MP skill have a common event that changes a variable to that spell's MP cost...then have the MP restore skill restore MP equal to that variable in the damage formula.
a.mp+=$game_variables[x] -
That's actually not a bad idea omen ill give that a go thank you. Do you think I should use Tsukihime's "set variable" scipt for calling variable id's in skills?
-
Sounds good