Stage Tabels
This mod provides a toolkit for creating weighted randomized tables of game stages. If you're not familiar with the concept of game stages, it's recommended to first learn about the main Game Stages mod. The core idea is that modpack creators can define stage tables and use a special command to grant players random stages from these tables.
Basic knowledge of CraftTweaker scripting is required for effective use of this mod.
Main Commands
- /stagetable — displays a list of all available commands
- /stagetable dump — generates a file containing information about all stage tables
- /stagetable award
— grants the specified player a random stage from the selected table
- /stagetable silentaward
— similar to the previous command, but without notifying the player
Key Concepts
- Stage Table — a named table containing stage entries
- Stage Entry — a table element including the stage itself, weight value, and application conditions
- Stage Condition — a requirement that must be met for a stage to be granted to a player
Weighted Randomness System
Weight represents a probability system where different outcomes have unequal chances of occurring. The percentage probability for a specific outcome is calculated by dividing that entry's weight by the total weight of all entries in the table. For example, if an entry has a weight of 1 and the table's total weight is 9, the chance of that entry being selected is 10%. Weighted randomness is particularly useful when flexibility in the set of possible outcomes is required.
Working with CraftTweaker Scripts
Below is an example script demonstrating the mod's main capabilities:
// Basic imports for the script import crafttweaker.player.IPlayer; // Creating a new stage table named exampleTable val testTable = stageTables.createTable("exampleTable"); // Creating an entry for stage "one" with weight 5 val entryOne = testTable.createEntry("one", 5); // Creating an entry for stage "two" with weight 5 val entryTwo = testTable.createEntry("two", 5); // Preventing selection of entryTwo unless player has stage "four" entryTwo.addStageCondition("four"); // Creating an entry for stage "three" with weight 1 val entryThree = testTable.createEntry("three", 1); // Adding a custom condition via ZenScript // In this case — only for players in creative mode entryThree.addCondition(function(player as IPlayer) { return player.creative; }); - /stagetable silentaward