Adding Magic Items, Armor and Weapons - JBurlison/Pandaros.API GitHub Wiki
Items loaded through the Settlers Items jsons can accept any properties that are in the types.json. This tutorial will not include any details about the fields that already exist in colony survival items.
Step 1
Create a separate JSON file for your settlers items. Do not put them in the same json that you load colony survival items through. Although, the Settlers mod items json files can load base game items also and is not restricted to magic items, Armor and weapons. The loader loads depending on the properties. Load order is:
Checks for Durability property, if its present it will load the item as Armor. Checks for the WepDurability property, if its present it will load the item as a weapon. Checks for the IsMagical property, if its present it will load the item as a player magic item. then if none of these are present, loads as a CSItem
{
"Pandaros.Settlers.SkilledSword2": {
"Name": "Pandaros.Settlers.SkilledSword2",
"isPlaceable": false,
"categories": [ "weapon", "MagicItem" ],
"icon": "./icons/SkilledSword2.png",
"WepDurability": 2000,
"Luck": 0.03,
"Skilled": 0.03,
"Damage": { "Physical": 500.0 },
"Rarity": 0
}
}
Step 2
Add your settlers items json to your modinfo.
"Pandaros.API.jsonFiles": [
{
"fileType": "Pandaros.API.CSItems",
"relativePath": "SettlersItems.json"
},
]
Connected Blocks
Like other items in Settlers, connected blocks have to be defined in your Settlers Items json. Connected blocks allow blocks to work similar to how redstone, fences and tracks work in minecraft. To make any block a connected block add the ConnectedBlock property to the item.
"ConnectedBlock": {
"BlockType": "SomeFence",
"Connections": [
"Xp",
"Xn"
]
}
Y+
Y+ | + | Z0 | - |
---|---|---|---|
+ | XpZpYp(Not Supported) | XpYp | XpZnYp(Not Supported) |
X | ZpYp | Yp | ZnYp |
- | XnZpYp(Not Supported) | XnYp | XnZnYp(Not Supported) |
Y0
Y0 | + | Z0 | - |
---|---|---|---|
+ | XpZp(Not Supported) | Xp | XpZn(Not Supported) |
X0 | Zp | N/A | Zn |
- | XnZp(Not Supported) | Xn | XnZn(Not Supported) |
Y-
Y- | + | Z | - |
---|---|---|---|
+ | XpZpYn(Not Supported) | XpYn | XpZnYn(Not Supported) |
X | ZpYn | Yn | ZnYn |
- | XnZpYn(Not Supported) | XnYn | XnZnYn(Not Supported) |
Basic Y
Y Positive
Y Zero
Y Negative
The connections are unique per BlockType. For example, I had a fence I could have Xp, Xn as a straight fence left to right, another straight Zp, Zn as back to front and all the corner connections Yp, Zn and Xn, Zn ect ect... But I cannot make a second straight fence item with Xp, Xn as Connections as this connection type has already been taken in the Block Type.
Once you have your pieces declared ensure your onRemove is always your base fence type because the system will automatically replace any with the connections you define so there is no need to add a recipie for all the pieces of your fence. Tip, Dont add categories to these either so that cannot be looted via the lootall command.
Magic Item Properties
These are common properties between Weapons, armor and player magic items.
Property | Type | Example Value | Description |
---|---|---|---|
Luck | float | 0.03 | Luck is used for loot tables more luck means better chance at better loot |
Damage | Dictionary<DamageType,float> | { "Physical": 500.0 } | Applicable damage types are Physical, Earth, Air, Fire, Water, Void. You can have one of each in the {} along with an assigned damage value for each. Damage is applied to guards and call to arms guards only. See DamageMatrix |
MissChance | float | 0.05 | Determines the chance to be missed by an attack. If a zombie attacks a player/colonist with this armor on with the given example, it will have a 5% chance to miss |
ElementalArmor | DamageType | Physical | Applicable values are are Physical, Earth, Air, Fire, Water, Void. Gives the item this resistance. Damage is calculated for each piece of armor that a player/colonist is wearing and averages the total taken/reduced vs a specific damage type in the Damage Matrix |
AdditionalResistance | Dictionary<DamageType,float> | { "Physical": 0.10 } | Applicable damage types are Physical, Earth, Air, Fire, Water, Void. Applies a flat damage reduction after armor and resistances are applied. in this example, its a 10% damage reduction. All default colony survival zombies do physical damage. |
Skilled | float | 0.03 | Skilled determines chance to deal 2x damage for guards and on crafters, chance to proc rare items such as Esper, on gathering professions it adds a chance to gather one extra item. |
HPTickRegen | float | 5 | Health regen every 5 seconds |
Magic Weapon Properties
Magic weapons are for players. These are all melee.
{
"Pandaros.Settlers.SkilledSword2": {
"Name": "Pandaros.Settlers.SkilledSword2",
"isPlaceable": false,
"categories": [ "weapon", "MagicItem" ],
"icon": "./icons/SkilledSword2.png",
"WepDurability": 2000,
"Luck": 0.03,
"Skilled": 0.03,
"Damage": { "Physical": 500.0 },
"IsMagical": true,
"Rarity": 0
}
}
Property | Type | Example Value | Description |
---|---|---|---|
WepDurability | int | 500 | Denotes how many hits you can make with a weapon before it breaks. |
Magic Armor Properties
Magic Armors are for players and colonists.
{
"Pandaros.Settlers.SkilledShield": {
"Name": "Pandaros.Settlers.SkilledShield",
"isPlaceable": false,
"categories": [ "armor", "MagicItem" ],
"icon": "./icons/SkilledShield.png",
"IsMagical": true,
"Skilled": 0.01,
"ArmorRating": 0.13,
"Durability": 250,
"Slot": 5,
"Rarity": 0
}
}
Property | Type | Example Value | Description |
---|---|---|---|
Slot | Enum | Helm | Applicable values: Shield, Helm, Chest, Gloves, Legs, Boots. Damage reduction is also calculated in this order. |
ArmorRating | float | 0.35 | Damage Reduction value. Each piece of armor is evaluated separately. in this example 35%. If you where hit for 200 damage and you had this helm, 5% from gloves and 40% from shield, it would calculate: Shield: 80 damage reduced: 120 incoming damage. Helm: 42 damage reduced: 78 incoming damage. Gloves: 4 damage reduced: 74 incoming damage. |
Durability | int | 200 | How many hits armor can take before breaking |
Player Magic Items
A player magic item has to be research to get. Every research complete will give the player another slot to hold another player magic item. These cannot be worn by colonists. They provide special player only boosts. Float values can be made negative to reduce values.
"Pandaros.Settlers.RedLantern": {
"Name": "Pandaros.Settlers.RedLantern",
"isPlaceable": false,
"categories": [ "Lantern" ],
"icon": "./icons/RedLantern.png",
"LightRange": 6,
"LightColor": "#FF5733",
"IsMagical": true
}
Property | Type | Example Value | Description |
---|---|---|---|
IsMagical | bool | true | This should be set to true when creating any Settlers Magic item for the player to wear |
MovementSpeed | float | 1 | Provides extra movement speed to the player (base 5, crouch 2, sprint is 7) only effect base |
JumpPower | float | 1 | Allows the player to jump higher (base 6.5) |
FlySpeed | float | 1 | When flight is enabled, allows the player to fly faster (base 8, sprint is 12) |
LightRange | float | 5 | Number of blocks add to the players light range. base 16) |
LightColor | string | #FF5733 | Hex HTML color |
FallDamage | float | -2 | Reduces/adds base fall damage (base fall damage is 15) |
FallDamagePerUnit | float | -1 | Reduces/adds base fall damage per unit fell (base is 5) |
BuildDistance | float | 1 | Adds to base build distance (base is 5) |