Reading levels of the leader/party member

Status
Not open for further replies.

slickdeath97

Veteran
Veteran
Joined
Feb 26, 2019
Messages
353
Reaction score
6
First Language
english
Primarily Uses
RMVXA
Hey guys, could use some help with something. I am trying to make an event that adds a party member, but I want the party member to be set to around the same level as the leader. There are multiple options for the leader, but not all of them would be the same level, so how would I go at making a variable that reads the leaders level? Thanks for any help.
 

Heirukichi

Veteran
Veteran
Joined
Sep 24, 2015
Messages
1,395
Reaction score
586
First Language
Italian
Primarily Uses
RMVXA
You can simply get all the levels you need using Control Variables and then use the one you need. Another option would be that of storing them into an array. However, what do you mean by "leaders"? This information is crucial here.
 

ScorchedGround

Blizzards most disappointed fan
Veteran
Joined
Apr 12, 2020
Messages
100
Reaction score
105
First Language
German
Primarily Uses
RMMV
#1 Make two variables.
Variable 1 is equal to the EXP of the leader
Variable 2 is equal to the EXP of the party member

#2 then you subtract Variable 2 from Variable 1 (Variable 1 - Variable 2)

#3 Then you increase the EXP of the party member by Variable 1.

#4 add the party member to the party.

NOTE: This only works properly if both actors have the same EXP curve.
 
Last edited:

slickdeath97

Veteran
Veteran
Joined
Feb 26, 2019
Messages
353
Reaction score
6
First Language
english
Primarily Uses
RMVXA
You can simply get all the levels you need using Control Variables and then use the one you need. Another option would be that of storing them into an array. However, what do you mean by "leaders"? This information is crucial here.
By leaders I mean the person that is first in the menu. They are known to be the leader of the party. The only problem is that the leader can be switched between other party members that are in the party. So I need to make sure that if the leader is switched to someone else the member that is being added is still around the same level as the rest of the party/party leader.
 

slickdeath97

Veteran
Veteran
Joined
Feb 26, 2019
Messages
353
Reaction score
6
First Language
english
Primarily Uses
RMVXA
#1 Make two variables.
Variable 1 is equal to the EXP of the leader
Variable 2 is equal to the EXP of the party member

#2 then you subtract Variable 2 from Variable 1 (Variable 1 - Variable 2)

#3 Then you increase the EXP of the party member by Variable 1.

#4 add the party member to the party.

NOTE: This only works properly if both actors have the same EXP curve.
The party members are not all going to have the same exp curve so I don't know how well this would work.
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
30,251
Reaction score
7,136
First Language
German
Primarily Uses
RMMV
1) if every added member gets the same level/EXP and (as in a regular game) all party members get the same EXP, then it doesn't matter which existing actor is used to determine the level, because all party members will have the same level anyway.

ONLY if different actors get different numbers of EXP it would matter how many EXP the leader has. And if that is the case, then you have a game mechanic that can be exploited by the player and that will destroy your game balancing for later game stages.

So this is probably a case of you not thinking it through.

2) if you really have a game mechanic that let's you set different levels to different actors, then the solution is a double control variable.
Use the first control variable to get the actor ID of the leader of the party, and then use another control variable to get the EXP from that particular actor
But I strongly advice against that unless you really know what you're doing.
 

slickdeath97

Veteran
Veteran
Joined
Feb 26, 2019
Messages
353
Reaction score
6
First Language
english
Primarily Uses
RMVXA
1) if every added member gets the same level/EXP and (as in a regular game) all party members get the same EXP, then it doesn't matter which existing actor is used to determine the level, because all party members will have the same level anyway.

ONLY if different actors get different numbers of EXP it would matter how many EXP the leader has. And if that is the case, then you have a game mechanic that can be exploited by the player and that will destroy your game balancing for later game stages.

So this is probably a case of you not thinking it through.

2) if you really have a game mechanic that let's you set different levels to different actors, then the solution is a double control variable.
Use the first control variable to get the actor ID of the leader of the party, and then use another control variable to get the EXP from that particular actor
But I strongly advice against that unless you really know what you're doing.
It is true that all the actors get the same exp, but that is different from the classes that are used for them. How would I go at making variables for these scenarios?
 

