2
Really need help
So im making somthing like battle royale in dota2 style (in minecraft). I created everything including passive skills, stats and bla bla bla.. Also i made skill for classes in datapacks. For example berserker class - you low on health - you become stronger. And the problem is - if there is two guys with berserker class, and one of them is low hp, and second is full hp - everyone gets buffs - which is bad. I want this class to work individually.
This is code for effects:
execute as @e[scores={health=..15},tag=ber] as @e[scores={health=11..},tag=ber] run effect give @e[tag=ber] speed 1 0 true
execute as @e[scores={health=..10},tag=ber] as @e[scores={health=6..},tag=ber] run effect give @e[tag=ber] strength 1 0 true
execute as @e[scores={health=..10},tag=ber] as @e[scores={health=6..},tag=ber] run effect give @e[tag=ber] speed 1 1 true
execute as @e[scores={health=..10},tag=ber] as @e[scores={health=6..},tag=ber] run effect give @e[tag=ber] hunger 1 1 true
execute as @e[scores={health=..5},tag=ber] as @e[scores={health=2..},tag=ber] run effect give @e[tag=ber] resistance 1 0 true
execute as @e[scores={health=..5},tag=ber] as @e[scores={health=2..},tag=ber] run effect give @e[tag=ber] strength 1 0 true
execute as @e[scores={health=..5},tag=ber] as @e[scores={health=2..},tag=ber] run effect give @e[tag=ber] speed 1 1 true
execute as @e[scores={health=..5},tag=ber] as @e[scores={health=2..},tag=ber] run effect give @e[tag=ber] hunger 1 2 true
execute as @e[scores={health=1},tag=ber] run effect give @e[tag=ber] strength 1 1 true
execute as @e[scores={health=1},tag=ber] run effect give @e[tag=ber] speed 1 1 true
execute as @e[scores={health=1},tag=ber] run effect give @e[tag=ber] hunger 1 32 true[/p]
This is code for effects:
execute as @e[scores={health=..15},tag=ber] as @e[scores={health=11..},tag=ber] run effect give @e[tag=ber] speed 1 0 true
execute as @e[scores={health=..10},tag=ber] as @e[scores={health=6..},tag=ber] run effect give @e[tag=ber] strength 1 0 true
execute as @e[scores={health=..10},tag=ber] as @e[scores={health=6..},tag=ber] run effect give @e[tag=ber] speed 1 1 true
execute as @e[scores={health=..10},tag=ber] as @e[scores={health=6..},tag=ber] run effect give @e[tag=ber] hunger 1 1 true
execute as @e[scores={health=..5},tag=ber] as @e[scores={health=2..},tag=ber] run effect give @e[tag=ber] resistance 1 0 true
execute as @e[scores={health=..5},tag=ber] as @e[scores={health=2..},tag=ber] run effect give @e[tag=ber] strength 1 0 true
execute as @e[scores={health=..5},tag=ber] as @e[scores={health=2..},tag=ber] run effect give @e[tag=ber] speed 1 1 true
execute as @e[scores={health=..5},tag=ber] as @e[scores={health=2..},tag=ber] run effect give @e[tag=ber] hunger 1 2 true
execute as @e[scores={health=1},tag=ber] run effect give @e[tag=ber] strength 1 1 true
execute as @e[scores={health=1},tag=ber] run effect give @e[tag=ber] speed 1 1 true
execute as @e[scores={health=1},tag=ber] run effect give @e[tag=ber] hunger 1 32 true[/p]
Create an account or sign in to comment.
14
change effect give @e[tag=ber] to effect give @s in all of them
only with @s it would work for everyone; with @s and [tag=ber] it doesnt work (i tested with my friend)
the command is already being run by the entities tagged with the tag ber ( execute as @e[scores={health=..15},tag=ber] ), if you use @s they will target themselves, but if you use @e they will target everyone.
@s might not work with target selectors like [tag= ]
also I suggest you change this part of the code and others from
@s might not work with target selectors like [tag= ]
also I suggest you change this part of the code and others from
execute as @e[scores={health=..15},tag=ber] as @e[scores={health=11..},tag=ber] run <something>
toexecute as @e[scores={health=11..15},tag=ber] run <something>
this should do what you intended to do and its simplerpretty sure @s works with selectors
yes, yes
it should work, i think i might know what the problem is
it should work, i think i might know what the problem is
so you have any idea on why it didnt work for them?
i dont have one myself
i dont have one myself
ooh I just assumed from you comment, you got it right ^^
id move the test into another function, and do:
this function:
execute as @e[tag=ber] run function new_funciton
new_function:
execute as @s[scores={health=11..15} run effect give @s bla
execute as @s[scores={health=6..10} run effect give @s bla
execute as @s[scores={health=2..5} run effect give @s bla
execute as @s[scores={health=1} run effect give @s bla
that should work (obv replace the bla with effect stuff ^^)
Honestly if that doesnt work, there may be a problem with something else :D
id move the test into another function, and do:
this function:
execute as @e[tag=ber] run function new_funciton
new_function:
execute as @s[scores={health=11..15} run effect give @s bla
execute as @s[scores={health=6..10} run effect give @s bla
execute as @s[scores={health=2..5} run effect give @s bla
execute as @s[scores={health=1} run effect give @s bla
that should work (obv replace the bla with effect stuff ^^)
Honestly if that doesnt work, there may be a problem with something else :D
view more replies ( 1 )
ty for help
you are welcome
i wish you the best of luck with your data pack
i wish you the best of luck with your data pack
nah, jokes aside, i tested one more time - it doesnt work if i change all @e on @s. Maybe its problem of version? im on 1.20.1
view more replies ( 1 )