SalicCrane

Villager
Member
Joined
Dec 20, 2014
Messages
6
Reaction score
1
First Language
English
I would like to make an ability that stacks a DoT that is based on a characters level.

I have started with it from Yanfly's Plugins.

The Math.floor section I would like to reference so that stacks go up until 5 at level 10 and then + 1 per 2 levels after that to level 20 then explodes dealing damage to all enemies.

Trying remember my coding from college classes 10 years ago.

This is what I have so far.


<Custom Apply Effect>

// If stack count exists, skip.

if (target._stackingPoison > 0) {

}

else {

// Make sure the stack count exists.

target._stackingPoison = target._stackingPoison || 0;

// Increase the stack count.

target._stackingPoison += 1;

}

</Custom Apply Effect>



<Custom Remove Effect>

// Reset the stack count.

target._stackingPoison = 0;

</Custom Remove Effect>



<Custom Regenerate Effect>

// Make sure the stack count exists.

target._stackingPoison = target._stackingPoison || 1;

// Sets the maximum amount of stacks to 5.

var stacks = Math.min(Math.floor(5+((11-10)/2)), target._stackingPoison);

// The damage formula used per tick.

var damage = stacks * 100;

// Play poison animation on the target.

target.startAnimation(59);

// Target takes HP damage.

target.gainHp(-damage);

// Play the popup.

target.startDamagePopup();

// Clear the results.

target.clearResult();

// Check if the target is dead.

if (target.isDead()) {

// If the target is dead, make it collapse.

target.performCollapse();

}

target._stackingPoison += 1;

</Custom Regenerate Effect>
 

mlogan

Global Moderators
Global Mod
Joined
Mar 18, 2012
Messages
15,781
Reaction score
8,758
First Language
English
Primarily Uses
RMMV

I've moved this thread to Learning Javascript[/]. Please be sure to post your threads in the correct forum next time. Thank you.

 

SalicCrane

Villager
Member
Joined
Dec 20, 2014
Messages
6
Reaction score
1
First Language
English
Thank you I could not figure out where to post this.

But I did manage to figure out my issue with referencing the level.

I added $gameActors.actor(x)._level to my formula to get the result I wanted.

now to figure out how to make it explode after ten stacks.
 

SalicCrane

Villager
Member
Joined
Dec 20, 2014
Messages
6
Reaction score
1
First Language
English
This is what I came up with. I just need to tweak the amount of damage it does to balance but the code seems okay. I used some of Yanfly’s tips and tricks to figure it out, specifically the Death Nova and Stacking DoT.

<Custom Apply Effect>

// If stack count exists, skip.

if (target._stackingPoison > 0) {

}

else {

// If no stacks create one.

target._stackingPoison = target._stackingPoison || 0;

// Increase the stack count.

target._stackingPoison += 1;

}

</Custom Apply Effect>



<Custom Remove Effect>

// Reset the stack count.

target._stackingPoison = 0;

</Custom Remove Effect>



<Custom Regenerate Effect>

// Make sure the stack count exists.

target._stackingPoison = target._stackingPoison || 1;

// Sets the maximum amount of stacks to 5 + 1 per two levels after 10.

var stacks = Math.min(Math.floor(5+(($gameActors.actor(5)._level-10)/2)), target._stackingPoison);

//If stacks equals 10 then explode dealing damage to all enemies.

if (stacks == 10) {

//Sets damage to characters MAT.

var dmg = $gameActors.actor(5).mat;

// Get the dying unit's allies.

var foes = target.friendsUnit().aliveMembers();

// Loop through the foes

for (var i = 0; i < foes.length; ++i) {

// Get the currently looped foe

var foe = foes;

// Check if the foe exists

if (foe) {

// Make the foe take damage.

foe.gainHp(-dmg);

// Show the damage popup.

foe.startDamagePopup();

// Check if the foe is dead

if (foe.isDead()) {

// If it is, collapse the foe

foe.performCollapse();

}

// Clear the foe's results

foe.clearResult();

}
}

target.removeState(4);

} else {

// The damage formula used per tick.

var damage = stacks * $gameActors.actor(5).mat;

// Play poison animation on the target.

target.startAnimation(59);

// Target takes HP damage.

target.gainHp(-damage);

// Play the popup.

target.startDamagePopup();

// Clear the results.

target.clearResult();

// Check if the target is dead.

if (target.isDead()) {

// If the target is dead, make it collapse.

target.performCollapse();

}

target._stackingPoison += 1;

}

</Custom Regenerate Effect>
 

Latest Threads

Latest Posts

Latest Profile Posts

After so many hours of debugging, losing data to crashes, and slight adjustments.
BlackJack now deals cards perfectly! Time to adjust the background and implement the game logic so you can actually play it.BlackJack.png
I once thought about a boss gauntled game. I actually did it.
Stream will be live shortly with some Gex 3! Feel free to drop by!
Snippet from a game I'm working on. Not much happening here. Mostly look at atmosphere. May upload a longer version. Still need to make up some enemy arts.

Forum statistics

Threads
109,059
Messages
1,041,710
Members
141,547
Latest member
massagemundaring
Top