Floor the EXP of the party to the minimum of the current level?

I am making system where player has option to return to the moment before fatal a boss fight started - but with heavy gold and some exp penalties.

What I need (and can't figure out) is script that floors entire partys EXP to their current level minimum. (So exp penalty but without losing lvl).

For example:

Actor A is LVL 12 (exp level requirement 5000) and has 5500exp.

Actor B is LVL 14 (exp level requirement 7000) and has 7005exp.

After CONTINUE they should have: Actor A: 5000exp and Actor B: 7000exp.

I am using default exp curve (numbers in the example are just pulled from the air).

I am really new to this, but I have tried to google it...

Thanks in the advance.
before the EXP reduction, store the current level into a variable - then after the reduction, check current level and add the difference.


I don't know what happens to any engine messages in that case - you might have to fade out the screen to prevent the player from reading those messages, or modify a script to remove them.
before the EXP reduction, store the current level into a variable - then after the reduction, check current level and add the difference.

I don't know what happens to any engine messages in that case - you might have to fade out the screen to prevent the player from reading those messages, or modify a script to remove them.
Thanks, that is a one way of doing it. Since it all happens in the map, messages are not a problem.

However if somebody has an idea how to do this in script, I would still be interested (as I am trying to learn it - also it would be more flexible).

EDIT:

I think I got it:

$game_party.members.each do |actor|$game_actors[actor.id].change_exp($game_actors[actor.id].current_level_exp,false)endSeems to work OK ?!

Original thread: https://forums.rpgmakerweb.com/threads/floor-the-exp-of-the-party-to-the-minimum-of-the-current-level.28220/