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,772
Reaction score
8,755
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

Sigh...I can do everything I need for this game but make actual sprites and tile maps for it. Guess I'll look into hiring someone for that
Goes looking for assets, ends up creating memes. I have priorities?
i'm working on finishing an old game in vx ace (the first game i tried to make in vx ace), and it's making me realize how many things i've come to take for granted in mv (like the additional BCDE tile layer and the plugin manager).
It's ma birfday! Gonna chill and work on my project, editing some icons for my compass rn. Later It's pizza and a movie, maybe Blazing Saddles...
I really hope Google stadia/Amazon luna become successful household "consoles" in the future only because I could see it being 1000x easier to get RPG Maker and other indie games on their platforms & if so I PRAY they have gate keepers to keep half baked indie games out of the mix so they don't end up like steam/itch.io with 1000s of incomplete RM projects that continue to give our community a bad stigma.

Forum statistics

Threads
109,026
Messages
1,041,354
Members
141,498
Latest member
guille1194
Top