Party's Stat check script

Morizel

Veteran
Veteran
Joined
Sep 28, 2018
Messages
96
Reaction score
6
First Language
Russian
Primarily Uses
RMMV
How to check the stats of party members?
I mean, how to check ATK of ANY active party member in conditional branch?
 

MushroomCake28

KAMO Studio
Global Mod
Joined
Nov 18, 2015
Messages
3,729
Reaction score
4,685
First Language
English
Primarily Uses
RMMZ
And what will be the condition? To get the data you want, simply use this code:

Code:
$gameParty.members()[index].atk

// Note that you'll have to replace "index" by the index of the party member you want to access.
 

Morizel

Veteran
Veteran
Joined
Sep 28, 2018
Messages
96
Reaction score
6
First Language
Russian
Primarily Uses
RMMV
And what will be the condition? To get the data you want, simply use this code:

Code:
$gameParty.members()[index].atk

// Note that you'll have to replace "index" by the index of the party member you want to access.
For example, "if at least one of party members has ATK more or equals 60"
 

MushroomCake28

KAMO Studio
Global Mod
Joined
Nov 18, 2015
Messages
3,729
Reaction score
4,685
First Language
English
Primarily Uses
RMMZ
Code:
var check = false;

for (var = i ; i < $gameParty.members().length; i++) {
    var pm = $gameParty.members()[i];
    if (pm.atk >= 60) {
        check = true;
        break;
    }
}

$gameSwitches.setValue(1, check);
This will set the game switch #1 (you can easily change the game switch id by changing the number) to true (ON) if any of the party members has an ATK of over 60. If not, it will set the switch to false (OFF). You can copy/paste the code and insert in a script call in an event.
 

Morizel

Veteran
Veteran
Joined
Sep 28, 2018
Messages
96
Reaction score
6
First Language
Russian
Primarily Uses
RMMV
Code:
var check = false;

for (var = i ; i < $gameParty.members().length; i++) {
    var pm = $gameParty.members()[i];
    if (pm.atk >= 60) {
        check = true;
        break;
    }
}

$gameSwitches.setValue(1, check);
This will set the game switch #1 (you can easily change the game switch id by changing the number) to true (ON) if any of the party members has an ATK of over 60. If not, it will set the switch to false (OFF). You can copy/paste the code and insert in a script call in an event.
Okay.
Then what about simple scripts like this one?
Code:
$gameParty.members().some(function (m) { return m.actor().atk >= 20; })
Because alright, I was used this script. But I doing something wrong, it gives "unexpected token =" error.
And I can set variable for one character's ATK. But what if in game i have at least three characters in party? Or player chooses one from three actors at beginning (like Hexen: Beyond Heretic), which have different stats and indexes?
 
Last edited:

MushroomCake28

KAMO Studio
Global Mod
Joined
Nov 18, 2015
Messages
3,729
Reaction score
4,685
First Language
English
Primarily Uses
RMMZ
EDIT: My mistake, read too fast. Just do m.atk instead of m.actor().atk.
 

Aloe Guvner

Walrus
Veteran
Joined
Sep 28, 2017
Messages
1,628
Reaction score
1,115
First Language
English
Primarily Uses
RMMV
If you want to put it even more concisely:
Code:
$gameParty.members().some(actor => actor.atk >= 20)
With anonymous functions, it's generally better to name the arguments something clear like "actor" rather than "m" for better readability.
 

Morizel

Veteran
Veteran
Joined
Sep 28, 2018
Messages
96
Reaction score
6
First Language
Russian
Primarily Uses
RMMV
If you want to put it even more concisely:
Code:
$gameParty.members().some(actor => actor.atk >= 20)
With anonymous functions, it's generally better to name the arguments something clear like "actor" rather than "m" for better readability.
Thank you.
I'm asking that because i want to make parameter check in game, where player chooses one of three pregenerated characters (like in Diablo or Hexen).
 

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

Latest Threads

Latest Profile Posts

Our latest feature is an interview with... me?!

People4_2 (Capelet off and on) added!

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.

Forum statistics

Threads
106,034
Messages
1,018,446
Members
137,820
Latest member
georg09byron
Top