
This is the cellicom_d20 plugin for RPG Maker MV/MZ, created by cellicom.
This plugin allows you to simulate rolling a 20-sided die (d20), play animations or show text for the roll, and return the result. The result can also be stored in a variable. It supports D&D-style mechanics like advantage, disadvantage, and ability checks.
Optional but recommended: Create 20 consecutive animations in your database (e.g., from ID 1 to 20). The recommended duration is 120 frames. Make sure to set the starting AnimationID in the plugin parameters.
You can interact with the plugin using script calls.
Rolls a d20 and returns the result (1-20). The parameters showAnimation and showText can be true or false (default is true for both).
cellicom.d20.roll();
cellicom.d20.roll(true, true);
Rolls two d20s. Returns the higher result if isDisadvantage is false, or the lower result if isDisadvantage is true.
cellicom.d20.rollWithAdvantage();
cellicom.d20.rollWithAdvantage(true, true, false); // advantage
cellicom.d20.rollWithAdvantage(true, true, true); // disadvantage
Forces the next roll to be a specific value.
cellicom.d20.activateCheat(20); // The next roll will be a 20
Checks if a roll plus an optional bonus is greater than or equal to a target check value.
bonus can be positive or negative. The rolled parameter can be a specific number; if omitted, it uses the result of the last roll.
if (cellicom.d20.abilityCheck(17, 3, cellicom.d20.roll())) {
// Passed!
}
if (cellicom.d20.abilityCheck(17, 3)) { // Uses the last roll
// Passed!
}
Returns the value of the last roll (only works if VariableID is set to save the result in the parameters).
if (cellicom.d20.abilityCheck(15, -1, cellicom.d20.getLastRoll())) {
// Passed!
}
This plugin is compatible with DKTools_Localization.