Im coding the lunge enchantment from the start so entities such as zombies are gonna be able to use lunge enchantment but even tho I only change x and z Motions, it still resets the y motion to 0 so zombie keeps freezing in the air, how can I fix that. Here's the command;
summon minecraft:armor_stand ~ ~ ~ {Tags:[speartarget]}
execute as @e[tag=spearmacezombi] at @s run tp @s ~ ~ ~ facing entity @p[gamemode=!creative,gamemode=!spectator]
execute at @e[tag=spearmacezombi] run tp @e[limit=1,tag=speartarget] ^ ^ 1
execute as @e[tag=speartarget] store result score @s speartargetx run data get entity @s Pos[0] 10
execute as @e[tag=speartarget] store result score @s speartargety run data get entity @s Pos[2] 10
execute as @e[tag=spearmacezombi] store result score @s spearzombix run data get entity @s Pos[0] 10
execute as @e[tag=spearmacezombi] store result score @s spearzombiz run data get entity @s Pos[2] 10
scoreboard players operation @e[tag=speartarget] speartargety -= @e[tag=spearmacezombi] spearzombiz
scoreboard players operation @e[tag=speartarget] speartargetx -= @e[tag=spearmacezombi] spearzombix
execute as @e[tag=speartarget,limit=1] store result entity @e[tag=spearmacezombi,limit=1] Motion[0] double 0.1 run scoreboard players get @s speartargetx
execute as @e[tag=speartarget,limit=1] store result entity @e[tag=spearmacezombi,limit=1] Motion[2] double 0.1 run scoreboard players get @s speartargety
item replace entity @e[tag=spearmacezombi] weapon.mainhand with netherite_spear
kill @e[tag=speartarget]
execute at @e[tag=spearmacezombi] unless entity @a[distance=..3,gamemode=survival] unless entity @a[distance=..3,gamemode=adventure] run schedule function spearmacebot:lunge 7t append
also this command is in the spearmacebot:lunge function so it loops