# v18Obedience Check

This thread pertains to v18 of Pokémon Essentials.

#### ValiantSoul

##### World Traveller
Member
Hey guys,

I was just wondering, is there a way to change the obedience chgeck script from this:
Ruby:
def pbObedienceCheck?(choice)
return true if usingMultiTurnAttack?
return true if choice[0]!=:UseMove
return true if !@battle.internalBattle
return true if !@battle.pbOwnedByPlayer?(@index)
disobedient = false
# Pokémon may be disobedient; calculate if it is
end

Solution
You can replace the following line:
Ruby:
badgeLevel = 10*(@battle.pbPlayer.numbadges+1)
with the following:
Ruby:
badgeLevels = [XX, 20, 25, 35, XX, XX, XX, XX, XX]
badgeLevel = badgeLevels[@battle.pbPlayer.numbadges]
...

#### NettoHikari

##### Trainer
Member
You can replace the following line:
Ruby:
badgeLevel = 10*(@battle.pbPlayer.numbadges+1)
with the following:
Ruby:
badgeLevels = [XX, 20, 25, 35, XX, XX, XX, XX, XX]
badgeLevel = badgeLevels[@battle.pbPlayer.numbadges]
Where you fill in "XX" with your levels (and the 20, 25, 35 are just the examples you provided), and the first XX is for when the player has NO badges. Also keep in mind that this still checks the number of badges, e.g. if the player has Badge 1 and 3, then that is two badges and will correspond to level 25. Is this what you want, or do you want Badge 3 to always map to level 35, even if the player doesn't have Badges 1 and 2? If that's the case, you would need this code instead:
Ruby:
badgeLevels = [XX, 20, 25, 35, XX, XX, XX, XX, XX]
end
badgeLevel = badgeLevels[badgeIndex]
So this code simply checks for the highest badge. Let me know which one you use!

#### ValiantSoul

##### World Traveller
Member
You can replace the following line:
Ruby:
badgeLevel = 10*(@battle.pbPlayer.numbadges+1)
with the following:
Ruby:
badgeLevels = [XX, 20, 25, 35, XX, XX, XX, XX, XX]
badgeLevel = badgeLevels[@battle.pbPlayer.numbadges]
Where you fill in "XX" with your levels (and the 20, 25, 35 are just the examples you provided), and the first XX is for when the player has NO badges. Also keep in mind that this still checks the number of badges, e.g. if the player has Badge 1 and 3, then that is two badges and will correspond to level 25. Is this what you want, or do you want Badge 3 to always map to level 35, even if the player doesn't have Badges 1 and 2? If that's the case, you would need this code instead:
Ruby:
badgeLevels = [XX, 20, 25, 35, XX, XX, XX, XX, XX]
badgeLevel = badgeLevels[badgeIndex]