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,792
Reaction score
8,761
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 Profile Posts

Do you like to practice level design? I do hahahaha! It's not from a specific game, it's just some tests...Fase 1.png
I really need a better indicator of where you can jump up and down though I feel... otherwise I like how this turned out for the first part of the first dungeon of the game.
@Shaz needs to make a website for his plugins. (it can be done easily for free with google sites.) I can't find a database of them anywhere!
Dion2.jpg

testing #2

Forum statistics

Threads
109,128
Messages
1,042,379
Members
141,629
Latest member
YOURBESTFRIIEND
Top