Plugins Required: Yanfly's BuffStateCore + Yanfly's Skill Cooldowns + Yanfly AutoPassiveStates
First we are gonna make a Common Event in the Database and call it "Steal Gold"
in that common event we are gonna set a new variable lets call it "Party Gold" equal to Game Data: Gold as show below
Next created a condition branch and have it check to see if Party Gold is greater than 500 (this is the amount of gold to be stolen, change it to whatever you want) and be sure to check the box for "Create Else Branch" as seen below
In the If Party Gold > 500 branch put a text window telling the player that 500 Gold was stolen
then remove 500 gold from the party
Now we are going to set a new variable and call it "Gold Back" and set it equal to 500
now in the Else branch (meaning the party doesn't have 500 gold) we are gonna put a text window telling the player all their gold was stolen "\v[x] Gold Was Stolen" (change x to the variable ID of "Party Gold")
Remove 500 gold from the party (doesn't matter if they don't have 500 gold it just goes to 0)
Now we going to set the variable "Gold Back" equal to the variable "Party Gold" as show below
Ok after your all done your Common event for "Steal Gold" should look like the image below
Ok now make another new Common event and call it "Get Gold Back"
In the event page add a text window saying "Got \v[x] Gold back!" (Change X to the variable ID of "Gold Back" we created earlier)
Then give the party gold equal to variable "Gold Back"
Then set the Variable "Gold Back" to 0
after your all done your Common Event for "Get Gold Back" should look like the image below
Ok now we are gonna make a new State and call it "Thief Died"
don't let it auto remove or have any restrictions what so ever
in the Note Box put:
<Custom Respond Effect>
var life = 0.0;
// Check if the player is in battle, the target is alive, and the HP rate is under the right amount.
if ($gameParty.inBattle() && target.isAlive() && target.hpRate() <= life) {
// Remove immortal
$gameTemp.reserveCommonEvent(x);
target.removeState(248);
}
</Custom Respond Effect>
where it says "$gameTemp.reserveCommonEvent(x);" change X to the common event ID of "Get Gold Back" we made earlier
Now lets create a new Skill and call it "Steal Gold" and have it target 1 Enemy and do no damage.
Double Click the Effects box and go to the last page and have it run a common event and select the common event "Steal Gold" we created earlier
In the note box of this skill put:
<Cooldown: 99> so that it can't be used for 99 turns after it gets used (so never really)
Now Lets Create a New Enemy and call it "Enemy Run Away" and don't worry about giving it skills or stats or anything
Be sure this enemy gives 0 EXP and 0 GOLD and no item drops on defeat
In "Run Away" note box put:
<Passive State: 1>
Create a new skill and call it "Run Away" and have it target the user.
Double click the Effects box and have it Remove State "Thief Died"
have it deal HP damage and in the damage formula box put
"a.transform(x);0"
Change x to the Enemy ID of "Enemy Run Away" we created.
Now Create a new Enemy and call it "Thief"
Give it whatever stats you want (I gave mine High AGI so it acts quickly in turn order)
and give it the Skill "Steal Gold" and with always condition and set to 9 Rating so it uses it first.
Give it the skill "Run Away" with always condition and set it to 1 Rating.
Put the thief in a Troop and create a Troop Event with Turn condition 0 x 0 + X so it goes off at the start of battle
in the event page inflict the Thief with the state "Thief Died" we created earlier