Class ID for Skill Acquisation

Discussion in 'RPG Maker VX Ace' started by NinjaSloth, Nov 14, 2013.

  1. NinjaSloth

    NinjaSloth Villager Member

    Messages:
    5
    Likes Received:
    0
    First Language:
    English
    Hello,

    Basically, I'm having issues trying to setup a system where a party member can learn a skill by buying and using an item that gives them the skill.

    I have most of it worked out however I'm trying to make the skills/items, class specific.

    So, for example: Skill #1 can only be learned by Class #1. Skill #2 can only be learned by Class #2. etc

    However, no matter where I try to look on the forums or try for myself, it doesn't work.

    I have tried to use advice from posts such as these:

    http://forums.rpgmakerweb.com/index.php?/topic/13041-class-id-in-common-events/

    http://forums.rpgmakerweb.com/index.php?/topic/14148-common-events-for-an-item-class-changing/

    http://forums.rpgmakerweb.com/index.php?/topic/19731-creating-an-item-that-will-level-up-the-target-actor-only/

    and this is what I estimate is supposed to work:

    Image1.PNG

    Image2.PNG

    However, whenever I try to test it, I get this error message:

    Image3.PNG

    Could anyone give me some pointers as I'm completely lost at this stage.

    Thank you in advance.
     
    #1
  2. Imemperor

    Imemperor Animaniac Member

    Messages:
    19
    Likes Received:
    7
    Location:
    Earth Cradle
    First Language:
    English
    Last edited by a moderator: Nov 15, 2013
    #2
  3. NinjaSloth

    NinjaSloth Villager Member

    Messages:
    5
    Likes Received:
    0
    First Language:
    English
    Hello,

    I was redirected from my own thread to this one for help. I've tried looking through and experimenting with other posts ideas but nothing I try seems to work.

    Basically, I am trying to create a system where my player can purchase skills from a shop (as an item per skill), however I want the skills to be class-specific.

    To make an example:

    Class 1 is Warrior. Class 2 is Rogue. Class 3 is Mage.

    Skill #1 is called Backstab, and I want it to only be learned by actors that are Rogues. 

    The idea is to give optional skills to the player besides their naturally learned skills.

    The only variant I have is that the main player character can choose their class at the beginning of the game; all the other actors are set in their roles.

    So far I've tried variants like this:

    Image1.PNG

    Image2.PNG

    I also tried using variables and common events to assign the class_id, however this didn't work as the common event didn't prevent the skill from being learned by others.

    I know it's asking a lot without much to go on, but if anyone has answers, I would appreciate it.

    Thank you.
     
    #3
  4. Eliwan

    Eliwan Villager Member

    Messages:
    29
    Likes Received:
    5
    First Language:
    English
    I hope you meant this as 'example skill #1'; I've heard of glitches when changing Skill 1.

    So what I would do would be:

    Setting consume to 'no'. If you want the item to be consumed on successful usage, add '$game_party.lose_item(($data_items[item_id]),1)' for the successful usage

    In the formula box;

    if (b.class==1 or b.class==3 or b.class==4); {{I don't know}} ;0;else;0I know that there's some way, I just can't find it.
    So after doing that, I want to say that it's

    Code:
    if (b.class==1 or b.class==3 or b.class==4);b.learn_skill(skill_id);0;else;0
     
    #4
  5. Shaz

    Shaz Veteran Veteran

    Messages:
    37,969
    Likes Received:
    11,625
    Location:
    Australia
    First Language:
    English
    Primarily Uses:
    RMMV
    I've merged this back into your original thread, as the information you've got there is more useful than what you posted in the custom damage formula thread.


    Try this damage formula on your item:

    b.class_id == 2 ? b.learn_skill(skill_id) : $game_party.gain_item($data_items[24]); 0When you show database items, include the WHOLE database tab - I can't see what skill id you want them to learn, so you'll have to insert the proper id in b.learn_skill(skill_id).
    What the above does is says if the actor's class is 2 (== is comparison; = is assignment), then learn the skill. Otherwise give the item back to the party (since it's consumable, you don't want it removed if the person you used it on can't learn the skill).
     
    Last edited by a moderator: Nov 16, 2013
    #5
  6. NinjaSloth

    NinjaSloth Villager Member

    Messages:
    5
    Likes Received:
    0
    First Language:
    English
    Hello,

    Firstly thank you for the responses, however after testing both of your codes/formulas, I have found that something is quite working correctly.

    Essentially, when using the item with either formula, the game just gives back the failed sound effect when I try to use the Item on any character, regardless of class.

    As previously asked, here is as many screenshots of my database as I figured would be necessary.

    Image1.PNG

    Image2.PNG

    Image3.PNG

    Image4.PNG

    Image5.PNG

    I know the first image, you cant see the whole formula but it is all there as posted above.

    I would also like to point out for example, i tried writing single digits (2), whole digits (002) and the name of the skill (Rally) in the formula on both and each time had the same effect.

    I suspect that this might be confusing, but I do appreciate any help.

    Thank you.
     
    #6
  7. Andar

    Andar Veteran Veteran

    Messages:
    28,717
    Likes Received:
    6,601
    Location:
    Germany
    First Language:
    German
    Primarily Uses:
    RMMV
    The failed sound effect might simply happen because there is no damage done, have you checked if the skills are learned correctly?

    As far as the ID goes, you need the number without leading zeros, for example (82) - name will not work at all, and leading zeroes can cause problems in some cases.

    If you have problems with the damage formula way, you might go back to your original idea of using a common event. the problem you had in your first screenshots was that you placed the learn skill effect into the skill - it needs to go into the event if the check from the event for the class should determine wether the skill is learned or not. 

    However, in that case you need to have a way to identify the user, as the regular common event doesn't get that info automatically - which is the reason why it's often easier to use the damage formula box...
     
    #7
  8. NinjaSloth

    NinjaSloth Villager Member

    Messages:
    5
    Likes Received:
    0
    First Language:
    English
    Hello again,

    I have checked my game again and confirmed that the skill is not being learned after the sound effect. I also changed and checked the correct id format, which still did not work.

    As for common events, it could be something I could do, however in the current state, and what I had tested previously, it seems I'd need a common event for each skill or a very complex set of conditionals etc.

    I was hoping to find a more straight forward, easier to digest method. So for now, I will continue to hope for the users of this forum.

    Thank you.
     
    #8
  9. Tsukihime

    Tsukihime Veteran Veteran

    Messages:
    8,230
    Likes Received:
    3,071
    Location:
    Toronto
    First Language:
    English
    Use Common Event Variables

    http://himeworks.wordpress.com/2013/04/25/common-event-variables/

    When an item is used, the target is stored in a game variable (default 11) which can be used in common events.

    You can use this to get the actor, and then get the actor's class ID using a script call.

    Your event would look something like this using formulas for your conditional branches and regular eventing for the rest

    Code:
    if $game_actors[$game_variables[11]].class_id == 1  # do something  exit event processingendif $game_actors[$game_variables[11]].class_id == 2  # do something else  exit event processingendShow Text("Nothing happened")
     
    #9
  10. NinjaSloth

    NinjaSloth Villager Member

    Messages:
    5
    Likes Received:
    0
    First Language:
    English
    Hello,

    Sorry it's taken a while, I've tried using the script and tried to utilise the code that you showed.

    However, it doesn't seem to work. Here are the screen-prints of the error and my attempts at the common events. Is there something I'm doing wrong?

    Image1.PNG

    Image2.PNG

    Image6.PNG

    Thank you for any future advice.
     
    #10
  11. Andar

    Andar Veteran Veteran

    Messages:
    28,717
    Likes Received:
    6,601
    Location:
    Germany
    First Language:
    German
    Primarily Uses:
    RMMV
    two things:

    1) you have mistaken [ and ] (array indicators) with ( and ) (Function parameter indicators).

    With game actors, it's [] like in Tsukihime's demo above, not the regular ()

    2) A conditional branch already is a if-then-sequence, you don't place an additional if in that line.

    remove the if's from the first screenshot (it's correct in the second) and in all places, change the wrong

    $game_actors($game_variables[11]).class_id == 1

    to the correct

    $game_actors[$game_variables[11]].class_id == 1
     
    #11
  12. CelticSoul

    CelticSoul Warper Member

    Messages:
    1
    Likes Received:
    0
    First Language:
    German
    Hey there,

    I have another question concerning items. I want to establish a crafting system which works with variables -

    there shall e.g. be a cooking skill which can be level 0-3, and I want this skill to increase by reading (consuming) certain books, and my cooking skill shall be saved as a variable, NOT as a combat skill or something.

    So my question is: Is there a way to create an Item that has no other effect than affecting a variable when consumed?

    Thx in Advance!
     
    #12
  13. Andar

    Andar Veteran Veteran

    Messages:
    28,717
    Likes Received:
    6,601
    Location:
    Germany
    First Language:
    German
    Primarily Uses:
    RMMV
    yes, any item can have a single feature calling a common event (if you add more than one common event feature, only one will be executed).


    And in that common event you can do whatever you want.


    If the skills are actor specific, you'll need to use some tricks to identify which actor has used the item as the common event doesn't get that info by default.
     
    #13
    CelticSoul likes this.

Share This Page