#Damage function causes mobs to drop no loot or xp

1 messages · Page 1 of 1 (latest)

wide moss
#

Minecraft Version: 1.20.2
No Mods or Plugins
Singleplayer

I am attempting to use a raycast function for a "spirit staff" ability in my datapack, and it has shown very inconsistent behavior. When killing individual mobs, it seems to prevent them from dropping items or XP, however when multiple mobs are involved, they will drop their loot and xp inconsistently.

(The following commands are portions of the full functions for the most part)
I have a sub-ticking function that runs the selector for the type of "spell":
execute if entity @s[scores={SR.CustomMain=6,SR.spiritdream=1..}] run function shamanism:staff_effects/aloof/aloof_spells/select

"Select":
execute if entity @s[predicate=!shamanism:is_sneaking] run function shamanism:staff_effects/aloof/aloof_spells/spirit_type

"Spirit Type":
execute if score @s SR.Spirit matches 1 if score @s SR.spiritfraga matches 4.. anchored eyes positioned ^ ^ ^0.5 if block ~ ~ ~ #shamanism:blockignore run function shamanism:staff_effects/aloof/aloof_spells/spirits/polar_bear/swipe_1

"swipe_1":
execute run function shamanism:staff_effects/aloof/aloof_spells/spirits/polar_bear/swipe_2

"swipe_2":

particle sweep_attack ~ ~ ~ 0.15 0.15 0.15 0.15 1 force @a[tag=!global.ignore,tag=!global.ignore.gui,distance=..40]

execute positioned ~-1.5 ~-1.5 ~-1.5 as @e[tag=!SR.spiritraycast,tag=!global.ignore,dx=2,dy=2,dz=2,limit=10] positioned ~1.5 ~1.5 ~1.5 run function shamanism:staff_effects/aloof/aloof_spells/spirits/polar_bear/swipe_effect

scoreboard players add @s SR.range 1

#raycast loop#
execute unless entity @s[scores={SR.range=4..}] if block ~ ~ ~ #shamanism:blockignore positioned ~ ~-0.9 ~ unless entity @e[distance=..0.75,type=!#shamanism:spiritraycastban,tag=!SR.spiritraycast] positioned ^ ^ ^0.9 positioned ~ ~0.9 ~ run function shamanism:staff_effects/aloof/aloof_spells/spirits/polar_bear/swipe_2
tag @s[scores={SR.range=4..}] remove SR.spiritraycast
scoreboard players set @s[scores={SR.range=4..}] SR.range 0```

"Swipe Effect":
```damage @s 6 magic by @p from @p```
mighty violetBOT
#
**Someone will come and help soon!**

💬 While you wait, take this time to provide more context and details. What are you trying to achieve overall - maybe there's an easier way to solve this problem

🙇 If it's been 30 minutes and you're still waiting for someone to help, hit the Summon Helpers button to call the official helpers here

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

wide moss
#

When I test by summoning a cow and using following command, everything seems to work as intended:
/damage @e[type=cow,sort=nearest,limit=1] magic by @s

rapid python
wide moss
#

The command atrributes the damage to the nearest player

rapid python
#

hmmm

rapid python
wide moss
#

Yes, so does this one
execute as @e[type=cow,sort=nearest,limit=1] run damage @s 10 magic by @p

#

Which is essentially the same command that my series of functions is performing

#

execute positioned ~-1.5 ~-1.5 ~-1.5 as @e[tag=!SR.spiritraycast,tag=!global.ignore,dx=2,dy=2,dz=2,limit=10] positioned ~1.5 ~1.5 ~1.5 run damage @s 6 magic by @p even changing it to occur within the raycast function doesn't change the result

#

No loot, no xp

rapid python
#

what

#

thats weird

#

that is so weird

rapid python
wide moss
#

Oh my god

#

Mojang does stupid things, stg

#

THE LIMIT HAS TO BE 1

rapid python
#

ohhhhhhh

rapid python
wide moss
#

yep
execute positioned ~-1.5 ~-1.5 ~-1.5 as @e[tag=!SR.spiritraycast,tag=!global.ignore,dx=2,dy=2,dz=2,limit=1] positioned ~1.5 ~1.5 ~1.5 run function shamanism:staff_effects/aloof/aloof_spells/spirits/polar_bear/swipe_effect works, because I changed the 10 to a 1, even if the limit is 2 is doesn't work properly

rapid python
#

dammm

#

i see

#

so this is practially solved?

wide moss
#

Wait

#

Okay, new weird behavior

#

When I made it use the "swipe_effect" function again, it drops the XP but no loot

rapid python
#

no loot from the cow?

wide moss
#

Okay it... does drop it? It's really inconsistent

#

yeah, it's *extremely inconsistent

rapid python
#

bruhhh

wide moss
#

It's the raycasting function causing the issue for sure