Accessing equipement of alive party members!

xDGameStudios

Veteran
Veteran
Joined
Sep 15, 2012
Messages
102
Reaction score
60
First Language
Portuguese
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
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,108
Reaction score
13,713
First Language
English
Primarily Uses
RMMV
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.
 

DarknessFalls

Rpg Maker Jesus - JS Dev.
Veteran
Joined
Jun 7, 2013
Messages
1,393
Reaction score
210
First Language
English
$gameParty.battleMembers().filter(function(member) { return member.isAlive() });
This is the cleanest code I have ever seen  .... *tear
 

xDGameStudios

Veteran
Veteran
Joined
Sep 15, 2012
Messages
102
Reaction score
60
First Language
Portuguese
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.
woow!!

$gameParty.battleMembers().filter(function(member) { return member.isAlive() });this is something!! ;)

the item thing doesn't work though! :/ $dataItem[1].isForFriend(); doesn't work!
 

Sarkilas

Villager
Member
Joined
Jun 8, 2014
Messages
16
Reaction score
7
First Language
Norwegian
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.
 
Last edited by a moderator:

xDGameStudios

Veteran
Veteran
Joined
Sep 15, 2012
Messages
102
Reaction score
60
First Language
Portuguese
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.
ok thanks better create my own check scope settings then...

I'm using it for displaying extra info on an item status window :D
 

xDGameStudios

Veteran
Veteran
Joined
Sep 15, 2012
Messages
102
Reaction score
60
First Language
Portuguese
$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?
 

Sarkilas

Villager
Member
Joined
Jun 8, 2014
Messages
16
Reaction score
7
First Language
Norwegian
The following should do the trick:

Code:
var equipment = [].concat.apply([], alive.map(function(member) { return member.equips() }));
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

Just beat the last of us 2 last night and starting jedi: fallen order right now, both use unreal engine & when I say i knew 80% of jedi's buttons right away because they were the same buttons as TLOU2 its ridiculous, even the same narrow hallway crawl and barely-made-it jump they do. Unreal Engine is just big budget RPG Maker the way they make games nearly identical at its core lol.
Can someone recommend some fun story-heavy RPGs to me? Coming up with good gameplay is a nightmare! I was thinking of making some gameplay platforming-based, but that doesn't work well in RPG form*. I also was thinking of removing battles, but that would be too much like OneShot. I don't even know how to make good puzzles!
one bad plugin combo later and one of my followers is moonwalking off the screen on his own... I didn't even more yet on the new map lol.
time for a new avatar :)

Forum statistics

Threads
106,017
Messages
1,018,356
Members
137,802
Latest member
rencarbali
Top