Setting a variable to match a party member's parameter?

Status
Not open for further replies.

shieldings

Veteran
Veteran
Joined
Apr 22, 2016
Messages
33
Reaction score
1
First Language
English
Primarily Uses
Okay, so I'm setting up a little gambling minigame. Basically, it randomizes a variable and, depending on how high that variable is, the player gets prizes of varying values. I want to make it so that after the variable is randomized, the combined luck of all the party members is added in (basically, "lucky people are better at gambling").
How can I access the parameters of party members without specifying actors? I have a set of variables that set to the Actor ID's of the different party members. Is there any way to do this without using conditional branches for every available playable character?
Here's a cap of the event, without the prizes or anything included.
 

Attachments

Rhaeami

The Sleepy-Eyed One
Veteran
Joined
Jun 2, 2014
Messages
250
Reaction score
177
First Language
English
Primarily Uses
RMVXA
Whew, took some experimentation but I finally found it. This is the script call:

$game_party.members[X].luk

Where X is the party position, 0 for leader, 1 for next, etc. You could set or add this to a variable to get the value of X party member's Luck stat. You can set up a loop to run it for each member depending on how many members you have. :kaopride:


Alternatively, you can use this format if you already have the actor IDs:

$game_actors[Y].luk

Where Y is the ID of the actor. If it's in a variable, you can do something like:

$game_actors[$game_variables[Z]].luk

Where Z is the number of the variable it's stored in. :kaohi:
 

shieldings

Veteran
Veteran
Joined
Apr 22, 2016
Messages
33
Reaction score
1
First Language
English
Primarily Uses
Whew, took some experimentation but I finally found it. This is the script call:

$game_party.members[X].luk

Where X is the party position, 0 for leader, 1 for next, etc. You could set or add this to a variable to get the value of X party member's Luck stat. You can set up a loop to run it for each member depending on how many members you have. :kaopride:


Alternatively, you can use this format if you already have the actor IDs:

$game_actors[Y].luk

Where Y is the ID of the actor. If it's in a variable, you can do something like:

$game_actors[$game_variables[Z]].luk

Where Z is the number of the variable it's stored in. :kaohi:
Works like a charm! Thank you so much! :kaoluv:
 

Trihan

Speedy Scripter
Veteran
Joined
Apr 12, 2012
Messages
1,483
Reaction score
986
First Language
English
Primarily Uses
Code:
$game_party.members.inject(0) { |total, member| total + member.luk }
That'll get the combined total luk of all party members without the need for a loop or a game variable.
 
Last edited:

Ayoni

Villager
Member
Joined
Aug 15, 2017
Messages
10
Reaction score
1
First Language
English
Primarily Uses
RMMV
Code:
$game_party.members.inject(0) { |total, member| total + member.luk }
That'll get the combined total luk of all party members without the need for a loop or a game variable.
Thanks, man!

Is it possible to collect only the ".luk" of party members who are alive?
 

Kes

Global Moderators
Global Mod
Joined
Aug 3, 2012
Messages
21,612
Reaction score
10,924
First Language
English
Primarily Uses
RMVXA

Ayoni, please refrain from necro-posting in a thread. Necro-posting is posting in a thread that has not had posting activity in over 30 days. You can review our forum rules here. Thank you.


It is also hijacking a thread by asking a question which is different from that of the OP.

At this point I usually advise people to start their own thread - but you already have a thread on this topic. Please do not multi post your query. One query, one thread.

Closing this

 
Status
Not open for further replies.

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

Latest Threads

Latest Profile Posts

You know, I sometimes ponder if working on the story and details is more necessary than the game itself. Its... technically work, just not direct.

Like for me specifically I never stop evolving the story based on what avenues I can approach in gameplay and then I get anxious thinking "hey good thing I thought about that now instead of later". Repeat ad nauseam.
World Of Final Fantasy Livestream~!
(Ft. Kaliga)
So my office building has 8 individually rented offices in it; 3 of which are social workers and 2 are marriage therapists... Unsurprisingly it always sound very angry out there. Glad I have my own private entrance. :LZSexcite: :thumbsup-right:
I wonder if there's ever been an art challenge that involves drawing faces from the generator.

Forum statistics

Threads
94,375
Messages
920,419
Members
124,145
Latest member
RizkyBiznizz
Top