#How do I make the projectile apply potion effects to anything they hit?

1 messages · Page 1 of 1 (latest)

grave dome
#

Title says it all. I've tried plenty of things, even the "potion_effect" parameter, but nothing seems to work. In the latest iteration I tried to make the projectile run an event on hit that would run the two commands on the targets that the projectile hits. It still doesn't work. I don't know what I'm doing wrong here.

#
                "on_hit": {
                    "impact_damage": {
                        "damage": 6,
                        "knockback": true,
                        "semi_random_diff_damage": false
                    },
                    "definition_event": {
                        "affect_target": true,
                        "event_trigger": {
                            "event": "redsmod_stun",
                            "target": "self"
                        }
                    }```

```"events": {
            "redsmod_stun": {
                "run_command": {
                    "target": "self",
                    "command": [
                        "effect @s slowness 5 20 true",
                        "effect @s weakness 5 20 true"
                    ]
                }
            }
        }```
upbeat zodiac
#

You'll need to take out remove_on_hit, it will stop event's from running, also, the event is running the command on the projectile not the target, for that to work on the target, you'll need to change "target" to other.

grave dome
#

ohhhhhh

#

I do have remove_on_hit removed

#

cause I want to add this effect to a blunderbuss, which needs to hit multiple entities at once

#

let me try that

#

hmm, doesn't seem to work

#

the zombies keep coming towards me at the same speed

upbeat zodiac
#

You could also try using mob_effect with a small range and then instant despawn after

grave dome
#

tried it, but doesn't seem to work

#

like, the projectile hits, it deals damage, but none of the effects are being applied, not through "potion_effect" parameter, not through events

#

mob_effect doesn't work either

grave dome
#

I couldn't get this to work, but here's a workaround instead(must be done in the item that's actually launching the projectile)
in the item components the event is ran:

                "on_use": {
                    "event": "redsmod_blunderbuss"
                }
            }```
and then the event itself:
```"events": {
            "redsmod_blunderbuss": {
                "shoot": {
                    "projectile": "redsmod:iron_blunderbuss_bullet.entity",
                    "launch_power": 3.0,
                    "target": "self"
                },
                "damage": {
                    "type": "durability",
                    "amount": 1,
                    "target": "self"
                },
                "run_command": {
                    "command": [
                        "playsound random.explode @p ~ ~ ~ 9",
                        "tag @e[r=8,c=3,family=monster] add stuntarget",
                        "effect @e[tag=stuntarget] slowness 5 20",
                        "effect @e[tag=stuntarget] weakness 5 20",
                        "tag @e[r=8,c=3,family=monster] remove stuntarget"
                    ]
                }
            }
        }```
#

it's got unintended effects, like the blunderbuss "stunning" enemies behind the user, but that's the sacrifice with this workaround

slender saddle
#

You are doing it complicatedly wrong. Check shulker bullet for reference.

grave dome
slender saddle
#

No. Just follow how it is implemented.

#

You were saying it wasn't working without even showing how you did it.

grave dome
#

the only difference between the shulker_bullet file and my projectile with mob_effect on, besides the fact that I don't want homing or particles on it or for it to be removed on hit so it can hit multiple targets, is that shulker_bullet is using the 1.10.0 format

#

so I'm guessing it's a format_version issue?

#
    "format_version": "1.10.0",
    "minecraft:entity": {
        "description": {
            "identifier": "redsmod:iron_blunderbuss_bullet.entity",
            "is_spawnable": false,
            "is_summonable": true,
            "is_experimental": true,
            "runtime_identifier": "minecraft:snowball"
        },
        "components": {
            "minecraft:collision_box": {
                "width": 20.00,
                "height": 5.00
            },
            "minecraft:projectile": {
                "on_hit": {
                    "impact_damage": {
                        "damage": 12,
                        "knockback": true,
                        "semi_random_diff_damage": false
                    },
                    "mob_effect": {
                        "effect": "slowness",
                        "durationeasy": 5,
                        "durationnormal": 5,
                        "durationhard": 5,
                        "amplifier": 20
                    }
                },
                "power": 1.0,
                "gravity": 0.5,
                "multiple_targets": true,
                "inertia": 1.0,
                "liquid_inertia": 0.1,
                "anchor": 2,
                "offset": [
                    0,
                    0,
                    0
                ],
                "semi_random_diff_damage": true,
                "uncertainty_base": 0.0,
                "reflect_on_hurt": false
            },
            "minecraft:conditional_bandwidth_optimization": {
                "default_values": {
                    "max_optimized_distance": 80.0,
                    "max_dropped_ticks": 7,
                    "use_motion_prediction_hints": true
                }
            }
        }
    }
}```
#

here's the projectile, it literally just refuses to add the effect to whatever it hits

slender saddle
#

Can you confirm that it doesn't apply affect? How about changing the effect to levitation so it will be more visible.

grave dome
#

Well, the Husks are not brought to a standstill, unlike with the /effect command

#

Levitation works

#

slowness just doesn't seem to do it

#

supposed to bring them to a standstill but they just keep moving at a normal speed

slender saddle
#

Try to reduce the amplifier like 5 only