Home
Items
  • Tribals.io Wiki
    • Items
      • Resources
        • Wood
        • Charcoal
        • Stone
        • Leaf
        • Rope
        • Iron
        • Iron Fragment
        • Iron Bar
        • Sulfur
        • Cooked Sulfur
        • Leather
        • Tusk
        • Hide
        • Fat
        • Bone
        • Feather
        • Gun Barrel
        • Spring
        • SemiAuto-Body
        • Gunpowder
        • Explosive Gunpowder
      • Food
        • Banana
        • Mashed Banana
        • Berry
        • Carrot
        • Raw Chicken
        • Cooked Chicken
        • Burned Chicken
        • Corn
        • Popcorn
        • Shrimp
        • Cooked Shrimp
        • Catfish
        • Cooked Catfish
        • Salmon
        • Cooked Salmon
        • Trout
        • Cooked Trout
        • Bass
        • Cooked Bass
        • Mushroom
        • Watermelon
        • Coconut
        • Food Garbage
        • Raw Meat
        • Cooked Meat
      • Books
        • Pistol Book
        • Worn Pistol Book
        • Musket Book
        • Worn Musket Book
        • Shotgun Book
        • Worn Shotgun Book
        • Explosives Book
        • Worn Explosives Book
        • Chainmail Boots Book
        • Worn Chainmail Boots Book
        • Chainmail Legs Book
        • Worn Chainmail Legs Book
        • Chainmail Chest Book
        • Worn Chainmail Chest Book
        • Chainmail Helmet Book
        • Worn Chainmail Helmet Book
        • IronPlated Boots Book
        • Worn IronPlated Boots Book
        • IronPlated Legs Book
        • Worn IronPlated Legs Book
        • IronPlated Chest Book
        • Worn IronPlated Chest Book
        • IronPlated Helmet Book
        • Worn IronPlated Helmet Book
      • Weapons and Equipment
        • Torch
        • Hatchet
        • Iron Hatchet
        • Stone Pickaxe
        • Iron Pickaxe
        • Bone Knife
        • Wooden Spear
        • Stone Spear
        • Iron Spear
        • Slingshot
        • Wooden Bow
        • Pistol
        • Musket
        • Shotgun
        • Upgrade Hammer
        • Paint Brush
        • Building Plan
        • Note
      • Ammunition
        • Stone Arrow
        • Pistol Ammo
        • Musket Ammo
        • Shotgun Ammo
        • Explosive Shotgun Ammo
      • Armor and Clothing
        • Leather Set
          • Leather Boots
          • Leather Pants
          • Leather ShortShirt
          • Leather LongShirt
          • Leather Gloves
        • Wood Set
          • Wood Boots
          • Wood Legs
          • Wood ChestPlate
          • Wood Helmet
        • Chainmail Set
          • Chainmail Boots
          • Chainmail Legs
          • Chainmail ChestPlate
          • Chainmail Helmet
        • IronPlated Set
          • IronPlated Boots
          • IronPlated Legs
          • IronPlated ChestPlate
          • IronPlated Helmet
    • Structures
      • Toolbox
      • Wooden Platform
      • Triangle Platform
      • Trap Platform
      • Wall
      • MidWall
      • Window
      • Roof
      • Triangle Roof
      • RoofHatch
      • Door Gateway
      • Door
      • Metal Door
      • Fence
      • Shelf
      • Ladder
      • Stairs
      • Slope
      • Pillar
      • Stone Structures
        • Stone Platform
        • Stone Triangle Platform
        • Stone Wall
        • Stone Midwall
        • Stone Window
        • Stone Roof
        • Stone Triangle Roof
        • Stone RoofHatch
        • Stone Door Gateway
        • Stone Ladder
    • Building elements
      • Sleeping Bed
      • Lock
      • Spike
      • Signpost
      • Fishing Net
      • Banner
      • Smelter
      • Camp Fire
      • Workbench
      • Wooden Box (Storage)
      • Big Storage
      • Repair Table
      • Water Collector
      • Vending Machine
      • Rug
      • Bear Trap
    • Creatures
      • Animals
        • Bear
        • Boar
        • Wolf
        • Chicken
        • Seagull
        • Fish
      • Humanoids
        • Pirate
    • Crafting
    • Decay
    • Clans
    • Tribals+
    • Server Transfer
    • Fast Crafting
    • Community (Private) Servers
      • Video tutorials
        • How to update your server?
        • How to add custom ammo?
      • Rules
      • Server Scripting
    • Special Events
      • Pirate Event
Powered by GitBook
On this page
  • Scripting Rules
  • Editing Rule Files
  • Steps to validate your rule files:
  • Starter Items (starter_items.json) :
  • General Settings (general_settings.json):
  • Items (items.json):
  1. Tribals.io Wiki
  2. Community (Private) Servers

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.

PreviousHow to add custom ammo?NextServer Scripting

Last updated 1 year ago

Scripting Rules

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

Editing Rule Files

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.

Tribals uses the 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 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 website to validate your server rules before saving them on your server.

Learn more about custom scripting, visit page.

JSON
JSON
https://jsonlint.com
Server Scripting
Starter Items
General Settings
Items
Island
Animals
Animals Spawn
Building Wheel
Settings
JSON
Rule files can be found in "SERVER SETTINGS > RULES > Rule File" area
Example of a simple JSON structure. Arrays can contain objects or another arrays. Objects can contain keys and their values. Each key must have its value and vice versa.
To copy your rule file contents, select and copy the JSON data to clipboard.
If everything is properly formatted, it shows "JSON is valid" message. It means your rule file is good to go!
The suggestions (expecting) are examples of what could be written in place of that character that causes the error