Blueprint Name: Minigames Blueprint
A blueprint where minigames are played in rounds. Includes scripts for common objectives and assigning weapons. Allows you to easily add your own minigames.
Showcase link: Crayta
🛠 INSTALLATION INSTRUCTIONS
- Create a new game and search for “Minigames Blueprint”
💡 BLUEPRINT OVERVIEW
This blueprint includes 4 ready-to-use and 2 example minigames. It shows how much is possible with scripting, but you can also add race or survival minigames without scripting.
Players don’t respawn during a minigame. They will automatically spectate another player on death.
The WorldSettings are set under GlobalScripts.DefaultWorldSettings.
Also check out the help page included in the Blueprint / Showcase game to understand how to play. If you win a minigame you have a trophy icon on the results screen and are awarded some experience points.
⚙️HOW TO ADD A MINIGAME
Make a copy of the “MgSpinner” template. This template is a good starting point. In the following I explain every entity:
- BGM - This is the music that plays during the minigame.
- Environment - Place your meshes / voxel meshes in here. They will be spawned when the minigame is selected.
- Kill Trigger: Optional: If it exists each player touching the trigger will die. Must be named exactly “KillTrigger”.
- Player Spawns: Optional: Every locator under this locator will be used as a player spawn. Each player will spawn at a random spawn. If not specified then each player will spawn at the minigame position.
- Scripts: The scripts for this minigame, which will be explained below. MinigameConfig is mandatory, MinigameLogic and WorldSettings are both optional.
The property tooltips should give you a rough idea how to use each property.
- FFA - Free for All - Every player plays against every other player.
- Teams - The players will be split into two teams of equal size. Allows you to configure different spawns for each team.
Win Condition - There are 5 pre-configured win conditions you can use. The code for each of them is in the MinigameRoundManager. If you selected “Teams” as Minigame Type, then you can only use highestScore and stayAlive.
- highestScore - The player with the highest score will win.
- targetScore - Each player above the target score will win.
- lowestTime - The player with the lowest time will win.
- targetTime - Each player that finishes the race before the roundTime runs out will win.
- stayAlive - The last player standing wins. If the roundTime runs out every player that is alive wins. If there is only one player you have to survive until the round ends.
Here you can place any script that you want. Survival minigames can work without a script. For Race minigames you can use the “MgRaceStarter” script. Score minigames need a script that counts up the score. You can search for user:SendToScripts(“AddScore”, 1) to get an idea how they work.
MinigameLogic scripts can include the following functions, which are then called from MinigameRoundManager:
- OnPrepareMinigame(mgRoundManagerScript, minigameName)
- OnStartMinigame(mgRoundManagerScript, minigameName)
MinigameLogic scripts can end a round early by calling mgRoundManager:EndMinigame(). You can pass a winnersTable as an optional parameter. If you pass a winnersTable the winCondition set in the MinigameConfig is ignored. This allows you to implement your own logic.
To get the table of players that are playing the minigame you can use mgRoundManagerScript.roundUserList
Each minigame can include WorldSettings, which are applied during the round. Specifying them is similar to the “World” tab.
The following leaderboards are included:
- level-total - The highest level players
- wins-monthly - The players with the most wins (resets each month)
🏆 CREATOR CHALLENGES
This blueprint sends the challenge and XP event: “win-minigame”. It includes the minigameName as a property, so you can filter for a specific minigame, by adding a condition like this:
minigameName == Platform Peril
Special thanks to DryCoast and Daigoro for making the original Crayta Party. MgPlatformPeril and MgRussianRoulette have been adjusted from Crayta Party.
- “Mighty Animations” and “Smooth World Settings V2” by Mightykho
- “NUI - XP and Levelling” by Nomaki
If you have any questions or feedback, reach out to me (Vilva#5980) in the Crayta Discord