118 lines
3.2 KiB
Markdown
118 lines
3.2 KiB
Markdown
# Examples
|
|
|
|
These examples describe the current Hytale-native setup: minigame definitions are assets, and world interaction is done with normal Hytale trigger volumes using the minigame trigger condition/effect types.
|
|
|
|
## Simple Start Pad
|
|
|
|
Definition file: `Server/Minigames/Quick_Brawl.json`
|
|
|
|
```json
|
|
{
|
|
"Id": "Quick_Brawl",
|
|
"Name": "Quick Brawl",
|
|
"Description": "A short solo score test.",
|
|
"Enabled": true,
|
|
"MinPlayers": 1,
|
|
"MaxPlayers": 8,
|
|
"TeamMode": "SOLO",
|
|
"WinCondition": "HIGHEST_SCORE",
|
|
"RoundLengthSeconds": 120,
|
|
"CountdownSeconds": 5,
|
|
"AllowPvp": true,
|
|
...
|
|
}
|
|
```
|
|
|
|
Editor setup:
|
|
|
|
1. Create a normal Hytale trigger volume at the start pad.
|
|
2. Add the `StartMinigame` effect.
|
|
3. Set `MinigameId` to `Quick_Brawl` using the asset picker.
|
|
|
|
## Activating Players
|
|
|
|
Players must be explicitly set to `ACTIVE` status before the activation lifecycle runs. This is what triggers inventory saving, start item giving, game mode change, and HUD display. Without a `SetPlayerStatus ACTIVE` effect, none of these happen.
|
|
|
|
A common pattern is a spawn-room trigger volume that all players enter when the game starts:
|
|
|
|
1. Create a trigger volume covering the spawn area.
|
|
2. Add `PlayerInMinigame` as a condition (`MinigameId = Quick_Brawl`, leave `PlayerId` blank).
|
|
3. Add `SetPlayerStatus` as an effect (`MinigameId = Quick_Brawl`, `Status = ACTIVE`, leave `PlayerId` blank).
|
|
|
|
The entering player is resolved from the trigger context, so leaving `PlayerId` blank activates whoever enters the volume.
|
|
|
|
## Score Zone
|
|
|
|
Definition file: `Server/Minigames/Hill_Points.json`
|
|
|
|
```json
|
|
{
|
|
"Id": "Hill_Points",
|
|
"Name": "Hill Points",
|
|
"Enabled": true,
|
|
"MinPlayers": 1,
|
|
"MaxPlayers": 12,
|
|
"TeamMode": "SOLO",
|
|
"WinCondition": "FIRST_TO_SCORE",
|
|
"RoundLengthSeconds": 300
|
|
}
|
|
```
|
|
|
|
Editor setup:
|
|
|
|
1. Create a normal Hytale trigger volume around the scoring area.
|
|
2. Add `PlayerInMinigame` as a condition.
|
|
3. Add `ModifyScore` as an effect.
|
|
4. Set `MinigameId = Hill_Points`, `TargetType = PLAYER`, `TargetSource = TRIGGERING_PLAYER`, `Operation = ADD`, and `Amount = 1`.
|
|
|
|
If the trigger context contains the player who entered the volume, `TargetSource = TRIGGERING_PLAYER` awards that player.
|
|
|
|
## End When Score Reaches a Target
|
|
|
|
Condition:
|
|
|
|
- Type: `PlayerScore`
|
|
- `MinigameId = Hill_Points`
|
|
- `Compare = GREATER_THAN_OR_EQUAL`
|
|
- `Value = 100`
|
|
|
|
Effect:
|
|
|
|
- Type: `EndMinigame`
|
|
- `MinigameId = Hill_Points`
|
|
- `Reason = score_reached`
|
|
|
|
## Team Score Zone
|
|
|
|
Use `ModifyScore` with `TargetType=TEAM` when the score belongs to a team instead of a player.
|
|
|
|
Required fields:
|
|
|
|
- `MinigameId`
|
|
- `TargetType = TEAM`
|
|
- `TargetSource = TRIGGERING_TEAM` or `TAG_TEAM_ID`
|
|
- `Operation`
|
|
- `Amount`
|
|
|
|
When using `TargetSource = TAG_TEAM_ID`, add `TeamId=<team>` to the trigger volume tags.
|
|
|
|
Use `AssignTeam` with `BalanceTeams=true` to split all players in the started runtime evenly across teams. If no teams already exist, the effect creates `team1..teamN` from the minigame's `TeamCount`.
|
|
|
|
## Counter Gate
|
|
|
|
Increment:
|
|
|
|
- Effect: `ModifyCounter`
|
|
- `CounterId = captured_points`
|
|
- `Operation = ADD`
|
|
- `Amount = 1`
|
|
|
|
Gate:
|
|
|
|
- Condition: `Counter`
|
|
- `CounterId = captured_points`
|
|
- `Compare = GREATER_THAN_OR_EQUAL`
|
|
- `Value = 3`
|
|
|
|
Then attach a follow-up effect, such as `SetMinigamePhase` or `EndMinigame`.
|