Rules

Tribals uses rule files to run the game. Players may customize their servers easily with programmable rule files, made with JSON data format. Rule files can be found at Server Settings.

Scripting Rules

Rules are the settings your server uses to run the things as you want. Rules are written and stored in JSON format.

Editing Rule Files

Tribals uses the JSON data language to store the rule files data. Any edit done to the rule files must be properly formatted because any error in its code might break your server.

Finding errors in JSON code can be a challenging and time-consuming. But there is an easy way to validate the JSON and see where it fails. These type of services are called JSON validator/formatter. As an example, we suggest https://jsonlint.com website to validate your server rules before saving them on your server.

Steps to validate your rule files:

  • Before editing, you should backup the original copy and store it somewhere (e.g your computer, phone, email) so if something goes wrong, you could be able to restore the working version back.

  • Paste it to a validator service, and validate

  • If the JSON code has error(s), validator will point where it is. It will also give suggestions about what else character could be put there to fix it:

  • If you are still unable to fix the problem, use the backup you made and paste it into the rule file in server settings back. Then start editing again and try to keep the syntax proper to avoid the errors.

Rule Files

There are different rule files used to customize specific aspects of the server.

Starter Items (starter_items.json) :

Set the items given to players when logging in for the first time or when players respawn. Default: 1x Stone.

Usage:

{
    "items": [
        {
            "name": "Stone",
            "stack": 1
        }
    ]
}

Example: Let's add another item to starter_items.json

{
    "items": [
        {
            "name": "Stone",
            "stack": 1
        },
        {
            "name": "WoodenBow",
            "stack": 1
        }
    ]
}

As you can see from the example above, we added a wooden bow under "items" element. So along with a stone, players will get a free bow along with the stone when they respawn/spawn.

General Settings (general_settings.json):

Set a welcome message.

Usage:

{
    "welcome_message" : "Welcome to Tribals! /help for more commands."
}

Items (items.json):

The file that contains the general information of items and structures in Tribals. So it's pretty tricky to edit it because some errors might break your server, so ALWAYS get a backup before editing it.

Customizable properties:

  • General properties:

    • name: The actual name of the resource/tree/item/building

    • label: Customized name of the resource/tree/item/building

    • icon: The UI image of the resource/tree/item/building, if any.

  • Building properties:

    • place: If the building could be placed to the world or not. Accepts "true" or "false".

    • type: The type of this object. It can be "Item", "Building". Note: All the resource nodes, flints, trees, wood stumps, wrecks, plants are "Building" type of object.

    • stackable: If this building can be stacked together at the same slot or not. Accpets "true" or "false".

    • maxDurability: The durability limit of the usable objects.

    • protectionCost: The cost of resources to protect this structure from decaying.

    • canProtected: If this structure protected by toolbox or not. Accepts "true" or "false".

    • decayTime: How frequent it will inflicted with decay damage.

    • repeatRadius: Defines how close this item can be placed with each other.

    • damage: The amount of damage it inflicts when it interacts with something that can be harmed. Used in "Spike", "Campfire", "Trap Platform".

    • damageCost: The durability cost to the weapon attacks to this object.

    • snapType: The snapping behavior of the building when placing it.

    • supports: The building elements it grants integrity when they are around it.

    • connectedOn: The building elements it will snap when placing.

    • place: It can be placed or not.

    • integrity: It provides/affected by building integrity system.

    • recursiveCheck: Include this item to the recursive check of buildings.

    • ownership: Can be owned via toolbox or not.

    • description: The description shown on item tooltip and crafting area.

  • Resource (node) and tree properties:

    • isResource: Set true if resource.

    • maxDurability: The health value of the resource/tree. Can be repaired up to this value.

    • type: Resource type is "building". So set "type": "building" when adding a resource.

    • actorName: Programmatical name of the resource/tree

    • radius: The radius of the resource object in the 3D world.

    • interactionRadius: The max distance it can be interacted from.

    • damageCost: The damage inflicted when it gets attacked.

    • harvestType: Defines the hardness of the surface. Soft equipment won't harvest harder surfaces.

      • Soft: Soft surfaces like trees, animals

      • Medium: Harder resource node surfaces like stone

      • Hard: The hardest surfaces like iron node, sulfur node, etc. Can be only gathered with harvesting equipment made from iron.

    • onDamage: onDamage is an event, specifying if a player damages this resource/tree. When it happens, we can grant them specified resources.

      Example:

      "onDamage" : [{  
        "name" : "Wood", 
        "stack" : [2, 5] 
      }]
  • Item (equipment) properties:

    • maxDurability: The total durability that an item can have.

    • animalDamage: The damage value towards animal targets

    • buildingDamage: The damage value towards building elements, also resource nodes.

    • playerDamage: The damage value towards player enemies.

    • attackTime: The time it will wait to attack again, attack cooldown. Defined in milliseconds. 1000 ms = 1 second

    • attackDistance: The max distance it can inflict damage from where your character stands.

    • canRepair: Can be repaired at repair station

    • harvesting: If it can harvest, if so what kind of surfaces it can harvest. soft, medium, hard surfaces.

    • harvestMultiplier: How much more resource it will grant when harvesting. It multiplies with this number.

    • action: Define what happens when player uses primary action with it (left mouse click). It can attack, place, upgrade, paint, eat

    • stackable: If items can be stacked together, up to max stack

    • maxStack: Maximum number of the same of this item on the same square.

