Hello everyone, I’m trying to create a Skill that applies a buff to the user with a certain chance each time the skill is used, but I’m running into two issues. (I'm using YEP BuffsAndStatsCore).
1)
Everything is working as expected, except for how the buff duration (turn count) is displayed. With the current code, when the monster uses the skill it immediately gains the buff with a duration of 5 turns. However, instead of starting the count at 5, it immediately drops to 4 in the same moment the buff is applied. In other words, the turn in which the buff is applied is already being counted as one of the buff turns, which is not what I want.
I tried modifying the code so that it remains at 5 even after the turn passes, but then the number 6 briefly appears and then drops to 5. This isn’t terrible, but it could confuse the player about the actual duration of the buff.
The strange part is that sometimes it works correctly, with the buff starting at 5 turns as intended.
The Code:
2)
There is a line in the code that allows me to apply buffs to multiple stats, but visually only one stat appears as buffed. I checked the console using F8, and the stats are indeed being buffed in the backend, but not all of then an the visual indicators in the UI do not reflect this.
Is there a way to make these buffs appear separately instead of being grouped together visually and also make all of then being abble to be applied at the same time?
The Skill Settings:
The Console:
In this example I use: applyStackingBuffs([2,3,4,5,6]);
Could anyone help me with this?
1)
Everything is working as expected, except for how the buff duration (turn count) is displayed. With the current code, when the monster uses the skill it immediately gains the buff with a duration of 5 turns. However, instead of starting the count at 5, it immediately drops to 4 in the same moment the buff is applied. In other words, the turn in which the buff is applied is already being counted as one of the buff turns, which is not what I want.
I tried modifying the code so that it remains at 5 even after the turn passes, but then the number 6 briefly appears and then drops to 5. This isn’t terrible, but it could confuse the player about the actual duration of the buff.
The strange part is that sometimes it works correctly, with the buff starting at 5 turns as intended.
The Code:
JavaScript:
<After Eval>
var chance = 0.40; // 40%
function applyStackingBuffs(buffList){
buffList.forEach(function(paramId){
if (Math.random() < chance) { // verifica a chance
if (!user.isBuffAffected(paramId)) {
user.addBuff(paramId, 5);
user._buffTurns[paramId] += 1; // compensa Action End
} else {
if (user._buffs[paramId] < 4) { // limite de stack
user._buffs[paramId]++;
user.refresh();
}
}
}
});
}
applyStackingBuffs([2]);
</After Eval>
2)
There is a line in the code that allows me to apply buffs to multiple stats, but visually only one stat appears as buffed. I checked the console using F8, and the stats are indeed being buffed in the backend, but not all of then an the visual indicators in the UI do not reflect this.
Is there a way to make these buffs appear separately instead of being grouped together visually and also make all of then being abble to be applied at the same time?
The Skill Settings:
The Console:
In this example I use: applyStackingBuffs([2,3,4,5,6]);
Could anyone help me with this?