Is there an array of all the weapon types, and the same for armor types, that already exists in the default code? And then how would you check to see if a certain class allows a type of weapon/armor to be equipped?
Is there an array that holds all the weapon types?
RGSSx Script SupportIn Ace, the weapon and armor types are just numbers. To see if a certain weapon/armor type is allowed by a class (or an actor) you would look at the class (or actor) features list.
Yes I know, but how does one refer to the features list in code? is there a features array, and you would use features.include?
What I would do is look at the Equip window scripts and see what it does to determine if a weapon or armor can be equipped by the current actor. I expect it would be whichever of the several windows is based on Window_ItemBase.
This is found in Game_BattlerBase:
So yeah, you do exactly what you wrote, check if it includes the weapon type ID or not.
Spoiler
def equip_wtype_ok?(wtype_id)
features_set(FEATURE_EQUIP_WTYPE).include?(wtype_id)
end
def equip_atype_ok?(atype_id)
features_set(FEATURE_EQUIP_ATYPE).include?(atype_id)
end
def equip_wtype_ok?(wtype_id)
features_set(FEATURE_EQUIP_WTYPE).include?(wtype_id)
end
def equip_atype_ok?(atype_id)
features_set(FEATURE_EQUIP_ATYPE).include?(atype_id)
end
So yeah, you do exactly what you wrote, check if it includes the weapon type ID or not.
Actually I wouldn't do features.include? at all. The method is already there - just call it and let it do the work.
actor.equip_atype_ok?(atype_id)
replacing actor with your actor object, and atype_id with the armor type id (starts at 0 I think)
actor.equip_atype_ok?(atype_id)
replacing actor with your actor object, and atype_id with the armor type id (starts at 0 I think)
Original thread: https://forums.rpgmakerweb.com/threads/is-there-an-array-that-holds-all-the-weapon-types.56134/