[XP] Need help with leveling through events

Started by Lunar_Fennec, February 04, 2012, 08:52:08 am

Previous topic - Next topic

Lunar_Fennec

I have a character that is meant to join the party later in the game, so I had it set to average his level with the rest of the party. The issue I'm having is after his level is changed, he didn't learn any of the skills he should have. How do I fix this?


I'm using a variable set with his level and a conditional branch to learn the skills, but I'd like an easier method if there is one.

ForeverZer0

This will set the level by the average level of the current active party, not including any in "reserve":
lvl = 0
$game_party.actors.each {|a|
lvl += a.level
}
lvl /= $game_party.actors.size
$game_actors[1].level = lvl



This will factor in reserve party members, but be careful that you don't have a bunch sitting at level 1, since it will greatly skew the average:
lvl = count = 0
(1..$data_actors.size).each {|i|
if $game_actors[i] != nil
lvl += $game_actors[i].level
count += 1
end
}
lvl /= count
$game_actors[1].level = lvl


Just put these in a script call.
For both methods, you need to replace the number in the brackets from the 1 to the ID of the actor you want to set the level of.
I am done scripting for RMXP. I will likely not offer support for even my own scripts anymore, but feel free to ask on the forum, there are plenty of other talented scripters that can help you.

Blizzard

F0, I suggest you set the average level using the average EXP. This would be a lot better.
Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

Lunar_Fennec

Thanks for the help and sorry for the late reply, been a little under the weather  :^_^':