Status
Not open for further replies.

charlesthehurst

Veteran
Veteran
Joined
Jun 21, 2013
Messages
34
Reaction score
14
First Language
English
Primarily Uses
Hello fine folks, I'm in need of help.


Basically, I would like to be able to use script calls to access stat information for specific actors as well as the party as a whole.


Actor stats:  I am aware I can already pull actor stats using variables without a script.  What I need is to be able to pull the stat of an actor into a variable based on their position in the party.


For instance, let's say I have an event that check's for the Party Leader's (1st slot) ATK stat. I want to be able to use a script call to determine the 1st slot's ATK stat regardless of what actor is in that position.


Party Stat: For this I need to be able to take every actor in the party and add their stats together into one variable.  For instance, let's say I have an event that checks for the party's combined MAG stat.  If I have 3 party members with 20 MAG each, I want to store the cumulative value of 60 to a variable.


I have already looked around and found some scripts that do similar things but not exactly what I am looking for, particularly the Party Stat idea.


Any help would be appreciated.
 

Sixth

Veteran
Veteran
Joined
Jul 4, 2014
Messages
2,201
Reaction score
853
First Language
Hungarian
Primarily Uses
RMVXA
To check for a party member's stat:


$game_party.members[index].param(param_id)


Replace the index with the member's position in the party. The party leader's index is 0, the second party member's index is 1, and so on.


Replace the param_id with the ID of the parameter. 0 = MHP, 1 = MMP, 2 = ATK, 3 = DEF, 4 = MAT, 5 = MDF, 6 = AGI, 7 = LUK.


To get the sum of the specified parameter based on your party members, you can use this:


$game_party.members.inject(0) {|r,mem| r += mem.param(param_id)}


Again, just replace the param_id with the ID of the parameter you want to calculate.


The above code won't fit into that tiny little script box of the "Control Variables" event command, so you will have to do it this way:


$game_variables[id] = $game_party.members.inject(0) {|r,mem| r += mem.param(param_id)}


Replace the id with the ID of the variable you want to store this data in.


Use this in a regular "Script Call" event command.


Note that $game_party.members will check for all of your party members if you are outside of battle, regardless if they are in the active battle party or not.


If you only want to check for active battle members, you can use $game_party.battle_members instead.
 

mlogan

Global Moderators
Global Mod
Joined
Mar 18, 2012
Messages
16,123
Reaction score
8,932
First Language
English
Primarily Uses
RMMV
This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.
 
Status
Not open for further replies.

Latest Threads

Latest Profile Posts

Day 2 of my redesign journey, as a follow up from the previous post :kaothx:
pXiRJSm.jpg

This is Cedric's son, Apollo!
New pet peeve: Telling tech support personnel what something is doing, only for them to tell me (in excessively condescending tones) what it should be doing. Yes, I know what it should be doing, and if it was doing that, I wouldn’t be talking to you and your attitude problem about it right now, would I? >.<
uglywolf wrote on Khulse's profile.
Hello.
The rules I makes pun about on your last thread is about "Verify Files" before anything else, if the stuff comes from STEAM. Which means, if it could be fixed with just that, there is no need to redownload the whole stuff.
But glad the reinstall worked, hope you enjoy it and your days too.
uh oh, I just tapped into a fresh, deep vein of nightmare fuel right here guys:

Forum statistics

Threads
115,430
Messages
1,089,794
Members
150,185
Latest member
DarkPurplePrince
Top