In the game I'm making, there's a character who I want to assign a unique gimmick. He normally has an Attack of 300 and a magic attack of 75. He has decent magical and physical attacks. I want him to have a skill that allows him to switch his attack and magic attack stat in the middle of battle so that he instead has a magic attack stat of 300 and an attack stat of 75. Is there any way to do this?
Any way to swap stat values on the fly?
RPG Maker MV SupportYeah, sure. I don't really understand why you would want to switch them, but I am sure your idea is great. 😛 I can tell you how to do it, though
First you make a skill, the skill that you just described, and you make that skill trigger a common event.
We come back at the common event in a minute, but first lets talk about the skill formula.
To make this skill, we need to use 1 variable in the formula. For this formula I will use variable 1. If you use another variable, simply change the 1 to the id of the variable you use. The formula should be like this:
v[1] = a.atk - a.mat ; 0
This makes that variable 1 is not the difference between ATK and MAT of the spell caster. It is important that you make the skill target anything (friend or foe) and that the type is set to damage. (If you set it to heal, the formula would not set Var 1 if the target is at full health.)
Best to target the caster if the skill does nothing else. But you can also have the skill target an enemy, do damage and then AFTER the damage is done, it will trigger the common event. (In this case replace the 0 in my formula with the actual battle formula)
Now, for the common event. You just need 2 little commands:
Change ATK of actor: - variable 1
Change MAT of actor: + variable 1
That is all you need to do. The same skill will switch the values back if triggered again.
First you make a skill, the skill that you just described, and you make that skill trigger a common event.
We come back at the common event in a minute, but first lets talk about the skill formula.
To make this skill, we need to use 1 variable in the formula. For this formula I will use variable 1. If you use another variable, simply change the 1 to the id of the variable you use. The formula should be like this:
v[1] = a.atk - a.mat ; 0
This makes that variable 1 is not the difference between ATK and MAT of the spell caster. It is important that you make the skill target anything (friend or foe) and that the type is set to damage. (If you set it to heal, the formula would not set Var 1 if the target is at full health.)
Best to target the caster if the skill does nothing else. But you can also have the skill target an enemy, do damage and then AFTER the damage is done, it will trigger the common event. (In this case replace the 0 in my formula with the actual battle formula)
Now, for the common event. You just need 2 little commands:
Change ATK of actor: - variable 1
Change MAT of actor: + variable 1
That is all you need to do. The same skill will switch the values back if triggered again.
create two passive states, one that adds +200 to each stat. Swap them as needed.
What was mentioned above could work but it would be more versatile if you added a variable amount so you could keep track of each stat and apply accordingly.
I tried this, and I believe I followed your instructions correctly, but all that happens is it says that the user took no damage and doesn't swap the stats. I have the target set to user. The attack stat is 2, and mat is 100. The common event looks exactly like the screenshot you sent. I do have the common event trigger in the skill (almost forgot to at first 😛) and the formula is v[1] = a.atk - a.mat ; 0. It's set to HP damage. Is there anything I might be missing?
Did you also target the caster with scope?
The scope can't be "none" or "the user". That will skip the selection part of the skill. And you need to select anything. I don't know why that is, but if you skip, your might still have your variable a 0 when the common event runs. Set the scope to "1 ally" instead.
I hope that works, otherwise I have to think real hard what part I was missing. 😛
The scope can't be "none" or "the user". That will skip the selection part of the skill. And you need to select anything. I don't know why that is, but if you skip, your might still have your variable a 0 when the common event runs. Set the scope to "1 ally" instead.
I hope that works, otherwise I have to think real hard what part I was missing. 😛
It didn't work. Do I need to change the variable somehow? I'm also using Variable 1 like you suggested
Hmmm. Well, can you try maybe putting a text message in the common event that says: "\v[1]"
This way you can see what was stored in the variable, that should be the difference between the 2. If the whole message doesn't show up at all, then your common event is not triggered.
Can I see a screenshot of the common event maybe? (Maybe something went wrong and 2 see more than 1)
This way you can see what was stored in the variable, that should be the difference between the 2. If the whole message doesn't show up at all, then your common event is not triggered.
Can I see a screenshot of the common event maybe? (Maybe something went wrong and 2 see more than 1)
Here you are good sir, I'll do that text message thing while you look at the screenshot
says the difference is -95
Hmmm... I don't immediately see a mistake in your screenshot, and when I try to create the skill myself, it works flawlessly.
Wait... Oh wait... Is it an actor who switches their own stats? Or is it an enemy?
Because until now I thought we were working with actors, until I noticed it was called a sigma slimeset... If this is for enemy stats, then my approach will not work at all.
If it is an enemy changing the players stats, then change the a in the formula into a b.
So then the formula should be v[1] = b.atk - b.mat ; 0 and you also need to make sure it targets the right actor.
Wait... Oh wait... Is it an actor who switches their own stats? Or is it an enemy?
Because until now I thought we were working with actors, until I noticed it was called a sigma slimeset... If this is for enemy stats, then my approach will not work at all.
If it is an enemy changing the players stats, then change the a in the formula into a b.
So then the formula should be v[1] = b.atk - b.mat ; 0 and you also need to make sure it targets the right actor.
Oh god I had it set to the wrong actor the whole time. thank you so much for your help, and sorry for your troubles! After testing again, it definitely worked. by the way, do you know what the 6 pistol salute is?
Whahaha. I had kind of the same thing. Didn't work for me either, cause I accidentally had it set to ATK and DEF. 😛 But after about 5 tries I figured it out. 😛
Glad to read it works now. 🙂 I hope to see the result one day! Good luck!
-
Oh and no idea what the 6 pistol salute is. What is it?
Glad to read it works now. 🙂 I hope to see the result one day! Good luck!
-
Oh and no idea what the 6 pistol salute is. What is it?
Moved to: MV Support
Original thread: https://forums.rpgmakerweb.com/threads/any-way-to-swap-stat-values-on-the-fly.142834/