Turret upgrades can have an extra property called actions. Actions have some properties in common:
Potion Effect
This action will apply a potion effect to the hit entity.
# In this example you can see that the second upgrade of this turret# will have a 60% probability to apply SLOW effect level 1 for 7# seconds to the hit entity.2:speed:2.5range:13min_damage:8max_damage:15splash_radius:2.5health:70money_cost:1000actions:action1:# Use the following format: # "potion_effect: <potion_effect>;<level>" You can find all# potion effects here: # https://hub.spigotmc.org/javadocs/spigot/org/bukkit/potion/PotionEffectType.htmltype:"potion_effect: SLOW;1"duration:7probability:60
Set on fire
This action will set the hit entity on fire.
actions:action1:# You just need to set the type to "set_on_fire"type:"set_on_fire"duration:5probability:20
Freeze
This action will freeze the entity. Only works on 1.17+.
actions:action1:# You just need to set the type to "set_on_fire"type:"freeze"duration:20probability:10
Knockback
This action will push the entity on hit with a certain value.
actions:action1:# Use the following format:# "knockback: <power>"# This action doesn't require a duration.type:"knockback: 0.5"probability:100
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_reductionoption which is a formula. Read below to understand the behavior of this option.
# The turret normal damage is between 1 and 1.5.# Imagine the player has 20 armor points provided by a full netherite armor# without enchantments. This means, the entity damage reduction for this# case will be: 20 * 0.03 + 0 * 0.03 = 0.6# <20> representing the armor points and <0> meaning the armor doesn't have# the projectile protection enchantment.# The <0.6> final value means that the player will reduce the turret damage# by a 60%. If the turret damages 1.2, the player will receive 0.48 damage.# Now, what if the player has full netherite armor but all parts of this# armor have the Projectile Protection Enchantment at level 4?# The %protection_projectile_level% in this case will be# 4+4+4+4 = 16 (since we are adding the level of all armor parts).# Now the formula will be:# 20 * 0.03 + 16 * 0.03 = 0.6 + 0.48 = 1.08# This indicates that the damage will be reduced in a 108%. Since that's not# possible, the damage is reduced by a 100% meaning the player doesn't# take damage.upgrades:1:speed:0.75range:10min_damage:1max_damage:1.5health:50entity_damage_reduction:"%armor%*0.03+%protection_projectile_level%*0.03"money_cost:0
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.
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.
# In this example you can see that x5 Diamonds and x10 Iron Ingots are# necessary to upgrade this turret to level 2.2:speed:5range:6min_heal:3max_heal:5max_targets:3health:70item_cost:item1:id:DIAMONDmessage_displayname:"&eDiamond"amount:5item2:id:IRON_INGOTmessage_displayname:"&eIron Ingot"amount:10
Critical Hit
Option to allow the turret to do a critical shoot, making more damage/healing more.
3:speed:0.25range:14min_damage:2max_damage:3health:100money_cost:3000critical_hit:# Chance in % of this critical hitchance:60# Damage when doing a critical hit insteadmin_damage:4max_damage:8# Heal when doing a critical hit instead. Of course, use# these values instead only when the turret heals allies.min_heal:2max_heal:4
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.
This is a formula that will be applied everytime a player or entity gets damaged by a turret, and will reduce the damage taken by checking the entity armor. More info HERE.
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)