island-0x0.json:

The raw data of the map. Uses the official island as default. It uses the data output from the editor, we wouldn't advise manual edits. Use at your own risk!

Animals (animals.json):

The file that contains the general information of the NPCs in Tribals. Customizable prolerties:

  • name: The name of the animal NPC.

  • rarity: The spawn rarity rate of the animal. Can be "Common", "Uncommon", "Rare".

  • inland: Can walk on the land or not. Accepts "true" or "false".

  • radius: Sphere radius of animal carcass. It doesn't control the model size. It sets the actual NPC size on the server.

  • damageCost: The amount of damage it inflicts to the attacker weapon.

  • canHarvest: If the animal is skinnable or not. Accepts "true" or "false".

  • attacks: The entities it attacks to. Accepts NPC names, and "Player"

  • stats: general stats of the animal

    • mass: Its mass on the 3D space

    • radius: Sphere radius of alive animal. It doesn't control the model size. It sets the actual NPC size on the server.

    • health: The "current" health of the animal. Usually the same with maxHealth.

    • maxHealth: Actual health value. If healed when low health, character would heal up to maxHealth.

    • damage: The damage it deals when it attacks.

    • walkSpeed: Normal walk speed.

    • sprintSpeed: The speed when it attacks.

    • sightDistance: The distance it sees.

    • attackDistance: Any aggression within this distance will agitate the animal.

    • attackRange: The max distance it can attack from.

    • turnSpeed: The amount of angle it can turn in given time period.

    • quickTurn: The amount of angle it can turn when quick turning.

    • attackGiveUpTime: The amount of milliseconds before it gives up the current target.

    • assRange: The range of its back end.

    • shitInterval: How often it shits on the ground.

Animals Spawn (animals_spawn.json):

Set which animals and how many of them are to be spawned on the map.

Usage:

{

"spawnAnimals" : ["Bear", "Boar", "Chicken", "Seagull"],

"animalLimit" : { "Wolf" : 0, "Bear" : 3, "Boar" : 6, "Chicken" : 8, "Seagull" : 8 }

}

Building Wheel (building_wheel.json):

The ability to edit the building wheel area of the buildingplan item.

Settings (settings.json):

General game mode settings of the server. It includes default game mode (PVP) code but it can be altered via custom scripting.

Learn more about custom scripting, visit Server Scripting page.

Last updated