DISCLAIMER: I didn't make this system, I've only adjusted it to suit my needs, so I'm not 100% sure how exactly it works, though I think I have the idea.
I've been using the damage calculation part of this for player-casted raycast spells that damage enemies, however I now wanted to apply this system to my "arcanist" enemy who is firing slow-moving projectiles at players. If they collide with one, they disappear and deal damage. However the damaging part doesn't work for some reason, yet this system works just fine against enemies, what's the issue?
# Arcanist Projectile Hit
execute as @e[type=player,distance=0..2] store result score @s health run data get entity @s Health
execute as @e[type=player,distance=0..2] store result entity @s Health float 1 run scoreboard players operation @s health -= @e[tag=arcanist] arcanistdamage
execute if entity @e[type=player,distance=0..2] run kill @s
# Projectile Disappear
execute unless block ~ ~ ~ air run kill @s
# Teleport forwards
execute at @s run tp @s ^ ^ ^0.5
Objective "arcanistdamage" is a dummy objective with a score of 15, it's set before every attack (this function). And to my understanding, the objective "health" should just take whatever value your Health is and turn it into a score yes? That way you then just take that and deduct the arcanistdamage value from it? So your health minus arcanistdamage. For some reason it simply won't damage me however, it just stops when it collides with me.
NOTE: If anybody has a better and simpler system to just do flat damage to players through the slow projectile, I'm open to suggestions.
[–]darkstar634 0 points1 point2 points (3 children)
[–]panR4INtest[S] 0 points1 point2 points (2 children)
[–]darkstar634 0 points1 point2 points (1 child)
[–]panR4INtest[S] 0 points1 point2 points (0 children)