check if party has a certain skill

Discussion in 'RPG Maker MV' started by ReyBen47, Nov 3, 2018.

  1. ReyBen47

    ReyBen47 Villager Member

    Messages:
    10
    Likes Received:
    0
    First Language:
    english
    Primarily Uses:
    RMVXA
    Hello I need help im trying to figure implement a system similar to xenoblade 2's field skill system and i've encountered to problems using the conditional branch system

    1. the checks have to be specific to a character when i want them to be able to be fulfilled by any character

    2. checks are being fulfilled even though the only actor who has it base isn't in the party

    I don't have any experience with java so i don't know if this can be fixed by writing my own script
     
    #1
  2. Shaz

    Shaz Veteran Veteran

    Messages:
    37,358
    Likes Received:
    11,149
    Location:
    Australia
    First Language:
    English
    Primarily Uses:
    RMMV
    $gameParty.battleMembers().some(function(actor) { return actor.hasSkill(x); })

    where x is the id of the skill, with no leading zeros.

    battleMembers() will restrict it to only the first 4
    some() will look at everyone and return true if just one meets the requirements

    If you only want to look at your living battlers, use this instead:
    $gameParty.battleMembers().some(function(actor) { return actor.isAlive() && actor.hasSkill(x); })

    And it's Javascript, not Java. They are two very different languages :)
     
    #2
    ReyBen47 likes this.
  3. ReyBen47

    ReyBen47 Villager Member

    Messages:
    10
    Likes Received:
    0
    First Language:
    english
    Primarily Uses:
    RMVXA
    Thank you for replying so fast! it doesn't appear to be working im not sure i've put it in right

    ◆If:Script:$gameParty.battleMembers().some(function(actor) { actor.hasSkill(65) })
    ◆Play SE:Saint5 (90, 100, 0)
    ◆Text:Conall(0), Window, Bottom
    : :Leave it to me!
    ◆Fadeout Screen
    ◆Play SE:Switch1 (90, 100, 0)
    ◆Wait:60 frames
    ◆Play SE:Switch1 (90, 100, 0)
    ◆Wait:60 frames
    ◆Play SE:Switch2 (90, 100, 0)
    ◆Wait:30 frames
    ◆Play SE:Switch3 (90, 100, 0)
    ◆Play SE:Chest1 (90, 100, 0)
    ◆Control Variables:#0021 Lockpicking times += 1
    ◆Control Self Switch:A = ON
    ◆Fadein Screen

    :Else
    ◆Play SE:Cancel2 (90, 100, 0)
    ◆Text:None, Dim, Bottom
    : :Lockpicking Traverse Skill Lv1 required

    :End
    An actor has the skill so I don't know where to go from here.
    thank you again for your help!
     
    #3
  4. Shaz

    Shaz Veteran Veteran

    Messages:
    37,358
    Likes Received:
    11,149
    Location:
    Australia
    First Language:
    English
    Primarily Uses:
    RMMV
    ah, you got my post before I added a correction (but you quoted the corrected version :D ). Please look at it again and change your condition to what's there now.
     
    #4
    ReyBen47 likes this.
  5. ReyBen47

    ReyBen47 Villager Member

    Messages:
    10
    Likes Received:
    0
    First Language:
    english
    Primarily Uses:
    RMVXA
    It works! thanks a ton!
     
    #5

Share This Page