Categories

Does anyone know how to make a HP, MP or TP Bank, which an enemy or actor can sacrifice some HP, MP or TP, and be able to take it back later, or have an ally take it back?

You are here:
< Back

Credit: santadonut

<Custom Requirement>
// Defaults user's combo stacks to 0.
user._comboStacks = user._comboStacks  0;
// Set condition to whether or not the combo stacks are above 2.
value = user._comboStacks >= 2;
</Custom Requirement>

<Custom Execution>
// Defaults user's combo stacks to 0.
user._comboStacks = user._comboStacks  0;
// Get user's combo stacks.
var stacks = user._comboStacks;
// Reduce user's combo stacks.
stacks -= 2;
// Set stack count min to 0, max to 10.
stacks = stacks.clamp(0, 10);
// Get Combo Attack state ID.
var comboStateId = 136;
// Set the combo counter for the state.
user.setStateCounter(comboStateId, 'x' + stacks);
// Apply stack counter to user's combo count.
user._comboStacks = stacks;
</Custom Execution>

<Custom Requirement>
// Defaults user's HP Bank stacks to 0.
user._hpBank = user._hpBank  0;
// Set condition to whether or not the HP Bank stacks are above 0.
value = user._hpBank > 0;
</Custom Requirement>

<Custom Execution>
// Defaults user's HP Bank stacks to 0.
user._hpBank = user._hpBank  0;
// Get user's HP Bank stacks.
var hpInBank = user._hpBank;
// Reduce user's HP Bank stacks.
hpInBank -= toReduce;
// Set stack count min to 0, max to 10.
hpInBank = hpInBank.clamp(0, 10);
// Get HP Bank state ID.
var hpBankId = stateId;
// Set the counter for the state.
user.setStateCounter(hpBankId, 'x' + hpInBank);
// Apply stack counter to user's combo count.
user._hpBank = hpInBank;
</Custom Execution>
Table of Contents