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,147
Reaction score
8,936
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

Creating 3D CGs for Cutscenes. :kaosalute:

I keep wanting to post every song I make for the game and have to hold back on that because at this rate, I'll have spoiled all the really good stuff lol..
DerniBorges wrote on TSR's profile.
Is there any way this plugin works with the big character, and the QSprite plugin? Using RTP chars, everything works fine, but the big ones, with QSprite, it's like that in the image, it doesn't reflect right. And there is, in the settings, an option to fix it. Thanks.
bug2.png
Bengawan Solo with fantasy style arrangement. :D
So I just got my computer back (Was posting stuff on my phone) But now my dang monitor's broken! I'll need to get a new one, which means... JOBS! Yaaay... When I get a new monitor, I'll post picture of one of my RPGMMV projects.
Wish me luck... :kaodes:

Forum statistics

Threads
115,898
Messages
1,093,804
Members
151,143
Latest member
CinnaBunYT
Top