Any and Include Problem

I wanted to compare an armor id to an array. As part of what I have asked quite some time ago, I tried what Theo told me to do using the any method. However I came across a line where it seems not to be working if I am going to give a value out of it. First is, I tried to do an armor check into a character:

class Game_Actor def a_equip?(armor_id) return armors.any? {|armor| armor.id == armor_id} end endnow, I created an array called green_armor.

Green_Armor = [1, 2, 3, 4, 5]So, what I wanted to do is to make a check:

if $game_party.members.a_equip?(Green_Armor.any?)it doesn't seem to give me anything. The a_equip? was merely to check the armor id and returns the armor id of my part members. I was meaning to check if any of them has the Green Armors. Am I missing something? 

I tried .include? but somehow it only works with a specific number, not an array.
There're two ways how to check two different arrays

----------------------------------------------------------------------------------------------------------------

First way, it is not normally used. Try to make a binary operand.

For example, you have these arrays

array_1 = [1,2,3,4,5]array_2 = [3,4,5,6,7]array_3 = [6,7,8,9,10]To check whether two arrays has a same component is

array_1 & array_2 # This will return [3,4,5]array_1 & array_3 # This will return []using empty? method, you will know if a new array will be empty or not

(array_1 & array_2).empty? # This will return false(array_1 & array_3).empty? # This will return true----------------------------------------------------------------------------------------------------------------

Second way it to implement any? method. It's easier and understandable

Insert your method parameter as an array.

def a_armor?(*args)armors.any? { |armor_id| args.include?(armor_id) }endNow, you can call you method like this

Code:
a_armor?(1,2,3,4,5,6,7) # Or as many as you like
Wow thanks it works, Theo! There's one more thing, since I used

a_armor?(1,2,3,4,5,6,7)this. Is there a way to simplify the numbers like all values of an array?

Perhaps something like:

armors = [1,2,3,4,5,6,7]so I could put everything in the a_armor? function?
call it as

Code:
a_armor?(*armors)
I used this:

def a_armor?(*args) armors.any? { |armor_id| args.include?(armor_id) }endon Game_Actors. What I did was:

$game_actors[1].a_armor?(1)but somehow it returns me false 🙁
Oh wait, I forgot if armors will return array containing an RPG::Armor instances

Try this one then

def a_armor?(*args) args.any? { |armor_id| armors.include?($data_armors[armor_id]) }endIt should works now ._.
That's just awesome! Finally, it worked! Thank you very much for your help!

*Mods can close this now*

Original thread: https://forums.rpgmakerweb.com/threads/any-and-include-problem.24309/