Damage enemy group on state leave effect

Beriquer

Warper
Member
Joined
Dec 27, 2016
Messages
4
Reaction score
1
First Language
German
Primarily Uses
Hi, I'm pretty new to javascript and most of the time I'm mix and matching my way through yanflys lunatic mode but now I'm stuck on this one state and I can't get it to work.
I'm trying to recreate the living bomb skill from WoW. Simply a skill that creates a state with a DoT (no problem there). which in return when expiring will damage the whole enemy squad.


I used a mix from yanflys unstable affliction and overheating scripts, but I'm stuck and can't get it to work properly. When the leave effect is triggered, it applies the damage twice plus the normal regeneration effect damage to all enemies.


Maybe someone more profficient could take a look at the code for me.


here's what I'm using:



Spoiler



<Custom Apply Effect>
// Calculate the damage to be dealt by the formula.
target._DoT = Math.ceil(origin.mat * 0.50);
</Custom Apply Effect>


<Custom Leave Effect>
// Calculate the damage to be dealt by the formula.
  var dmg = Math.ceil(origin.mat * 3);
// Get the element ID
  var ElementId = 2;
  // Get all living battle members on the battlefield
  var members = user.friendsUnit().aliveMembers().concat(target.friendsUnit().aliveMembers());
  // Loop through each of the members
  for (var i = 0; i < members.length; ++i) {
    // Get the currently looped member
    var member = members;

    // Check if the member exists


    if (member) {


      // Make the member take damage


      member.gainHp(-1 * dmg * member.elementRate(ElementId));


      // Start the damage popup


      member.startDamagePopup();


      // Check if the member is dead


      if (member.isDead()) {


        // If it is, collapse the member


        member.performCollapse();


      }


      // Clear the results


      member.clearResult();


    }


  }


</Custom Leave Effect>





 





<Custom Regenerate Effect>


// Get the element.


var elementId = 2;


// Default the DoT formula.


target._DoT = target._DoT || Math.ceil(origin.mat * 0.50)*user.elementRate(elementId);


// Play an animation on the target.


target.startAnimation(67);


// Reduce the target's HP


target.gainHp(-target._DoT);


// Start the damage popup.


target.startDamagePopup();


// Check if the target is dead.


if (target.isDead()) {


  // Make the target collapse.


  target.performCollapse();


}


// Clear the target's results.


target.clearResult();


</Custom Regenerate Effect>





 





 











 
 

Latest Threads

Latest Profile Posts

Haven't been working on any of my projects or resources lately as I'll soon be moving to a new apartment. It's been a stressful move but I'm really looking forward to it.
//Sees it's the same price at Best Buy for a new SSD as Amazon
//Sees it's 103F outside and Best Buy is half a hour of driving.
//Orders from Amazon.
I'll wait the 2-3 days. :LZSwink:
Just a little teaser screenshot of Mountain Village...

Screenshot (364).png
Zeno Remake's English Release, & A Text Editor That Lets Us Type Anywhere | RPG Maker News #76

Make a Game in RMMZ Streams are going to remain in hiatus this week. Too much to do! 4 things will be announced on Monday though! Look forward to that.

Forum statistics

Threads
112,372
Messages
1,067,858
Members
146,022
Latest member
Pacuxo
Top