For example say zombie has a freeze ability that is level 5
And a player is level 5 i want the freeze stat to do a RNG to see if it works but if the player is level 6 i want it to be harder for it to happen
What's the max level and what's the hit chance? It'll be better to make it a whole number (let's say 50% for identical level, 60% for a lvl 5 vs lvl 6)
2. All players in the world might get hit (you can always change it)
3. It takes 0.5-1.5 seconds to finish the calculations
4. Currently the boss has an ability level of 3
5. Currently all players have an ability level of 7
6. From the level difference, the freeze skill only has 10% to hit a player
Presets
1. scoreboard objectives add b dummy
2. scoreboard objectives add b1 dummy
3. scoreboard objectives add b2 dummy
4. summon zombie ~ ~ ~ {Tags:["boss"]}
5. scoreboard players set @e[tag=boss] b 3
6. scoreboard players set @a b 7
Notices
1. Yes, it's a bit long.
2. Do not change the order except the presets
3. The last 2 commands at the end of Repeating Commands can be changed, added or removed
4. You can always change the commands below to make them trigger certain players only (for example, tagged players)
Repeating Commands
1. tag @a[tag=Freeze_miss] remove Freeze_miss
2. tag @a[tag=Freeze_hit] remove Freeze_hit
3. execute as @e[tag=Freeze_RNG_master] at @s run teleport @s @p
4. execute as @a[scores={b1=1..}] at @s run summon minecraft:area_effect_cloud ~ ~ ~ {Radius:0,Duration:9999999,Tags:["Freeze_RNG","Freeze_RNG_choose","Freeze_RNG_miss"]}
6. execute as @a[scores={b2=1..}] at @s run summon minecraft:area_effect_cloud ~ ~ ~ {Radius:0,Duration:9999999,Tags:["Freeze_RNG","Freeze_RNG_choose","Freeze_RNG_hit"]}
8. execute as @e[tag=Freeze_RNG_choose] at @s run teleport @s @e[limit=1,sort=nearest,distance=..3,tag=Freeze_RNG_Master]
9. execute as @e[tag=Freeze_RNG_master] at @s if entity @a[scores={b1=0,b2=0},distance=..1] run tag @e[tag=Freeze_RNG_choose,limit=1,sort=random,distance=..1] add Freeze_RNG_chosen
10. execute as @e[tag=Freeze_RNG_hit,tag=Freeze_RNG_chosen] at @s run tag @p[scores={b1=0,b2=0},distance=..2] add Freeze_hit
11. execute as @e[tag=Freeze_RNG_miss,tag=Freeze_RNG_chosen] at @s run tag @p[scores={b1=0,b2=0},distance=..2] add Freeze_miss
12. execute as @a[scores={b1=0,b2=0}] at @s run kill @e[tag=Freeze_RNG,distance=..2,limit=11]
13. execute as @a[tag=Freeze_hit] run say HIT!!! Or something else?
14. execute as @a[tag=Freeze_miss] run say Missed. Haha
Impulse Commands On Casting
1. execute as @a run scoreboard players set @s b1 5
2. execute as @a run scoreboard players set @s b2 10
3. execute as @a run scoreboard players operation @s b1 += @s b
4. execute as @a run scoreboard players operation @s b1 -= @e[tag=boss,limit=1] b
5. scoreboard players set @a[scores={b1=..-1}] b1 0
6. scoreboard players set @a[scores={b1=11..}] b1 10
7. execute as @a run scoreboard players operation @s b2 -= @s b1
8. execute as @a at @s run summon minecraft:area_effect_cloud ~ ~ ~ {Radius:0,Duration:9999999,Tags:["Freeze_RNG","Freeze_RNG_master"]}
Tell me if it works or not. And it'll be better if you're able to modify the commands to suit yourself, by yourself.
For example say zombie has a freeze ability that is level 5
And a player is level 5 i want the freeze stat to do a RNG to see if it works but if the player is level 6 i want it to be harder for it to happen
What's the max level and what's the hit chance? It'll be better to make it a whole number (let's say 50% for identical level, 60% for a lvl 5 vs lvl 6)
Alright it'd probably go up too ten
So the probability will be like this:
Same level: 50%
Zombie has +1 level: 60%
Zombie has >5 level: 100%
Player has +1 level: 40%
Player has >5 level: 0%
Does this work to you? Or do you need some adjustments?
Also, how many zombies can use this freeze spell in 1 time?
Ok, got it done.
Assumptions
1. There's only 1 zombie boss
2. All players in the world might get hit (you can always change it)
3. It takes 0.5-1.5 seconds to finish the calculations
4. Currently the boss has an ability level of 3
5. Currently all players have an ability level of 7
6. From the level difference, the freeze skill only has 10% to hit a player
Presets
1. scoreboard objectives add b dummy
2. scoreboard objectives add b1 dummy
3. scoreboard objectives add b2 dummy
4. summon zombie ~ ~ ~ {Tags:["boss"]}
5. scoreboard players set @e[tag=boss] b 3
6. scoreboard players set @a b 7
Notices
1. Yes, it's a bit long.
2. Do not change the order except the presets
3. The last 2 commands at the end of Repeating Commands can be changed, added or removed
4. You can always change the commands below to make them trigger certain players only (for example, tagged players)
Repeating Commands
1. tag @a[tag=Freeze_miss] remove Freeze_miss
2. tag @a[tag=Freeze_hit] remove Freeze_hit
3. execute as @e[tag=Freeze_RNG_master] at @s run teleport @s @p
4. execute as @a[scores={b1=1..}] at @s run summon minecraft:area_effect_cloud ~ ~ ~ {Radius:0,Duration:9999999,Tags:["Freeze_RNG","Freeze_RNG_choose","Freeze_RNG_miss"]}
5. scoreboard players remove @a[scores={b1=1..}] b1 1
6. execute as @a[scores={b2=1..}] at @s run summon minecraft:area_effect_cloud ~ ~ ~ {Radius:0,Duration:9999999,Tags:["Freeze_RNG","Freeze_RNG_choose","Freeze_RNG_hit"]}
7. scoreboard players remove @a[scores={b2=1..}] b2 1
8. execute as @e[tag=Freeze_RNG_choose] at @s run teleport @s @e[limit=1,sort=nearest,distance=..3,tag=Freeze_RNG_Master]
9. execute as @e[tag=Freeze_RNG_master] at @s if entity @a[scores={b1=0,b2=0},distance=..1] run tag @e[tag=Freeze_RNG_choose,limit=1,sort=random,distance=..1] add Freeze_RNG_chosen
10. execute as @e[tag=Freeze_RNG_hit,tag=Freeze_RNG_chosen] at @s run tag @p[scores={b1=0,b2=0},distance=..2] add Freeze_hit
11. execute as @e[tag=Freeze_RNG_miss,tag=Freeze_RNG_chosen] at @s run tag @p[scores={b1=0,b2=0},distance=..2] add Freeze_miss
12. execute as @a[scores={b1=0,b2=0}] at @s run kill @e[tag=Freeze_RNG,distance=..2,limit=11]
13. execute as @a[tag=Freeze_hit] run say HIT!!! Or something else?
14. execute as @a[tag=Freeze_miss] run say Missed. Haha
Impulse Commands On Casting
1. execute as @a run scoreboard players set @s b1 5
2. execute as @a run scoreboard players set @s b2 10
3. execute as @a run scoreboard players operation @s b1 += @s b
4. execute as @a run scoreboard players operation @s b1 -= @e[tag=boss,limit=1] b
5. scoreboard players set @a[scores={b1=..-1}] b1 0
6. scoreboard players set @a[scores={b1=11..}] b1 10
7. execute as @a run scoreboard players operation @s b2 -= @s b1
8. execute as @a at @s run summon minecraft:area_effect_cloud ~ ~ ~ {Radius:0,Duration:9999999,Tags:["Freeze_RNG","Freeze_RNG_master"]}
Tell me if it works or not. And it'll be better if you're able to modify the commands to suit yourself, by yourself.