Help - Immersive Combat
1.20.1
Hey, I'm doing my first datapack (besides epic fight integration). My goal is to enable adventure mode for the player whenever they get damaged by entity or player. So far I have 4 functions:
Continue to help poststart_combat:
gamemode adventure @s
scoreboard players set @s combat_timer 5
tellraw @s [{"text":"You engaged in combat!","color":"red","bold":true}]
end_combat:
gamemode survival @s[scores={combat_timer=0}]
tellraw @s [{"text":"The combat is over!","color":"green","bold":true}]
tick_timer:
scoreboard players remove @s[scores={combat_timer=1..}] combat_timer 1
execute as @s[scores={combat_timer=0}] run function combat_gamemode:end_combat
track_damage:
execute as @s store result score @s combat_timer run data get entity @s DamageTaken
Now, if I call start_combat by command, it sends the message and changes my gamemode to adventure.
However, end_combat never gets called (should be after 5 seconds), and if I call it by command, it doesn't change my gamemode to survival, only sends the message. Thanks in advance:)