Tips & Tricks – Spell Shield (Baldur’s Gate 2) – RPG Maker MV

Yanfly Engine Plugins is a plugin library made for RPG Maker MV, a wonderful piece of software to help you make that role playing game of your dreams. You can find out more about RPG Maker MV here.

The Spell Shield from Baldur’s Gate 2 will give a one-time block to the first hit of a spell. No effects will proc and it will act as if it missed. Here’s how we can recreate this effect in RPG Maker MV!

You can grab the copy/paste code here: 

Place this code inside of your “Spell Shield” state’s notebox. Change the values in red to fit your game’s settings.

<Custom Select Effect>
// Check if this action is a skill and targets an opponent.
if (this.item() && DataManager.isSkill(this.item()) && this.isForOpponent()) {
  // Create a pool of blocked Skill TYPES.
  var blockedtypes = [];
  // Add the skill type ID's to that pool.
  blockedtypes.push(7, 8, 9);
  // Create a pool of blocked individual skills.
  var blockedskills = [];
  // Add the individual skill ID's to that pool.
  blockedskills.push(249, 250, 251, 252);
  blockedskills.push(253, 254, 255, 256);
  // Check if the skill type or skill ID matches.
  if (blockedtypes.contains(this.item().stypeId) || blockedskills.contains(this.item().id)) {
    // If it does, then store the skill's original success rate.
    this._formerItemSuccessRate = this.item().successRate;
    // Now drop the skill's success rate to 0.
    this.item().successRate = 0;
    // Start an animation to show the spell shield occurred.
    target.startAnimation(53);
  }
}
</Custom Select Effect>

<Custom Deselect Effect>
// Check if there is a success rate stored.
if (this._formerItemSuccessRate !== undefined) {
  // Restore the skill's success rate.
  this.item().successRate = this._formerItemSuccessRate;
  // Remove this spell shield state.
  target.removeState(stateId);
}
</Custom Deselect Effect>

Happy shielding!

Please wait while you are redirected...or Click Here if you do not want to wait.