As requested, a way to allow randomness in the attacking mobs!
The example code below only gives the chicken 25% of attacking the player once attacked.
Code (YAML):
chance:
percentage
: 25
# How much chance that the mob will attack the player? (in percentage)
duration
: 0
# How long will the mob remember the chance result? (in seconds)
conditions
:
# The conditions which will trigger the chance: (anything from 'attack-conditions')
health-percentage
: 100
Additionally, you may want to use the 'duration' variable, which allows a mob to remember the result of the chance (the "dice roll") so it won't trigger for some seconds. Duration is especially useful in case you used 'distance' as one of the conditions.
In the example below, every minute, the chickens have 1% of attacking a close player
Code (YAML):
chance:
percentage
: 1
duration
: 60
# = 1 minute
conditions:
distance
: 20