minecraft-expanded-resource.../data/undeadmaelys-weapons/functions/spawn/magic_missile.mcfunction

23 lines
1.1 KiB
Mcfunction

tellraw @a[scores={me-debugging=1..}] "undeadmaelys-weapons:spawn/magic_missile"
summon minecraft:armor_stand ^ ^ ^1 {Invisible:1b,Marker:1,Tags:["EntityTimer","MagicMissile","Init"]}
# link uid to player
execute at @s as @e[tag=Init] store result score @s me-core_uid run scoreboard players get @p me-core_uid
# init variables
execute as @e[tag=Init] run scoreboard players set @s me-core_entityMT 100
execute as @e[tag=Init] run scoreboard players set @s me-core_entityC1 2
# set CD equal to entity max time
execute at @s as @e[tag=Init] if score @s me-core_uid = @p me-core_uid run scoreboard players operation @p me-weap_staffCD = @s me-core_entityMT
execute at @s as @e[tag=Init] if score @s me-core_uid = @p me-core_uid run scoreboard players operation @p me-weap_staffCD += $10 me-weap_staffCD
# flavour!
execute as @e[tag=Init] run playsound undeadmaelys-weapons:entity.magic_missile.spawn neutral @a ~ ~ ~
playsound undeadmaelys-weapons:entity.magic_missile.die neutral @a ~ ~ ~ 1
# stop projectile from getting any more init data
execute as @e[tag=Init] run tag @s remove Init