Hello, everyone! Well, as the title says I want to replace a skill after using it during battle. I know that this can be done easily with common events, but the problem is that the same skill can be used by any party member because of the class change system. So, how can I make the game know that I want to replace the skill of the party member that just casted it?
Use skill and replace it with another one during battle
RPG Maker MV SupportEither make the skill inflict an invisible state onto the user which serves as a detector by the common event using a conditional branch, or make a separate version of the skill for each character that is able to use it.
Do you want it to be a temporary replacement or permanent?
Temporary:
The permanent approach is really easy, you'd just add the following to your skill's action sequence:
The temporary approach (probably what you're after) is a bit more involved and requires Yanfly's Skill Core as well. Basically, you'll want to do this:
Temporary:
- Harold casts Charge-Up
- Next round, Harold can cast Ultima
- After the battle, or after casting Ultima, he has to use Charge-up again
- Harold casts Charge-Up
- Next round, and forever after, Harold can cast Ultima
The permanent approach is really easy, you'd just add the following to your skill's action sequence:
Code:
eval: user.learnSkill(15); // the skill id to be learned
eval: user.forgetSkill(14); // the skill being invoked/removed
The temporary approach (probably what you're after) is a bit more involved and requires Yanfly's Skill Core as well. Basically, you'll want to do this:
- Create a state--can be visible (to alert the player that they have skill #2 ready) or invisible--up to you. Call it whatever you want.
- Give this state your choice of a limited duration, remove on end of combat, etc.
- On the "charge up" skill, have it apply this state to the user
- Give the "charge up" skill a <Custom Show Eval> with the following:
Code:
<Custom Show Eval>
if (!user.hasSkill(15)) user.learnSkill(15); // skill id of skill #2
visible = !user.isStateAffected(55); // state id of your charge-up state
</Custom Show Eval>
- Now, for the second skill (the one to be granted by the first skill) give it a Custom Show Eval as follows:
Code:
<Custom Show Eval>
visible = user.isStateAffected(55); // state id of your charge-up state
</Custom Show Eval>
- Optionally, this skill can remove the charge-up state after this skill is used, so it resets back to skill #1
Original thread: https://forums.rpgmakerweb.com/threads/use-skill-and-replace-it-with-another-one-during-battle.117936/