- Joined
- May 12, 2013
- Messages
- 8
- Reaction score
- 0
- Primarily Uses
Back here again...
Is there a way to determine the weapon type (Axe, Sword, Bow, Staff) that an actor currently has equipped?
Alternatively, I supposed I could just manually loop through and check if each ID is equipped to determine the type, but that sounds like a lot of work I'd like to avoid.
EDIT: $game_actors[X].equips.include?($data_weapons[Y..Z]) - Would this also work in checking a range between Y and Z (assuming they're all the same type)? Or is this sort of thing limited to hashes and not arrays, haha. I guess I may have to do a loop in the end.
Is there a way to determine the weapon type (Axe, Sword, Bow, Staff) that an actor currently has equipped?
I'd assume it's something similar to this, but these just pull the name and ID, not the weapon type itself - and I'm not sure if weapon types are actually bound to the weapon, and not just a string that is checked when the player equips a weapon/armor...[...]
CHECKING AVAILABILITY
$game_actors[X].equips.include?($data_weapons[Y]) - Checks if the actor #X has weapon #Y equipped
[...]
CHECKING FOR NAME/ID OF EQUIPMENT
$game_actors[X].equips[Y].id unless $game_actors[X].equips[Y] == nil - Returns the ID of the equipment on actor #X, equipped in slot #Y
$game_actors[X].equips[Y].name unless $game_actors[X].equips[Y] == nil - Returns the name of the equipment on actor #X equipped in slot #Y
NOTE: If using any scripts that give or take equipment slots, the #Y is the number of the character's slot, not the slot's number in the script. I.E. using Yanfly Equip Menu script - if your character has equipment slots 6,7,8,15,15,32,75 available then $game_actors[1].equips[0].id would return the ID of the item equipped in the slot defined as slot 6 in Yanfly script because it's the 1st equipment slot for the specific character.
[...]
Alternatively, I supposed I could just manually loop through and check if each ID is equipped to determine the type, but that sounds like a lot of work I'd like to avoid.
EDIT: $game_actors[X].equips.include?($data_weapons[Y..Z]) - Would this also work in checking a range between Y and Z (assuming they're all the same type)? Or is this sort of thing limited to hashes and not arrays, haha. I guess I may have to do a loop in the end.
Last edited by a moderator: