Yanfly Buff&StateManager Lunatics/DMG

Hello,


I'm trying to archieve some effects using Yanfly lunatics, but some is really hard to figure out (since I barely understand javascript).


1 - Using Buff&StateManager to create a State called: Mark of the Offering.


Ex: User put a mark in one target. If the target die while under effect of Mark of the Offering user recover all TP. (+100 TP)


(I will use this same logic for other skill with HP and MP too).


2 - The other is a custom damage skill that probaly dont need lunatics, but I'm not sure if can do using only the damage formule: Snake Attack. (provisory name)


Ex: Cause damage to target. If target under effect of status X (Its Bleeding in my game) this skill cause +1 damage for each 10 HP the target is missing. (aka 10%).


I will explain using this logic: ifstatus(x)? damage + 0.1 * (b.maxHP - b.currentHP); else damage


I have others skills that are bugging me, but those are being a pain bc theres no reference in any Trip&Tricks videos from yanfly to use.


Tyvm
For your Mark of the Offering you could use the same method Yanfly used for the Tips & Tricks Phoenix Ring video.


Try this in the notebox of the "Fallen" state and replace "ID" with the ID of your Mark


<Custom Apply Effect>
if (target.isEnemy() && target.isStateAffected(ID)) {
origin.setTp(100);
}
</Custom Apply Effect>


For your "Snake Attack":


It should work inside the damage formula.


b.isStateAffected(ID) ? ([damage formula]) + 0.1 * (b.mhp - b.hp) : [damage formula];


Again replace the ID with the one from your "Bleed State" and the [damage formula] with the formula you want to use for the default dmg.
For your Mark of the Offering you could use the same method Yanfly used for the Tips & Tricks Phoenix Ring video.


Try this in the notebox of the "Fallen" state and replace "ID" with the ID of your Mark



<Custom Apply Effect>
if (target.isEnemy() && target.isStateAffected(ID)) {
origin.setTp(100);
}
</Custom Apply Effect>


For your "Snake Attack":


It should work inside the damage formula.



b.isStateAffected(ID) ? ([damage formula]) + 0.1 * (b.mhp - b.hp) : [damage formula];


Again replace the ID with the one from your "Bleed State" and the [damage formula] with the formula you want to use for the default dmg.



Teste.


1 - No effect at all. Tested using agains enemy and allies and nothing happens.


2 - Somehow this formula returns zero for me all the time (no clue why). I used the logic and changed it to:


x = (b.isStateAffected(103) ? 1000 + (0.1 * (b.mhp - b.hp)) : 100); x




And worked. 😀
Teste.


1 - No effect at all. Tested using agains enemy and allies and nothing happens.


2 - Somehow this formula returns zero for me all the time (no clue why). I used the logic and changed it to:



x = (b.isStateAffected(103) ? 1000 + (0.1 * (b.mhp - b.hp)) : 100); x




And worked. 😀



About 1:


Yeah, that was a miss on my end. I'm currently looking into this.


About 2:


I tested my version with the Sleep state, and it worked as it should


b.isStateAffected(10) ? 100 + 0.1 * (b.mhp - b.hp) : 10


When the enemy lost 42 HP and was put to sleep after that, the skill did 104 dmg.


On an enemy who was awake, it only did 10 dmg.


/EDIT:


Alright, this should work for your "Mark of the Offering"


Copy this in the notebox of that state:


<Custom Response Effect>
if (target.isEnemy() && target.hp === 0) {
origin.setTp(100);
}
</Custom Response Effect>


This runs everytime a target after an attack hit/missed.


If the enemy dies from that attack, the caster of that state gets a full tp bar
About 1:


Yeah, that was a miss on my end. I'm currently looking into this.


About 2:


I tested my version with the Sleep state, and it worked as it should



b.isStateAffected(10) ? 100 + 0.1 * (b.mhp - b.hp) : 10


When the enemy lost 42 HP and was put to sleep after that, the skill did 104 dmg.


On an enemy who was awake, it only did 10 dmg.



Yeah. I now know the problem. You put a ";" in the end so it aways return 0. xD I didnt realise that before. W/O that last symbol works like a charm.
Yeah. I now know the problem. You put a ";" in the end so it aways return 0. xD I didnt realise that before. W/O that last symbol works like a charm.



I tried it too after i saw that ";" and it worked. Weird...


Oh, I edited my answer with a way for your Mark skill.
I tried it too after i saw that ";" and it worked. Weird...


Oh, I edited my answer with a way for your Mark skill.



Thanks. Tested and running good.


Two questions if you dont mind (to improve otheres marks):


1 - Is possible to determine if the one that kill the target is the same that put the status? Right now anyone that kill the enemy give the TP to the user.


2 - Theres a command to add a buff to the target? (I know i can add status, but never see a buff)


Tyvm ^^
Thanks. Tested and running good.


Two questions if you dont mind (to improve otheres marks):


1 - Is possible to determine if the one that kill the target is the same that put the status? Right now anyone that kill the enemy give the TP to the user.


2 - Theres a command to add a buff to the target? (I know i can add status, but never see a buff)


Tyvm ^^



1. It is possible with this code


<Custom Response Effect>
if (target.isEnemy() && target.hp === 0) {
if (attacker.actorId() === origin.actorId()) {
origin.setTp(100);
}
}
</Custom Response Effect>


2. A buff is the same thing as a state.


Here's a Screenshot from an ATK Up Buff I just created:


6c5dc79e9a.png



And the skill for it:


4c35395cce.png
1. It is possible with this code



<Custom Response Effect>
if (target.isEnemy() && target.hp === 0) {
if (attacker.actorId() === origin.actorId()) {
origin.setTp(100);
}
}
</Custom Response Effect>


2. A buff is the same thing as a state.


Here's a Screenshot from an ATK Up Buff I just created:



Thanks. Now my assassin is almost done. 😀

Original thread: https://forums.rpgmakerweb.com/threads/yanfly-buff-statemanager-lunatics-dmg.57100/