Kes

Veteran
Veteran
Joined
Aug 3, 2012
Messages
21,979
Reaction score
11,275
First Language
English
Primarily Uses
RMVXA
I would go about this slightly differently.
You have three separate tasks; the first is to identify who is the leader, the second is to determine the level of the leader, the third is to ensure that the new party member is at the level of the leader.

This needs to be done with conditionals, and so is slightly tedious.
Conditional check, using the 'script' option, and this needs to be done for all possible leaders
Code:
$game_party.leader == $game_actors[1]
In the 'else' branch, another conditional, this time for actors[2] and so on for all actors.
Having got the basic structure, you now need to establish the level of the leader, so inside each individual part of the conditional, you need to call up the actor's level with a variable, use that variable to set the new party member's level - and then reduce that by one. Why? Because the new party member will have one level anyway, and if you don't they will come in at a higher level than the hero.

Here is a screen shot of such a check, though only illustrating what you do for actor one. Just repeat those commands for all possible actors.

1590991702906.png
 

slickdeath97

Veteran
Veteran
Joined
Feb 26, 2019
Messages
353
Reaction score
6
First Language
english
Primarily Uses
RMVXA
I would go about this slightly differently.
You have three separate tasks; the first is to identify who is the leader, the second is to determine the level of the leader, the third is to ensure that the new party member is at the level of the leader.

This needs to be done with conditionals, and so is slightly tedious.
Conditional check, using the 'script' option, and this needs to be done for all possible leaders
Code:
$game_party.leader == $game_actors[1]
In the 'else' branch, another conditional, this time for actors[2] and so on for all actors.
Having got the basic structure, you now need to establish the level of the leader, so inside each individual part of the conditional, you need to call up the actor's level with a variable, use that variable to set the new party member's level - and then reduce that by one. Why? Because the new party member will have one level anyway, and if you don't they will come in at a higher level than the hero.

Here is a screen shot of such a check, though only illustrating what you do for actor one. Just repeat those commands for all possible actors.

View attachment 146129
I will try this out. Thanks for the help.
 

Roninator2

Gamer
Veteran
Joined
May 22, 2016
Messages
2,323
Reaction score
482
First Language
English
Primarily Uses
RMVXA
making a variable that reads the leaders level?
Make a variable equal to $game_party.battle_members[0].level
Subtract 1 from variable.
Add member to party
add variable to new members level.
 
  • Like
Reactions: Kes

TheoAllen

Self-proclaimed jack of all trades
Veteran
Joined
Mar 16, 2012
Messages
5,266
Reaction score
6,008
First Language
Indonesian
Primarily Uses
RMVXA
A quick script call. I'm going to assume that the actor id 5 is going to be added.
Add this after adding the actor to the party.
Code:
leader_level = $game_party.leader.level - 1
$game_actors[5].change_level(leader_level, false)
 

Kes

Veteran
Veteran
Joined
Aug 3, 2012
Messages
21,979
Reaction score
11,275
First Language
English
Primarily Uses
RMVXA
@Roninator2 Neat! Much quicker than my method. Think I'm going to pinch that!
 

slickdeath97

Veteran
Veteran
Joined
Feb 26, 2019
Messages
353
Reaction score
6
First Language
english
Primarily Uses
RMVXA
A quick script call. I'm going to assume that the actor id 5 is going to be added.
Add this after adding the actor to the party.
Code:
leader_level = $game_party.leader.level - 1
$game_actors[5].change_level(leader_level, false)
That worked wonders. Thanks for the help all of you.
 

slimmmeiske2

Little Red Riding Hood
Global Mod
Joined
Sep 6, 2012
Messages
6,735
Reaction score
4,573
First Language
Dutch
Primarily Uses
RMXP

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 Profile Posts

Tried mochi for the first time. It's quite nice. Has a pleasant smell and taste, and is nice and chewy.
made a bio for the protag in my project!
Beggar : "I haven't eat for days..."
Kid : "Just do crime! You will get daily necessity for free in prison~"
Stream is a bit late but will be live shortly with some game development! Feel free to drop by!

Forum statistics

Threads
99,158
Messages
962,443
Members
130,725
Latest member
teendinsaikha
Top