Okay. We'll make the book call a common event instead of just adding the skill. That way we can check if the character CAN learn the skill, ensure they don't already KNOW the skill, and if they're unable to learn it for either of those reasons, you still have the book in inventory afterwards.
You need to get the skill type id for Arcane Magic. So check your Terms tab, find Arcane Magic in the list, and note the id next to it. If it begins with 0, leave it out (so 03 will become 3). My example below uses 3. You should replace that with whatever number it is in your database.
Also make a note of the skill id for Burning Touch. Again, leave out any 0 at the front. The one I'm using for testing is 127, so again, replace that with the correct skill id.
So create a common event, and add the following commands to it:
Conditional Branch: Script: $game_party.target_actor.added_skill_types.include?(3) Conditional Branch: Script: $game_party.target_actor.skill_learn?($data_skills[127]) Show Text: This party member already knows this skill. Change Items: [Book of Burning Touch], + 1 Else Script: $game_party.target_actor.learn_skill(127) Show Text: This party member has learned Burning Touch. Branch EndElse Show Text: This party member cannot learn this skill. Change Items: [Book of Burning Touch], + 1Branch EndNow go to your book item and remove the Add Skill feature, and instead add a Common Event feature (under the Other tab). Select your new common event.Should all work now
🙂
If the actor CAN learn the skill but hasn't already, they'll learn it. If they either can't learn it, or they already know it, you'll get a message, and the book, which has already been removed from inventory, will be added back. The player won't know it's been removed and re-added.
Now, if you want to put the person's name in the message boxes, do this instead of just Show Text (I'll use 5 for the variable id, but you just allocate whatever you have available)
Code:
Change Variables: [0005: Number] = Script: $game_party.target_actor.idShow Text: \P[\V[5]] already knows this skill.
The other thing you could do is make the book NOT consumable, and then instead of adding it back when they can't learn the skill, just add in a command to remove it when they DO learn the skill.