Reading a Tome gives the reader a skill

I'm setting up a system where you can read a Spell Tome and learn a spell.
This is easy to set up except for one detail;
I want the reader/user to learn the spell... not a specified actor.

How would I go about setting that part up?
I am assuming in the 'Change Skill' part use a Variable to check the user of the tome. But how do I specify that the variable selects the one reading the tome?
It sounds like you want the item's Scope to be User here.

If the item teaches a specific skill, you can simply use the Learn Skill effect.

Otherwise you could use a Common Event effect:
  • Get target actor ID: Control Variables -> Game Data -> Last: Target Actor ID.
  • Teach them a skill: Change Skill -> Actor -> Variable.
Here is how I would do it for my game. My game revolves around Tomes and Grimoires so I do similar eventing ideas.

Step 1: Create an item: First, create the Spell Tome as an item in your database. Make sure to set its item type as "Regular Item" and its scope as "The User". This ensures that the item can be used on the character who is reading the tome.

Step 2: Create a common event: Next, create a common event that will be called when the Spell Tome is used. This common event will handle the process of teaching the spell to the character.

Step 3: Use a variable: In the common event, use the "Control Variables" command to set a variable (let's call it "Spell Reader") to the value of "Game Data > Last Used Item's User's ID". This will store the ID of the character who used the Spell Tome in the variable.

Lastly: Change skill: Finally, use the "Change Skills" command to add the spell to the character. Instead of selecting a specific actor, choose "Variable" and select the "Spell Reader" variable. This will teach the spell to the character whose ID is stored in the variable.
Ah, that does work. Thank you!
Then, I have a secondary problem. What if they already know that skill?
Does it not do anything, or will it give them a copy of the skill.
Say.. they now have 'Fire I' two times in their ability bar?

I don't see an option in the Conditional Branch of "if [variable of the Last Actor ID] knows skill"
I only see the basic "If [Specified Actor] knows skill"
Then, I have a secondary problem. What if they already know that skill?
Does it not do anything, or will it give them a copy of the skill.
It will have no effect.

Also, the Learn Skill effect is considered invalid if the target already knows the skill. If the item has no damage formula, and no valid effects for the target, then by default it will not be usable from the menu (for technical details see Game_Action#testApply in rmmz_objects.js).


If you do need to check, you could use something like this in Conditional Branch -> Script:
JavaScript:
$gameActors.actor($gameVariables.value(12)).isLearnedSkill(3)
I.e.
  • Actor ID is stored in variable ID 12.
  • Condition reads: "has that actor learned skill ID 3?"
Change the numbers as appropriate~
It sounds like you want the item's Scope to be User here.

If the item teaches a specific skill, you can simply use the Learn Skill effect.

Otherwise you could use a Common Event effect:
  • Get target actor ID: Control Variables -> Game Data -> Last: Target Actor ID.
  • Teach them a skill: Change Skill -> Actor -> Variable.
The only issue there is that by default, the item scene considers the user to be the non-restricted party member with the highest Pharmacology.
The only issue there is that by default, the item scene considers the user to be the non-restricted party member with the highest Pharmacology.
I think that's OK though?
  • We're looking at the target (effect recipient, Last Target Actor); and
  • Scope: User still provides a target selection phase to determine the target.
Isn't that scope user stuff made for battles? In the menu you just select the target even if the scope is user and then there's user user with highest pha and user target the target.
Isn't that scope user stuff made for battles? In the menu you just select the target even if the scope is user and then there's user user with highest pha and user target the target.
thats true, but its inconsequential since self scope items still bring up a target selection window. the important part is that skill effects validate use by checking if the target knows the skill
Here is how I would do it for my game. My game revolves around Tomes and Grimoires so I do similar eventing ideas.

Step 1: Create an item: First, create the Spell Tome as an item in your database. Make sure to set its item type as "Regular Item" and its scope as "The User". This ensures that the item can be used on the character who is reading the tome.

Step 2: Create a common event: Next, create a common event that will be called when the Spell Tome is used. This common event will handle the process of teaching the spell to the character.

Step 3: Use a variable: In the common event, use the "Control Variables" command to set a variable (let's call it "Spell Reader") to the value of "Game Data > Last Used Item's User's ID". This will store the ID of the character who used the Spell Tome in the variable.

Lastly: Change skill: Finally, use the "Change Skills" command to add the spell to the character. Instead of selecting a specific actor, choose "Variable" and select the "Spell Reader" variable. This will teach the spell to the character whose ID is stored in the variable.

You'll need to check to see if the learning succeeded, or otherwise if they already know the skill. If the target actually learns the skill, you'll need to delete the item.

Honestly, I don't see any reason not to use the default item system as caethyril suggested.

If I were going to use a Common Event, I wouldn't bother with targeting variables. I would just call up an input choice and ask who is learning the skill. I assume this isn't going to be used in combat.

Original thread: https://forums.rpgmakerweb.com/threads/reading-a-tome-gives-the-reader-a-skill.179770/