Script help on actors and skills.

Discussion in 'RPG Maker MV' started by Lordkazar, Dec 5, 2015.

  1. Lordkazar

    Lordkazar Villager Member

    Messages:
    24
    Likes Received:
    1
    First Language:
    English
    I could use help on another script if any one has time please.
    I think I'm getting better, but then I run into another one that stumps me.


    If : Script: $gameActors.actor(5).Skill($gameVariables.value(11), true)

    $gameActors.actor(5).Skill($gameVariables.value(11), true)

    So I want it to check if actor #5 has Skill #x where x is Variable#11.



    Thanks
     
    #1
  2. Shaz

    Shaz Veteran Veteran

    Messages:
    37,711
    Likes Received:
    11,419
    Location:
    Australia
    First Language:
    English
    Primarily Uses:
    RMMV
    And what's happening when you try? Are you getting an error message? We need to know what it says.

    $gameActors.actor(5).isLearnedSkill($gameVariables.value(11))returns true if the actor has the skill whose id is in variable 11, and false if they don't.
    You don't need to pass true into it.


    Here's a good way to start learning - if it's something you can do via event command, look at the rpg_objects.js file at the Game_Interpreter class. With your cursor on that line, search for the name that appears on the event command button. In this case, it's in Conditional Branch, so I searched for Conditional Branch. The 'cases' listed in that function all correspond to the different options you can choose for Conditional Branch. Case 4 is Actor, and underneath that you'll find Skill, which returns actor.isLearnedSkill(n)
     
    #2
    Lordkazar likes this.
  3. Lordkazar

    Lordkazar Villager Member

    Messages:
    24
    Likes Received:
    1
    First Language:
    English
    Here is a picture of the way i had it, and the error.

    Thanks for the advice Shaz. I will try actor.isLearnedSkill(n) and look into that file for reference.
    [​IMG]
     
     
    #3
  4. Lordkazar

    Lordkazar Villager Member

    Messages:
    24
    Likes Received:
    1
    First Language:
    English
    the formula sees skills added by level up, but it does not seem to reconize a skill added from an equipped item as a learned skill. is that a bug or is there a differnt way or formula for that?
     

     
    #4
  5. Andar

    Andar Veteran Veteran

    Messages:
    28,420
    Likes Received:
    6,485
    Location:
    Germany
    First Language:
    German
    Primarily Uses:
    RMMV
    That is because skills added by equipping items aren't learned, they vanish as soon as the item is unequipped. It's a different way to store the skills on the actor, and it's intentional as different.
    Can you tell us what you want the code to use for in your game? there are usually several ways to do something with different advantages and disadvantages, but without knowing your intention we can't give better help.
     
    #5
  6. Lordkazar

    Lordkazar Villager Member

    Messages:
    24
    Likes Received:
    1
    First Language:
    English
    I am trying to do a open world game and i want to have objects in the game that can only be removed if the user has a certain skill no matter how they attained that skill, and also have various interactions changed by those skills.
     
    #6
  7. YuuHkiSay

    YuuHkiSay Villager Member

    Messages:
    6
    Likes Received:
    0
    First Language:
    English
    This may be kinda late, but I figured i'd put this in case others saw this.


    You can use the Conditional Branch to check if an Actor has equipped a piece of equipment and add a skill to that actor's learnedSkills list. You just have to make a Common Event with the Trigger set to Parallel and have a Switch set to ON for it to do anything.


    Then in whatever Event you're wanting to check the Actors' learnedSkills, just have a Conditional Branch check if the skill is learned.


    That should get what you're looking for.

    Blah.png
     
    #7

Share This Page