2

Really need help

User4915207G's Avatar User4915207G12/17/23 2:16 pm
12/30/2023 12:53 am
Loupieur's Avatar Loupieur
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]
Posted by User4915207G's Avatar
User4915207G
Level 1 : New Miner
0

Create an account or sign in to comment.

14

Dinnerwater
12/17/2023 2:20 pm
Level 4 : Apprentice Farmer
Dinnerwater's Avatar
change effect give @e[tag=ber] to effect give @s in all of them
1
User4915207G
12/17/2023 3:06 pm
Level 1 : New Miner
User4915207G's Avatar
only with @s it would work for everyone; with @s and [tag=ber] it doesnt work (i tested with my friend)
1
Dinnerwater
12/17/2023 3:22 pm
Level 4 : Apprentice Farmer
history
Dinnerwater's Avatar
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
execute as @e[scores={health=..15},tag=ber] as @e[scores={health=11..},tag=ber] run <something>to
execute as @e[scores={health=11..15},tag=ber] run <something>this should do what you intended to do and its simpler
1
imalittlhigh
12/17/2023 4:23 pm
Level 62 : High Grandmaster Sweetheart
imalittlhigh's Avatar
pretty sure @s works with selectors
1
Dinnerwater
12/17/2023 6:58 pm
Level 4 : Apprentice Farmer
Dinnerwater's Avatar
yes, yes
it should work, i think i might know what the problem is
1
Dinnerwater
12/17/2023 4:29 pm
Level 4 : Apprentice Farmer
Dinnerwater's Avatar
so you have any idea on why it didnt work for them?
i dont have one myself
1
imalittlhigh
12/18/2023 2:58 am
Level 62 : High Grandmaster Sweetheart
imalittlhigh's Avatar
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
3
User4915207G
12/17/2023 3:57 pm
Level 1 : New Miner
User4915207G's Avatar
ty for help
1
Dinnerwater
12/17/2023 4:06 pm
Level 4 : Apprentice Farmer
Dinnerwater's Avatar
you are welcome
i wish you the best of luck with your data pack
1
User4915207G
12/17/2023 5:26 pm
Level 1 : New Miner
User4915207G's Avatar
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
1
Planet Minecraft

Website

© 2010 - 2024
www.planetminecraft.com

Welcome