Turrets Tutorial: Upgrades
Upgrades Attributes
Upgrades will define the attributes the turret will have at certain level. You can add as many upgrades you want.
Attribute Name
Description
speed
Speed of the turret in seconds.
speed: 3
range
Max distance of the turret in blocks.
range: 16
min_damage
max_damage
Minimum and maximum damage of the turret per shoot. These values
min_damage: 1.5
max_damage: 2
min_heal
max_heal
Minimum and maximum heal of the turret per shoot. These values
min_heal: 1
max_heal: 3
health
Health of the turret. Players can damage turrets using Bows. Turrets can
also be damaged by explosions. If you want the turret to be invulnerable to
any damage, remove this attribute.
health: 100
splash_radius
This attribute will allow the turret to cause damage to nearby entities
at the impact location. The radius is set in blocks.
splash_radius: 2.5
max_targets
How many shoots a Turret can make at the same time. Defaults to 1.
max_targets: 2
accuracy
What is the probability of the turret shooting the entity. The accuracy is represented by a percentage. A 100% percentage indicates that the turret will hit the entity everytime. If you set this to a lower value, the turret will miss some shoots. For turrets with PARABOLIC shoot type, this attribute will only affect the shoot itself but it doesn't mean the shoot will miss the entity and make no damage. If you want the turret to always hit entities, remove this attribute.
accuracy: 85
entity_damage_reduction: "%armor%*0.03+%protection_environmental_level%*0.02"
shield_reduction
This will check if the player is blocking with a shield and reduce the final damage. If you set it to 0.8, it means the damage will be reduced in a 80%. Use values between 0 and 1. This reduction is applied after already applying entity_damage_reduction
if used.
shield_reduction: 0.9
max_ammo
The ammunition limit for this turret upgrade. You must use a multiple of 576 (576, 1152, 1728, etc... Each inventory row will have 576 ammo items).
max_ammo: 2880
money_cost
The cost to upgrade the turret to this level. (Requires Vault)
money_cost: 3000
custom_upgrade_item
custom_upgrade_item:
id: <id>
name: <name>
lore:
- <lore>
custom_block_item
Actions
Turret upgrades can have an extra property called actions. Actions have some properties in common:
Option
Description
duration: 7
Duration of this action in seconds.
probability: 60
Probability (%) of executing this action on every hit.
Potion Effect
This action will apply a potion effect to the hit entity.
Set on fire
This action will set the hit entity on fire.
Freeze
This action will freeze the entity. Only works on 1.17+.
Knockback
This action will push the entity on hit with a certain value.
Entity Damage Reduction
Most of the time you will want turrets to do damage according to the player current armor. If you want so, then you have to add the entity_damage_reduction
option which is a formula. Read below to understand the behavior of this option.
If you don't want damage reduction you can just remove this option.
You can change the formula as you want, just be careful and remember that the value must be greater or equal than 0. Below you can find possible variables to use.
Variable
Description
%armor%
Armor points of the player.
%armor_toughness%
Armor toughness points of the player.
%protection_projectile_level%
Sum of the PROTECTION_PROJECTILE enchantment level of all armor parts.
%protection_environmental_level%
Sum of the PROTECTION_ENVIRONMENTAL enchantment level of all armor parts.
%protection_explosions_level%
Sum of the PROTECTION_EXPLOSIONS enchantment level of all armor parts.
%protection_fire_level%
Sum of the PROTECTION_FIRE enchantment level of all armor parts.
Item Cost
Instead of using Vault and an economy plugin to upgrade turrets, you can do it by adding an item cost, so players will need to pay the upgrade using their items.
Option
Description
id: DIAMOND
Material of the required item. You can find all materiales on these links:
amount: 5
Required amount of this item.
name: "Epic Diamond"
Name of the required item. Don't use color format.
lore:
-"Example lore"
Lore of the required item. Don't use color format.
message_displayname:
"&eDiamond"
Name of the item to display in the upgrade item.
Critical Hit
Option to allow the turret to do a critical shoot, making more damage/healing more.
Last updated