So I created a job class that allows the user to switch stats around such as switching Atk /Def, HP/MP, etc. But I've been struggling since I'm new to this. Any help would be great. Thanks!
Well, it depends mostly on how you want to do that. How do you want the stats to swap? Do you want the stats to go back to normal after the battle ends? Do you want them to stay swapped until you swap them again? All these options are possible, as I said it is up to you to decide how.
Now the question is: what do you exactly want to do? Could you explain your skill with more dettails?
Well, the stats should definitely revert back to normal. Mostly, it's the current stats being switched like current mdef switched with matk and so on. I'm also trying to make a move that randomly buffs one stat for a certain number of turns (let's say about 2-3 turns?) for single targets.
Well, first of all if you want it to be a buff you cannot use a formula since formulae are meant to return a value and that value is supposed to be the skil damage. Honestly if that's the only class with such a buff you could change your damaging skill formulae like this:
#number is the number of your stat swap state
#formula_using_mdf is just your attack formula based on mdf to attack (e.g. a.mdf*4 - b.mdf*2)
#formula_using_mat is the same as above but for every mortal without your stat swap state (e.g. a.mat*4 - b.mdf*2)
That will result in any other class that uses the same skill attacking using the normal MAT formula while only the class with the stat swap state can benefit from the other formula. This can be applied to any other skill so that you can still give them to other classes.
The advantage is that this way you won't have to revert them back to normal, the only thing you have to do is set the stat swap state do disappear after battle.
Of course this won't cover the defensive part. For that you have to add something like this:
#number is your swap state number
#formula_with_mat is the skill formula that uses b.mat to calculate damage
#formula_with_mdf is the same as above but with mdf (as usual)
If you have skills that can be used from enemies AND the class that can swap stat then you have to mix these formulae together. That being the case I recommend you to put everything into a script.
class Game_Battler < Game_BattlerBase
def swap_atk(a)
#change "number" to be your stat swap status id
a.state?(number) ? (atk = a.mdf) : (atk = a.mat)
return atk
end
def swap_def(b)
#change "number" as in the previous forula
b.state?(number) ? (def = b.mat) : (def = b.mdf)
return def
end
end
Then when using a formula which is supposed to use mat or mdf (it doesn't matter if they are attacker's or defender's stats) you just have to call swap_atk(a) instead of a.mat and swap_def(b) instead of b.mdf. Of course that only works for the mat/mdf swap. I didn't have the chance to test the code, if it doesn't work let me know, I'll fix it when at home.
Sample Formula using the script:
Code:
#1: magic spell which hits magic defense
swap_atk(a)*4 - swap_def(b)*2
#2: magic spell which hits physical defense
swap_atk(a)*4 - b.def*2
#3: physical spell which hits magical defense
a.atk*4 - swap_def(b)*2
#4: skill that uses neither mat nor mdf
a.atk*4 - b.def*2
Cartoonier cloud cover that better fits the art style, as well as (slightly) improved blending/fading... fading clouds when there are larger patterns is still somewhat abrupt for some reason.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.