I'm having some kind of trouble accessing the equipment (armor/weapons) of the alive party (battlers) members. how can i do this:
$gameParty.battleMembers().aliveMembers()...can I do this?!
another thing I wanted to ask is how to access the item scope..
there are functions for determine if a give item is for friends only or for enemies only...
something like...
item.isForFriend()
I know the isForFriend() method exists I'm afraid I not using it right --'
thank you
You would not use battleMembers() and aliveMembers() together. If you want the alive battle members and not the alive reserve members, it would be something like this:
$gameParty.battleMembers().filter(function(member) { return member.isAlive() });
That will give you an array of living battle party members, and you can then use that to look at their equipment.
item.isForFriend() will return true if the scope is for an ally (or more allies), and false if it isn't.
All items within $dataItems are just basic javascript objects. They do not have any methods associated with them. You'd need to check $dataItems[1].scope to be within a range of scopes that are for friendly targets.
The isForFriend() function is actually a member of Game_Action, which will check the necessary scopes for you. You'd have to do the following to check if item #1 is for a friend:
var item = new Game_Action(user);item.setItem(1);if(item.isForFriend()) { // do something}Where user must be a Game_Battler object (Game_Actor or Game_Enemy in most cases).
EDIT: Scope clarifications.
$gameParty.battleMembers().filter(function(member) { return member.isAlive() });regarding the original topic... I wanted to access the equips of the alive members...
so I used:
var alive = $gameParty.battleMembers().filter(function(member) { return member.isAlive() });var equipments = alive.map(function(member) {return member.equips() });but I get an array of 4 elements [Actor1, Actor2, Actor3, Actor4]
each one containing 5 elements [Equipment1, Equipment2, Equipment3, ..., Equipment5];
I wanted one array only.. containing every equipment not.. [Equipment1, ..., Equipment20];
how can I do this?! is not a way to use map with the concat function?