#Unable to apply effects on enemies when using custom sword data

1 messages · Page 1 of 1 (latest)

spring blaze
#

Cannot figure out how to apply effects on other players using this datapack I've made

worn swanBOT
#

<@&1201956957406109788>

Someone will come and help soon!

💬 While you wait, take this time to provide more context and details.

🙇 If nobody has answered you by <t:1736506096:t>, feel free to use the Summon Helpers button to ping our helper team.

✅ Once your question has been resolved (or you no longer need it), please click Resolve Question or run /resolve

spring blaze
#

these are the errors I currently have

#

[{
"resource": "/c:/Users/willb/AppData/Roaming/.minecraft/saves/New World (1)/datapacks/heros_weapons/data/heros_weapons/advancement/deal_damage.json",
"owner": "generated_diagnostic_collection_name#2",
"severity": 4,
"message": "Cannot find function “heros_weapons:deal_damage” (rule: undeclaredSymbol)",
"source": "spyglassmc(1.21.4)",
"startLineNumber": 8,
"startColumn": 22,
"endLineNumber": 8,
"endColumn": 47
},{
"resource": "/c:/Users/willb/AppData/Roaming/.minecraft/saves/New World (1)/datapacks/heros_weapons/data/heros_weapons/predicate/holding_item/legendary_wither_sword.json",
"owner": "generated_diagnostic_collection_name#2",
"severity": 4,
"message": "Unknown key “equiptment”",
"source": "spyglassmc(1.21.4)",
"startLineNumber": 5,
"startColumn": 9,
"endLineNumber": 5,
"endColumn": 21
}]

tawdry heath
#

How are you currently applying the effect?

spring blaze
#

Im not sure how all this works tbh I'm new to coding and have been doing this to learn but heres one of the spots I think it could be

tag @s add attacker
advancement revoke @s only heros_weapons:deal_damage

#Legendary Wither Sword
execute if predicate heros_weapons:holding_item/legendary_wither_sword as @e[type=#heros_weapons:mobs, distance=..10, nbt={HurtTime:10s}, tag=!attacker] at @s run function heros_weapons:swords/legendary_wither_sword

tag @s remove attacker

#

and heres the effects file

tawdry heath
#

Ok I would use an enchantment instead

spring blaze
#

Handles abilities for Legendary Wither Sword

particle campfire_signal_smoke ~ ~1 ~ 0 0 0 0.02 30 force
playsound entity.wither.death master @a ~ ~ ~ 1 1
effect give @s slowness 5 2 true

Tagging entity with legendary_wither_sword

tag @s add Hit_by_legendary_wither_sword

spring blaze
spring blaze
tawdry heath
spring blaze
#

what would I do for those?

tawdry heath
#

You would probably make the enchantment run a function which did those

#

Actually no, you can do both with enchantments

spring blaze
#

I'll look into this

#

thanks! 🙂

#

last question tho is there a way to make an enchantment invisible to other players?

tawdry heath
#

What do you mean by other players?

spring blaze
#

just is on the weapon

#

but not able to be seen

#

?

tawdry heath
#

You can disable all enchantments, but not individual ones, unfortunately

spring blaze
#

aight

#

I'll just leave it as visible

#

thanks anyways! 🙂