Accessing Actor and Party Stas

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,136
Reaction score
809
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
14,660
Reaction score
8,091
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.

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

Latest Threads

Latest Posts

Latest Profile Posts

I think one of my weirdest realizations is that my speed of game development would probably be about the same if I *didn't* work a full-time manual labor job.
Quick question, what's the best way to capture-er, I mean RECRUIT playtesters? Should I make a project thread and use that?
Node Graph out of Date. Rebuilding...
Does anyone know of any good Discord groups for art or biology discussion, that sort of thing?
Trying to access kissanime, Facing issues, Here are 5 working KissAnime Alternatives.

Forum statistics

Threads
98,054
Messages
948,932
Members
129,332
Latest member
SoulDiamond
Top