Partial XP Credit on Run.

I would like a script for RPG Maker VX Ace where if say you encounter a troop of three mobs and you defeat at one of them and then find that you are over your head and you run away, you get partial credit for slaying that one monster.

For example, say you encounter three firebirds, and each firebird gives you 400 XP. You kill one of those firebirds and then run from battle, you are rewarded with 20% of the XP that the Firebird you slayed is worth.

In other words, slaying one firebird and then running from battle will grant you 80 XP. Slaying two out of three will reward you with 160 XP. But winning the battle you get full credit of 1200 XP.

Of course, receiving the credit is dependent on a successful run from battle.

This is similar to how Tecmo Secret of the Stars for Super Nintendo does their partial credit and I would like to see this same mechanic in my games.

Perhaps there could be a section of the script where the user defines the partial credit amount in decimal form (such as 0.2)

Could someone whip up a script like this? I would appreciate it. Thank you very much.

Original thread: https://forums.rpgmakerweb.com/threads/partial-xp-credit-on-run.172620/