Variable equal to party's total level

Tobiasu

Wizman
Member
Joined
Aug 10, 2014
Messages
13
Reaction score
5
First Language
English
Primarily Uses
hello community!
I'm trying to make Etrian Odyssey remake in VX Ace
but I'm having trouble in Inn event
I want to make the variable equal to party's total level
because the cost of staying at the Inn
on that game is party's total level x 2
(but I think it's the 1st 4 members' total level only)

I know how to make it when party leader's level only
but I don't know what to do when party's total level.

thanks in advance!
 

Faherya

The Knight of the Sad Figure
Veteran
Joined
Jul 25, 2013
Messages
256
Reaction score
585
First Language
Portuguese
Primarily Uses
RMVXA
If your group has fixed members it is easy. I mean, if you know exactly which members will be on the team, just set individual variables with the level of each, then add them up and multiply the result. I had to create something similar to set the average team level. This is what I use to restrict certain areas according to the "strength" of the player. The commands are almost identical. Look:

QVbzvY9.png


Membros na Equipe means the number of team members. Now, if you do not know which characters might be in the group, you'd have to figure it out first. Create another variable to find the ID of the members in a given position. One by one you discover the ID, compare it with your ID in the database - by means of a condition - and set the character's level in the corresponding variables. Here you check the ID of the characters in the group:

l3olxEg.png
 

bgillisp

Global Moderators
Global Mod
Joined
Jul 2, 2014
Messages
13,789
Reaction score
14,589
First Language
English
Primarily Uses
RMVXA
If you don't mind installing Yanfly's Enemy Level script, you can use this code instead:

Control variables: Variable (whatever you want to use);

Script: $game_party.average_level

However, you need Yanfly's Enemy Level Script to use that command, as average_level doesn't exist outside of it. Though, if you just install this code in a script, it will still work:

class Game_Party < Game_Unit
#Average level function is from Yanfly's Enemy Levels script (thanks Yanfly!),
#Pasted here so as to not require the enemy level script for this script to work.
def average_level
lv = 0
for member in all_members; lv += member.level; end
lv /= all_members.size
return lv
end

end #End Game_Party Class

Credit Yanfly as it is their code (as you can see per the comments), I just pulled it out of their enemy level script for you. Yanfly's terms of use are posted here: https://yanflychannel.wordpress.com/terms-of-use/
 

Susan

Veteran
Veteran
Joined
Sep 1, 2014
Messages
2,748
Reaction score
8,346
First Language
No idea...
Primarily Uses
RMMV
Making a few changes from Faherya's example, here's what you can try:
Code:
Control Variables 1 = Party Members //this will the number of current party members
Control Variables 2 == $game_party.members[0].level //this is the leader
Control Variables 2 += $game_party.members[1].level //this is the 1st follower
Control Variables 2 += $game_party.members[2].level //this is the 2nd follower
Control Variables 2 += $game_party.members[3].level //this is the 3rd follower

If Control Variables 1 == 1
   Control Variables 2 == $game_party.members[0].level
end/else
If Control Variables 1 == 2
   Control Variables 2 == $game_party.members[0].level
   Control Variables 2 += $game_party.members[1].level
end/else
If Control Variables 1 == 3
   Control Variables 2 == $game_party.members[0].level
   Control Variables 2 += $game_party.members[1].level
   Control Variables 2 += $game_party.members[2].level
end/else
If Control Variables 1 == 4
   Control Variables 2 == $game_party.members[0].level
   Control Variables 2 += $game_party.members[1].level
   Control Variables 2 += $game_party.members[2].level
   Control Variables 2 += $game_party.members[3].level
end //and so on...

//Variables 1 and the Conditional Branches will not be necessary if you have a fixed amount of party members in your party. The conditional branches are there to prevent the game from throwing an error in case the number of party members are less than the script is trying to call.

From there, you can take Variable 2 and multiply it to get your Inn cost.
The only reason why I had to change Variable 2 multiple times is because the script box in "Control Variables" accepts a limited amount of letters.
 

Tobiasu

Wizman
Member
Joined
Aug 10, 2014
Messages
13
Reaction score
5
First Language
English
Primarily Uses
thanks for the replies
I did susan's method and it worked!
using a conditional branch, if members are 5 or more,
it should be If control variables is 4 or greater.
 

Latest Threads

Latest Posts

Latest Profile Posts

Tired of just doing mobile. Now you can Play the game in ur Browser! https://bigmala-productions.itch.io/rpg-forever
I managed to fix my car at last... :biggrin:

I'm proud of what I have achieved with my project. Don't mind with the Spanish, Ill add more languages.
Im currently looking at the RPG MAKER Steam page, and i found out the Rpg maker mz requires bit 64 pc, i only have bit 32 pc ;-;, i am really using an ancient pc.. XD

Forum statistics

Threads
111,281
Messages
1,059,856
Members
144,583
Latest member
gillfigno
Top