Indie Dev

Hello Guest!. Register a free account today to become a member! Once signed in, you'll be able to participate on this site by adding your own topics and posts, sell your games, upload content, as well as connect with other members through your own private inbox!

How to store attack damage?

zimzim

Villager
Xy$
0.00
Hello. I'm trying to make a skill that gives the user a good status effect (let's call it State 30). This State 30 will let the user to gain MP whenever the user is attacked normally, where the amount of MP received is either 10% of damage received from the normal attack or just 15 MP, whichever is lower.

I am still a newbie in the programming area, but this is what I did:

1) I installed Yanfly Skill Core Plugin
2) I added a skill in which the scope is The User and its effect is it adds State 30.
3) I added State 30 in states without any traits.
4) In skills, utilising the notetags in Yanfly Skill Core plugin, I wrote a notetag script for skill 0001 Attack, which is:

<After Eval>

// State 30 Effect
if(target.isStateAffected(30)) { //Event only happens when target has State 30
target.clearResult() ; //So that HP damage popup won't appear twice
target.gainMp(Math.min(0.1*value,15)) ; //Target gains either 15 MP or 10% of damage, whichever is lower
target.startDamagePopup() ; //HP and MP damage popup
target.clearResult() ; //Clear popups
}

</After Eval>

This is so close ...so I'd appreciate if anyone can tell me the variable that stores the last damage received (here is represented by value). Thanks. (smile)
 
Top