YEP Skills Rewards, add a Buff to the enemy not the actor?

Indinera

Indie Dev
Veteran
Joined
Mar 13, 2012
Messages
1,900
Reaction score
796
First Language
French
Using <condition Weakness> it is possible to add a Buff to the actor but would it be possible to add a Debuff to the enemy if (and only if) it is weak to the skill?
 

Icenick

Veteran
Veteran
Joined
Mar 28, 2012
Messages
269
Reaction score
32
First Language
English
Primarily Uses
Just using the Skill Core you can do it like this.

Code:
<Post-Damage Eval>
// Check if the action deals HP damage
if (this.isHpEffect() && value > 0) {
  // Get this action's elements
  var elements = this.getItemElements();
  // Loop through each of the elements
  for (var i = 0; i < elements.length; ++i) {
    // Get the currently looped element
    var elementId = elements[i];
    // Check if the target is weak to the element
    if (target.elementRate(elementId) > 1.00) {
      // Add Buff to user and Debuff to target.
      user.addBuff(1,2);
      target.addDebuff(2,2);
      // Break the loop
      break;
    }
  }
}
</Post-Damage Eval>
 

Indinera

Indie Dev
Veteran
Joined
Mar 13, 2012
Messages
1,900
Reaction score
796
First Language
French
Awesome @Icenick it worked perfectly.

One last question, is it possible to call a common event instead of adding a buff/debuff?
 

Icenick

Veteran
Veteran
Joined
Mar 28, 2012
Messages
269
Reaction score
32
First Language
English
Primarily Uses
Away from computer but you can try this let me know if it works.

Code:
$gameTemp.reserveCommonEvent(X)
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

Every time the official RMWeb account makes a post, I think it's @Eliaquim writing it!

It's driving me crazy, but it's also wonderfully hilarious.
// Looks at Elfkisser, realizes he'd have to either install Windows 10 or compile it for Linux
// Didn't install Elfkisser.
Too much effort for a curiosity. :popcorn:
I was just high-fiving myself for all I've learnt in the engine, and how far I've come, only to forget to remove the Immortal state from a semi-scripted battle. Now the enemy never dies and I feel so smart >.>
Playtest your stuff. Always playtest.
just spent FOREVER troubleshooting an issue with my keyboard... turns out the cord was just loose OTL

Forum statistics

Threads
99,224
Messages
963,226
Members
130,813
Latest member
Gremter
Top