Hello
Basically as the title said. I have an actor that can have a passive state which I want to grant gold when they receive damage. I'm thinking like gold equal to 40% of damage taken or something, I'd have to test the numbers to see what's right, but anyway. I guess this probably just needs a simple <JS Post-Damage> notetag.
Ideally I would also like it to play an animation on the actor and maybe even give a pop up indicating how much gold was received, but I don't know how doable that is.
I think you would put something like $gameParty.gainGold(0.4*damageVariableHere) in a custom react effect?
Battle scripts aren't my forte but no one else responded
Hmm... I think that's close, or more likely I'm still doing something wrong. I have
<JS Post-Damage As Target>
if ($gameParty.inBattle()) {
if (value > 0)
$gameParty.gainGold(0.4*value)
}
</JS Post-Damage As Target>
It gives WAY more gold than just 0.4. After some testing, it seems to also be affected by enemy gold drops. When I set the enemy's gold drop to 0 to test it maxes out the party gold but I still don't see why it would grant so much gold in the first place...
In another example, the enemy fought drops 13 gold. The actor took 12 damage during battle. 40% of 12 would be about 5. Starting with 0 gold, the party had 162 after the battle.
SO - now how would I remove gold drops from affecting the amount gained, and how to make it accurately grant 40% gold instead of... whatever it's doing?
(Also thank you for responding!)
Have you tried using a static value and seeing what happens? Enemy gold drops shouldn't be a factor in this at all.
My blind guesses are that its either unintentionally being ran multiple times somehow, or its some kind of error that comes from not rounding the value within gainGold
I don't really know what I'm doing, but I changed it to $gameParty.gainGold(2)
This made it so that if the actor takes damage, no matter how many times, the party gains 2 gold. Get hit 1 time, +2 gold, get hit 30 times, still just 2 gold. It also adds 2 to the enemy gold drop.
EDIT: I tried the original JS code from above in a new project and the state works as intended, so I guess that means I have a plugin somewhere messing things up most likely.
EDIT 2: I got it to work! I then ran into the issue of getting gold in decimals, so I added a bit for that. If anyone else is interested here is what I ended up using:
<JS Post-Damage As Target>
if ($gameParty.inBattle()) {
if (value > 0)
$gameParty.gainGold(Math.floor(0.4*value))
}
</JS Post-Damage As Target>
It works but since I'm using VS it has some undesirable effects, mainly that the popup specifies MP damage ( -3 MP, instead of just -3). The color is purple, too. Thanks though!