Tips & Tricks – Sacrificial Bolt

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.

From Dragon’s Dogma, the Sacrificial Bolt is a skill that kills off a random pawn to deal damage to a foe. If that were to be remade in RPG Maker MV, the skill effect would be to sacrifice a random ally to deal damage to a foe. The damage dealt and such would be based off of the sacrificed ally’s stats!

You can find the copy and paste version of the code here:

<Custom Requirement>
// Get the group that the user belongs to.
var group = user.friendsUnit();
// Get the alive members of the group.
var allies = group.aliveMembers();
// Check to see if there are more than 1 allied members (user + ally).
value = allies.length > 1;
</Custom Requirement>

<Custom Cost Display>
\i[1]Ally
</Custom Cost Display>

<Custom Execution>
// Get the group that the user belongs to.
var group = user.friendsUnit();
// Get the alive members of the group.
var allies = group.aliveMembers();
// Remove the user from the group.
allies.splice(allies.indexOf(user), 1);
// Pick a random ally.
var ally = allies[Math.floor(Math.random() * allies.length)];
// Store the ally's current HP value with the user.
user._allyHp = ally.hp;
// Store the ally's current MAT value with the user.
user._allyMat = ally.mat;
// Play animation 65 on the ally.
ally.startAnimation(65);
// Time to kill off the ally.
ally.gainHp(-1 * ally.hp);
// Perform the collapse effect on the ally.
ally.performCollapse();
</Custom Execution>

<Damage Formula>
// Damage Formula used for the skill.
value = user._allyHp + user._allyMat * 14;
// Remove stored ally HP value.
user._allyHp = undefined;
// Remove stored ally MAT value.
user._allyMat = undefined;
</Damage Formula>

Enjoy!

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