So, I want to implement a system like Capture from Octopath, see the video below.
I know the limitation of the engine so I want to make something similar, making the actor only learn the skill, like a blue mage, but I want to limit it to a max of 5 skills learned. If the actor has already learned 5 skills, a screen will appear asking if they want to replace a skill with the one they just learned.
The thing is, I don't know if it would be easier to do this with a common event or with the Skill Core and Action Sequences.
I already thought about what the coding will be, but I really need some help.
The idea is that, beforehand, the learned skills will be stored in 5 different variables and the skill that the enemy teaches as well.
It's a sketch, just to show what I thought might work.
I know the limitation of the engine so I want to make something similar, making the actor only learn the skill, like a blue mage, but I want to limit it to a max of 5 skills learned. If the actor has already learned 5 skills, a screen will appear asking if they want to replace a skill with the one they just learned.
The thing is, I don't know if it would be easier to do this with a common event or with the Skill Core and Action Sequences.
I already thought about what the coding will be, but I really need some help.
The idea is that, beforehand, the learned skills will be stored in 5 different variables and the skill that the enemy teaches as well.
JavaScript:
let skills = [$gameVariables.value(1), ..2, ..3, ..4, ..5];
let canLearn, rng, chance;
skills.forEach((s) => { if(s != 0) { canLearn = true; } else { canLearn = false; } })
rng = Math.floor(Math.random() * 100) + 1;
chance = //make some calculation based on the target current HP
if (rng <= chance) {
if(canLearn) {
$gameActors.actor(6).learnSkill($gameVariables.value(53));
$gameMessage.add('skill learned');
} else {
$gameMessage.add('Select one skill to change');
$gameMessage.setChoices([$gameActors.actor(1).skills()[0].name, ..1, ..2, ..3, ..4, ..5], 1, -2);
$gameMessage.setChoiceCallback(n => {
if(n === 0) {
//forgetSkill w/ ID stored in Learned 1 variable
//learnSkill w/ ID stored in the Teached variable
//Store the current skill ID in Learned 1
} else if (n === 1) {
//repeat for other choices
}
});
}
}
It's a sketch, just to show what I thought might work.