Skill Formula Help

BraveBlade

Warper
Member
Joined
Oct 16, 2016
Messages
4
Reaction score
1
First Language
English
Primarily Uses
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!
 
Last edited by a moderator:

Heirukichi

Veteran
Veteran
Joined
Sep 24, 2015
Messages
1,421
Reaction score
596
First Language
Italian
Primarily Uses
RMVXA
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?
 

BraveBlade

Warper
Member
Joined
Oct 16, 2016
Messages
4
Reaction score
1
First Language
English
Primarily Uses
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.
 

Heirukichi

Veteran
Veteran
Joined
Sep 24, 2015
Messages
1,421
Reaction score
596
First Language
Italian
Primarily Uses
RMVXA
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:


a.state?(number) ? formula_using_mdf : formula_using_mat

#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:


b.state?(number) ? formula_with_mat : formula_with_mdf

#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)

#e.g.
#b.state?(number) ? a.mat*4-b.mat*2 : a.mat*4-b.mdf*2


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
 
Last edited by a moderator:

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

Couple hours of work. Might use in my game as a secret find or something. Not sure. Fancy though no? :D
Holy stink, where have I been? Well, I started my temporary job this week. So less time to spend on game design... :(
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.
Do you Find Tilesetting or Looking for Tilesets/Plugins more fun? Personally I like making my tileset for my Game (Cretaceous Park TM) xD
How many parameters is 'too many'??

Forum statistics

Threads
105,865
Messages
1,017,059
Members
137,575
Latest member
akekaphol101
Top