I don't know what you mean. I think that the code does what you want for the most part: you do go wrong at one point however (two actually, where you do the initial check, eqp_check might as well be =, not |=, but that is not what is causing the error). I will try to explain what is happening with your for loop:
# If weapon proficiency learned
for i in 0...skill_id_array.size
if skill_learn? (skill_id_array[i])
@class_id = class_id_array[i]
eqp_check = mystery_multi_item_sets (item)
@class_id = real_class
end
end
This code is almost entirely correct in that it will do everything you want, but you are not preserving when it returns true. It will always check every skill ID in the array and run the check for all skills that the actor has learned. What is problematic with this code is:
eqp_check = mystery_multi_item_sets (item)
And this is because, let's say your skill array is [12, 13] and your class array is [1, 2]
The actor has both these skills and let's say that the check for class 1 will return true (IE class 1 includes this weapon in its weapon set) while class 2 will return false (the weapon is not in class 2's weapon set).
The code being run is essentially this:
# First run of the loop
if skill_learn? (12) # true
@class_id = 1 # class_id_array[0]
eqp_check = mystery_multi_item_sets (item) # True
@class_id = real_class
end
# second run of the loop
if skill_learn? (13) # true
@class_id = 2 # class_id_array[1]
eqp_check = mystery_multi_item_sets (item) # False
@class_id = real_class
end
Do you see what's happening. eqp_check is overwritten by the second run of the loop. SO, even though the actor has the skill that allows him to use this weapon, he will not be able to because eqp_check is overwritten to false. This is why I suggested using the |= instead of the =, but that actually is not the most efficient way. Either of the two below codes should work.
Option 1
# If weapon proficiency learned
for i in 0...skill_id_array.size
if skill_learn? (skill_id_array[i])
@class_id = class_id_array[i]
eqp_check |= mystery_multi_item_sets (item)
@class_id = real_class
end
end
Option 2
# If weapon proficiency learned
for i in 0...skill_id_array.size
if skill_learn? (skill_id_array[i])
@class_id = class_id_array[i]
eqp_check = mystery_multi_item_sets (item)
@class_id = real_class
return true if eqp_check
end
end
Option 2 is better, because all you need for this script is for the weapon to be in one of the weapon sets. Because of that, once you get it to return true once, that is enough and you can return that the item is equippable. This way, you can avoid running through all the other skills because they are irrelevant. Either ought to work though.
Leave the rest of the method the way it is, but when you initialize eqp_check (before the for loop), you should use =, not |=. I'm sorry if I confused you earlier, but when I talked about | I meant for tackling option 1, not for initializing eqp_check.