arenaModule
- community
- events
- by Mad
- Takaro v0.0.20
- all
Provides an in-game Arena event system, teleporting players to a designated location to face challenges and earn rewards.
Key Functionality:
- Arena Teleportation: Players are teleported to a configurable arena location to participate in the event.
- Event Management: The module manages the arena event flow, potentially including timed challenges or waves of enemies (this would need to be implemented separately within the game server, this module just handles the teleportation and rewards).
- Reward System: Upon completion of the arena, players can receive both random and fixed rewards.
*Random Items: A configurable number of random items can be awarded from a predefined list.
*Fixed Rewards: Specific items are guaranteed to be given to players who complete the arena. - Permission Control: Access to the arena event is controlled via a configurable permission.
- Variable Tracking: The module uses variables to track players' arena participation, ensuring they progress correctly and receive rewards.
How to Use:
- Configuration:
xlocation,ylocation,zlocation: Define the coordinates of the arena within the game world.ylocationcan be set to -1 to teleport players to the highest block at the x,z coordinates.randomitemnumber: Sets the number of random items to award.randomitemlist: A list of possible items for the random rewards, including item names, amounts, and qualities.fixedrewards: A list of items always awarded upon arena completion.
- Permissions: Assign the
ARENA_PERMISSIONto the player groups or individuals who should have access to the arena event (the trigger command isarenaas seen in the code). - Game Server Integration: This module requires corresponding setup within the 7 Days to Die game server to function correctly. This module handles player teleportation and reward distribution, but the actual arena challenges (e.g., spawning enemies, timed events) must be configured separately using server commands or mods. The module uses the
thcommand to teleport players in the background, but you may need to adjust this depending on your server setup. - Event Trigger: Players initiate the arena event using the
/arenacommand (or whatever trigger you set up).
Important Considerations:
- The module's functionality is limited to teleportation and reward distribution. The actual arena gameplay must be configured independently on the game server.
- Coordinate configuration is critical for correct teleportation.
- Proper permission setup is essential to control access to the arena.
- The module interacts with the game server using commands; ensure compatibility with your server version and any other mods.
- Player death during the arena will cancel the event for that player and remove the tracking variable.
Configuration 6
Settings you fill in when installing the module on a server.
| Setting | Type | Default | Description |
|---|---|---|---|
xlocation required xlocation | string | "" | East West Location |
ylocation required ylocation | string | "-1" | Height teleport location. -1 for the highest block |
zlocation required zlocation | string | "" | Set North South location. South is negative |
randomitemnumber randomitemnumber | number | 0 | Defines how many random items will be rewarded to the player, picked from randomitemlist config field. The quantities for each item picked is defined on the mentioned config field. |
randomitemlist Items | array | — | List of items that will be used to select a random reward for the vote, as many times as defined at randomitemnumber. |
fixedrewards Items | array | — | All the items in this list will be given as a reward for completing the arena. |
Raw config schema
{
"$schema": "http://json-schema.org/draft-07/schema#",
"type": "object",
"required": [
"xlocation",
"ylocation",
"zlocation"
],
"additionalProperties": false,
"properties": {
"xlocation": {
"title": "xlocation",
"description": "East West Location",
"default": "",
"type": "string",
"minLength": 1,
"maxLength": 6
},
"ylocation": {
"title": "ylocation",
"description": "Height teleport location. -1 for the highest block",
"default": "-1",
"type": "string",
"minLength": 1,
"maxLength": 3
},
"zlocation": {
"title": "zlocation",
"description": "Set North South location. South is negative",
"default": "",
"type": "string",
"minLength": 1,
"maxLength": 6
},
"randomitemnumber": {
"title": "randomitemnumber",
"description": "Defines how many random items will be rewarded to the player, picked from randomitemlist config field.\nThe quantities for each item picked is defined on the mentioned config field.",
"default": 0,
"type": "number"
},
"randomitemlist": {
"title": "Items",
"description": "List of items that will be used to select a random reward for the vote, as many times as defined at randomitemnumber.",
"x-component": "item",
"type": "array",
"uniqueItems": true,
"items": {
"type": "object",
"title": "Item",
"properties": {
"item": {
"type": "string",
"title": "Item"
},
"amount": {
"type": "number",
"title": "Amount"
},
"quality": {
"type": "string",
"title": "Quality"
}
}
}
},
"fixedrewards": {
"title": "Items",
"description": "All the items in this list will be given as a reward for completing the arena.",
"x-component": "item",
"type": "array",
"uniqueItems": true,
"items": {
"type": "object",
"title": "Item",
"properties": {
"item": {
"type": "string",
"title": "Item"
},
"amount": {
"type": "number",
"title": "Amount"
},
"quality": {
"type": "string",
"title": "Quality"
}
}
}
}
}
} Raw UI schema
{} Commands 12
Chat commands players trigger in game.
-
09 arena wait 125
No help text available
Command source
import { takaro, data, checkPermission, TakaroUserError } from '@takaro/helpers'; async function main() { const { player, gameServerId, module: mod, pog } = data; // Check permission for the Arena command if (!checkPermission(pog, 'ARENA_PERMISSION')) { return; }; const VARIABLE_KEY = 'arena'; // Key to look up // Search for the variable with the specified key and filters const arena = await takaro.variable.variableControllerSearch({ filters: { key: [VARIABLE_KEY], gameServerId: [gameServerId], playerId: [data.player.id], } }); if (arena.data.data.length > 0) { await takaro.gameserver.gameServerControllerExecuteCommand(gameServerId, { command: `th "${player.name}" 20`, }); await data.player.pm(`[02FEDC]Round 4[-]`); }; } await main(); -
10 arena wait 135
No help text available
Command source
import { takaro, data, checkPermission, TakaroUserError } from '@takaro/helpers'; async function main() { const { player, gameServerId, module: mod, pog } = data; // Check permission for the Arena command if (!checkPermission(pog, 'ARENA_PERMISSION')) { return; } const VARIABLE_KEY = 'arena'; // Key to look up // Search for the variable with the specified key and filters const arena = await takaro.variable.variableControllerSearch({ filters: { key: [VARIABLE_KEY], gameServerId: [gameServerId], playerId: [data.player.id], } }); if (arena.data.data.length > 0) { await takaro.gameserver.gameServerControllerExecuteCommand(gameServerId, { command: `th "${player.name}" 20`, }); } } await main(); -
04 arena wait 15
No help text available
Command source
import { takaro, data, checkPermission, TakaroUserError } from '@takaro/helpers'; async function main() { const { player, gameServerId, module: mod, pog } = data; // Check permission for the Arena command if (!checkPermission(pog, 'ARENA_PERMISSION')) { return; } const VARIABLE_KEY = 'arena'; // Key to look up // Search for the variable with the specified key and filters const arena = await takaro.variable.variableControllerSearch({ filters: { key: [VARIABLE_KEY], gameServerId: [gameServerId], playerId: [data.player.id], } }); if (arena.data.data.length > 0) { await takaro.gameserver.gameServerControllerExecuteCommand(gameServerId, { command: `th "${player.name}" 20`, }); } } await main(); -
06 arena wait 55
No help text available
Command source
import { takaro, data, checkPermission, TakaroUserError } from '@takaro/helpers'; async function main() { const { player, gameServerId, module: mod, pog } = data; // Check permission for the Arena command if (!checkPermission(pog, 'ARENA_PERMISSION')) { return; } const VARIABLE_KEY = 'arena'; // Key to look up // Search for the variable with the specified key and filters const arena = await takaro.variable.variableControllerSearch({ filters: { key: [VARIABLE_KEY], gameServerId: [gameServerId], playerId: [data.player.id], } }); if (arena.data.data.length > 0) { await takaro.gameserver.gameServerControllerExecuteCommand(gameServerId, { command: `th "${player.name}" 20`, }); } } await main(); -
12 arena wait 195
No help text available
Command source
import { takaro, data, TakaroUserError, checkPermission } from '@takaro/helpers'; async function main() { const { pog, player, gameServerId } = data; const { randomitemnumber, randomitemlist, fixedrewards } = data.module.userConfig; const { steamId } = data.player; if (!checkPermission(pog, 'ARENA_PERMISSION')) { return; }; const VARIABLE_KEY = 'arena'; // Key to look up // Search for the variable with the specified key and filters const arena = await takaro.variable.variableControllerSearch({ filters: { key: [VARIABLE_KEY], gameServerId: [gameServerId], playerId: [data.player.id], } }); if (arena.data.data.length > 0) { let actualrandomitemnumber; if (randomitemnumber === 0) { actualrandomitemnumber = 0; } else { actualrandomitemnumber = randomitemnumber > randomitemlist.length ? randomitemlist.length : randomitemnumber; }; if (actualrandomitemnumber > 0) { for (let i = 0; i < actualrandomitemnumber; i++) { const randomIndex = Math.floor(Math.random() * randomitemlist.length); const randomOption = randomitemlist.splice(randomIndex, 1)[0]; if (typeof randomOption === 'string') { console.log(`Giving random item ${i + 1}/${actualrandomitemnumber}:`, randomOption); await takaro.gameserver.gameServerControllerGiveItem(data.gameServerId, data.player.id, { name: randomOption, amount: 1, quality: '0', }); await data.player.pm(`You received ${randomOption}! (item ${i + 1}/${actualrandomitemnumber + fixedrewards.length})`); } else { const item = (await takaro.item.itemControllerFindOne(randomOption.item)).data.data; console.log(`Giving random item ${i + 1}/${actualrandomitemnumber}:`, item.name); try { await takaro.gameserver.gameServerControllerGiveItem(data.gameServerId, data.player.id, { name: item.code, amount: randomOption.amount ?? '1', quality: randomOption.quality ?? '', }); } catch (error) { await takaro.gameserver.gameServerControllerGiveItem(data.gameServerId, data.player.id, { name: item.code, amount: randomOption.amount ?? '1', quality: '', }); } await data.player.pm(`You received ${randomOption.amount}x ${item.name}! (item ${i + 1}/${actualrandomitemnumber + fixedrewards.length})`); } } } if (fixedrewards.length > 0) { let index = 1; for (const each of fixedrewards) { if (typeof each === 'string') { await takaro.gameserver.gameServerControllerGiveItem(data.gameServerId, data.player.id, { name: each, amount: 1, quality: '0', }); await data.player.pm(`You received ${each}! (item ${index + actualrandomitemnumber}/${actualrandomitemnumber + fixedrewards.length})`); } else { const item = (await takaro.item.itemControllerFindOne(each.item)).data.data; try { await takaro.gameserver.gameServerControllerGiveItem(data.gameServerId, data.player.id, { name: item.code, amount: each.amount ?? 1, quality: each.quality ?? '', }); } catch (error) { await takaro.gameserver.gameServerControllerGiveItem(data.gameServerId, data.player.id, { name: item.code, amount: each.amount ?? 1, quality: '', }); } await data.player.pm(`You received ${each.amount}x ${item.name}! (item ${index + actualrandomitemnumber}/${actualrandomitemnumber + fixedrewards.length})`); } index++; } }; } else { return }; const arenaVars = await takaro.variable.variableControllerSearch({ filters: { playerId: [player.id], gameServerId: [gameServerId], key: ['arena'], } }); for (const variable of arenaVars.data.data) { await takaro.variable.variableControllerDelete(variable.id); } } await main(); -
03 arena wait 5
No help text available
Command source
import { takaro, data, checkPermission, TakaroUserError } from '@takaro/helpers'; async function main() { const { player, gameServerId, module: mod, pog } = data; // Check permission for the Arena command if (!checkPermission(pog, 'ARENA_PERMISSION')) { return; }; const VARIABLE_KEY = 'arena'; // Search for the variable with the specified key and filters const arena = await takaro.variable.variableControllerSearch({ filters: { key: [VARIABLE_KEY], gameServerId: [gameServerId], playerId: [data.player.id], } }); if (arena && arena.data.data.length > 0) { await takaro.gameserver.gameServerControllerExecuteCommand(gameServerId, { command: `th ${player.name} 20`, }); } }; await main(); -
07 arena wait 85
No help text available
Command source
import { takaro, data, checkPermission, TakaroUserError } from '@takaro/helpers'; async function main() { const { player, gameServerId, module: mod, pog } = data; // Check permission for the Arena command if (!checkPermission(pog, 'ARENA_PERMISSION')) { return; }; const VARIABLE_KEY = 'arena'; // Key to look up // Search for the variable with the specified key and filters const arena = await takaro.variable.variableControllerSearch({ filters: { key: [VARIABLE_KEY], gameServerId: [gameServerId], playerId: [data.player.id], } }); if (arena.data.data.length > 0) { await takaro.gameserver.gameServerControllerExecuteCommand(gameServerId, { command: `th "${player.name}" 20`, }); await data.player.pm(`[02FEDC]Round 3[-]`); }; } await main(); -
11 arena wait 165
No help text available
Command source
import { takaro, data, checkPermission, TakaroUserError } from '@takaro/helpers'; async function main() { const { player, gameServerId, module: mod, pog } = data; // Check permission for the Arena command if (!checkPermission(pog, 'ARENA_PERMISSION')) { return; }; const VARIABLE_KEY = 'arena'; // Key to look up // Search for the variable with the specified key and filters const arena = await takaro.variable.variableControllerSearch({ filters: { key: [VARIABLE_KEY], gameServerId: [gameServerId], playerId: [data.player.id], } }); if (arena.data.data.length > 0) { await takaro.gameserver.gameServerControllerExecuteCommand(gameServerId, { command: `th "${player.name}" 20`, }); await data.player.pm(`[edd521]You've made it to the end. You were victorious survivor![-]`); }; } await main(); -
08 arena wait 95
No help text available
Command source
import { takaro, data, checkPermission, TakaroUserError } from '@takaro/helpers'; async function main() { const { player, gameServerId, module: mod, pog } = data; // Check permission for the Arena command if (!checkPermission(pog, 'ARENA_PERMISSION')) { return; } const VARIABLE_KEY = 'arena'; // Key to look up // Search for the variable with the specified key and filters const arena = await takaro.variable.variableControllerSearch({ filters: { key: [VARIABLE_KEY], gameServerId: [gameServerId], playerId: [data.player.id], } }); if (arena.data.data.length > 0) { await takaro.gameserver.gameServerControllerExecuteCommand(gameServerId, { command: `th "${player.name}" 20`, }); } } await main(); -
02 arena wait 2
No help text available
Command source
import { takaro, data, checkPermission, TakaroUserError } from '@takaro/helpers'; async function main() { const { player, gameServerId, module: mod, pog } = data; // Check permission for the Arena command if (!checkPermission(pog, 'ARENA_PERMISSION')) { return; }; await data.player.pm(`[02FEDC]${player.name}[-][-] do not teleport or die, you will not get your rewards. There is no way out except [FF595B]Death[-] or [AEE57A]Victory[-]`); }; await main(); -
01 arena
A huge arena battle for only the finest soldiers
Command source
import { data, checkPermission, TakaroUserError, takaro } from '@takaro/helpers'; async function main() { const { player, pog, gameServerId } = data; if (!checkPermission(pog, 'ARENA_PERMISSION')) { throw new TakaroUserError('You do not have permission to use the Arena command.'); } // Announce Arena await takaro.gameserver.gameServerControllerSendMessage(data.gameServerId, { message: `[FFFF33]${player.name} has started an Arena Battle for huge rewards![-]`, }); const xlocation = Number(data.module.userConfig.xlocation); // Convert to number const ylocation = Number(data.module.userConfig.ylocation); // Convert to number const zlocation = Number(data.module.userConfig.zlocation); // Convert to number // Teleport player to user-configured location await takaro.gameserver.gameServerControllerTeleportPlayer(gameServerId, pog.playerId, { x: xlocation, y: ylocation, z: zlocation, }); const VARIABLE_KEY = 'arena'; // Check if the variable already exists const existingVar = await takaro.variable.variableControllerSearch({ filters: { key: [VARIABLE_KEY], gameServerId: [gameServerId], playerId: [player.id], moduleId: [data.module.moduleId] } }); if (existingVar.data.data.length > 0) { // Variable exists, update it await takaro.variable.variableControllerUpdate(existingVar.data.data[0].id, { value: '1' }); } else { // Variable doesn't exist, create it await takaro.variable.variableControllerCreate({ key: VARIABLE_KEY, value: '1', gameServerId: gameServerId, playerId: player.id, moduleId: data.module.moduleId }); } // Assign role await takaro.player.playerControllerRemoveRole(player.id, "fd4415e1-ff99-4aca-8390-cd97d574f1fe"); return { success: true }; } await main(); -
05 arena wait 45
No help text available
Command source
import { takaro, data, checkPermission, TakaroUserError } from '@takaro/helpers'; async function main() { const { player, gameServerId, module: mod, pog } = data; // Check permission for the Arena command if (!checkPermission(pog, 'ARENA_PERMISSION')) { return; }; const VARIABLE_KEY = 'arena'; // Key to look up // Search for the variable with the specified key and filters const arena = await takaro.variable.variableControllerSearch({ filters: { key: [VARIABLE_KEY], gameServerId: [gameServerId], playerId: [data.player.id], } }); if (arena.data.data.length > 0) { await takaro.gameserver.gameServerControllerExecuteCommand(gameServerId, { command: `th "${player.name}" 20`, }); await data.player.pm(`[02FEDC]Round 2[-]`); }; } await main();
Hooks 1
Code that runs in reaction to a game or Takaro event.
-
PlayerDied
Hook for player-death events
Hook source
import { takaro, data } from '@takaro/helpers'; async function main() { const { player, gameServerId, moduleId } = data; const arenaVars = await takaro.variable.variableControllerSearch({ filters: { playerId: [player.id], gameServerId: [gameServerId], //moduleId: [mod.moduleId], key: ['arena'], } }); for (const variable of arenaVars.data.data) { await takaro.variable.variableControllerDelete(variable.id); } }; await main();
Permissions 1
Roles you can grant to decide who may use what.
-
Arena Permission
Gives players access to the arena command