Modifying Experience Gained

Here is what I am trying to achieve with modifying experience:


A = Character Level
B = Enemy Level
C = Enemy Max HP
D = Damage Inflicted


x and y are just variables needed for the final calculation.


x = 2 ^ ((B - A)+3))
y = x * (D/C)
1 <= y <= x <= 48
Experience Earned For Killing Enemy = (x + y) >= 48
Experience Earned For Damaging Enemy = y >= 48
Experience Earned For Multiple Enemies = Sum of each >= 48


So basically 48 is the max experience that can be gained but it is all dependent on player and enemy levels.  Can anyone help with this? 


Edit:


Please note I am using GTBS for my battle system and experience is earned each turn whether you kill the enemy or not.


Gubid's Latest Version of GTBS
Character Levels and MAX HP for players/enemies can be customized with the Yanfly script:https://yanflychannel.wordpress.com/rmvxa/core-scripts/adjust-limits/


There's also a Yanfly script for enemy levels.


And for Damage Inflicted...idk.


Sorry if what I said does not relate at all to the project,I can't tell lol.
Hi Bored Soul thanks for the response.  I won't need to raise levels past current boundaries so the script linked would not be necessary.  I don't need the enemy levels to be adjusting either.  Grinding is allowed in my game but knowing that if you do grind then your experience will decrease to the point it is no longer worth it.  You may get 1 exp point for killing enemies after a while.


I don't think I need outside scripts but rather a way to call this info out from the current game and then apply the equations I listed out.
Exp gain in RPG maker is not done using formulas; it's straight numbers that you specify under each enemy.


You will need scripts in order to create diminishing exp rewards based on formulas.





For example with this script, you can assign an exp formula to enemies, using things such as variables to keep track of how many times an enemy has been killed.


However, note that exp gain is not based on each individual actor; all actors in the party receive the same exp (which may be adjusted individually based on what features they have on them)


So you wouldn't be able to say things like "actor's level vs enemy's level" directly without using another script.
I should clarify I am trying to get this to work with GTBS.  So in this case I am actually looking for formulas that can be used in a TBS system where you don't always kill the enemy.  Hime I like your level difference script but I don't think it would be plug and play with GTBS.  That one would be a start on getting this formula right.
You should probably mention that kinda important factor in the opening post.


And add a link to the scripts you think are important for the feature you ask for.
Sorry I edited my first post but linking the script might prove difficult.  I will have to find where it pulls the EXP in from in his system.


Edit:


 Added link to Gubid's entire system.

Original thread: https://forums.rpgmakerweb.com/threads/modifying-experience-gained.67395/