Getting Magic Books (and items in general) to work properly

● ARCHIVED · READ-ONLY
Started by Manofdusk 18 posts View original ↗
  1.  I have magic books that allow a player to learn magic spells (books are the only way to learn them) but not all characters can cast spells (and some characters can only learn magic after a class change)... so I'd like to figure out how to make it so that only characters of certain classes can use the Magic Books (if they can't, you get the message: "This character cannot learn magic.")

     Another issue I'm having is that I cannot select a character in use item mode. To get a character to use an item, you have to exit the item command completely, select the skill command, and then go back to the item command (the arrow buttons don't seem to be working)
  2. I've moved this thread to VX Ace Support. Please be sure to post your threads in the correct forum next time. Thank you.


    How you do determine who is reading the magic book? Is it the leader? Do you have the book set to choose a target and that is the person who is reading?


    You should be able to select a character in Use Item mode, if you set the item to target one ally. I don't understand why selecting a skill would have anything to do with anything - the target of a skill and the target of an item are two completely different things, and one does not detect the other.


    Are you using scripts?


    Show us your event page(s) - the whole page, including all the tabs and the conditions and stuff on the left; also show us a screenshot of the item in the database so we can see how it's set up.
  3.  I figured out how to fix the book not being able to choose who uses it. I had the item set to Scope: The User and Occasion: Only from the menu.

     Unfortunately, the book will still teach the skill to the character that it is used on (even though the character in question can't use the skill).

     The item itself isn't using scripts or events. It's just a book that lets characters that use it learn a spell (adding the skill to the player's skills).
  4. Do you select the book and then select a target character?
  5. yeah. I can now select any target character after selecting my book.... even if that character can't use the skill.

     Right now I have 2 characters: Severius and Esiel. Severius has the Arcane Magic skill but Esiel does not. Despite this, Esiel can still use the book (thus wasting it)
  6. Can you provide a screenshot of the item now, and also show how you have it set up to teach the skill? I'd also like a screenshot of the skill itself, and one of one of the characters (or their classes) who will learn it - wherever you have the feature set to allow them to use that skill type.
  7.  The Skill Type is Arcane Magic. The book of burning touch is meant to teach the Arcane Magic skill Burning Touch to any character with the Arcane Magic skill (there are a few) but not to anyone who doesn't.

    Book.png

    Character.png
  8. 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.
  9. I've never used this script so I don't know if it applies in menu, but here it is:

    Nicke's Class Items

    It restricts the use of items to classes specified in the items notetag.

    Take a look and see if it will work for you.

    ~ Dinhbat
  10. or, if you have problems with scripts and conditional events, you can simply ignore the effect when learning the skill.


    To use a skill, an actor has to have both the skill AND the skill type. An actor who doesn't have the feature for skill type "arcane magic" would never be able to use it even after he has learned it. - it doesn't even get displayed unless you modified the default screens, because all default skill and battle screens only list the skills sorted by available skill types.


    So if you do nothing, the only drawback would be in the case of consumable books that the purchased book would vanish after the learning, even if the actor hasn't gained the skill. And that depends on your game - if you balance the learning book without being consumable, that problem won't arise.
  11. I advise against adding other scripts.

    Scripts are wonderful things (my game is full of them ... sort of), but adding them when not needed is just asking for problems down the road when two different scripts start touching the same things and suddenly everybody isn't playing nice in the pool any more.

    The common event solution is crisp, clean, and elegant. K*I*S*S.
  12. Well if your happy with it exiting the main menu when you could have multiple magic books then sure that's cool.

    The scene interpreter ensures the messages like player can't learn will appear in the item menu scene instead of exiting the menu to display a text box.

    But yeah common event items unless it's some one time usage never appearing ever in game type item should scene call the item menu.
  13. When I was testing the above, it DID annoy me that it closed the menu out every time. I could have just added a quick script call at the end to open the menu back up again.
  14.  well, I tried that Command but it caused an error:

    Script 'Game_Interpreter' line 450: NoMethodError occurred.

    undefined method 'skill_learned' for #<Game_Actor:0x8af9968>

     it works when I try to use it on Esiel now... but when I try to use it on Severius is when I get the crash. I checked it and it looks identical to yours.

     Also, how would I add a script at the end to open the menu back up to the items tab?
  15. Typo. It should be skill_learn? not skill_learned


    Sorry.


    To open the item menu again, place a Script call at the end, with this:

    Code:
    SceneManager.call(Scene_Item)
  16. cool, that got it to working :p thanks
  17. This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.