#how do i make my shooting prismarine link the mob kill to player?

1 messages · Page 1 of 1 (latest)

fiery flint
#

i made a weapon called "crystal charge" and i made it able to shoot a beam that deals 10 hearts of damage to the player,
i also made a script that if i kill a villager, it will give me an egg named "Hello"
so i tried killing the villager with my crystal charge's beam, it only killed the villager and it didnt give me anything from the kill.

#

here's the full script:

    set {_x} to 1
    set {_l} to 1
    loop {_length} times:
        add 1 to {_x}
        add 1 to {_l}
        set {_rg%{_x}%} to location {_l} meters infront of {_p}
        set {_rg%{_x}%} to location 1 meters above {_rg%{_x}%} #aligns with where player is looking better
    set {_x} to 1
    loop {_length} times:
        add 2 to {_x}
        show 10 aqua dust at {_rg%{_x}%}
        show 30 sonic boom at {_rg%{_x}%}
        loop entities in radius 2 around {_rg%{_x}%}:
            if loop-entity is not player:
                damage loop-entity by 10
                push loop-entity forward at force 0.5
                push loop-entity forward at speed -1
                push loop-entity upward at speed 0.25
            else:
                if loop-entity is player:
                    damage loop-entity by 2.5
                    push loop-entity forward at force -1
                    push loop-entity forward at speed -0.5
                    push loop-entity upward at speed 0.1
                    stop
                    loop blocks in radius 0 around {_rg%{_x}%}:
                        if loop-block is not tall grass, short grass, snow layer, air or water:
                            stop

on right click:
    if name of player's tool contains "Crystal Charge":
        if {crystalcharge.%player's uuid%} is not set:
            set {crystalcharge.%player's uuid%} to 1
            raycast(player, 50, 10)
            play sound "entity.warden.sonic_boom" with volume 0.5 at player
            set item cooldown of player's tool for player to 5 seconds
            wait 5 second
            play sound "BLOCK_AMETHYST_BLOCK_STEP" to player
            send "&b&l&nLIGHTNING CRYSTAL&d Is now available." to player
            clear {crystalcharge.%player's uuid%}```
#
    if victim is villager:
        if attacker is a player:
            if attacker is holding a prismarine shard named "Crystal Charge":
                clear the drops
                chance of 100%
                set {_drop} to egg named "Hello"
                give {_drop} to attacker
                broadcast "Hello"```
#

my main issue is that the kill doesnt count towards the player, ive searched the doc for any possible clue on how to link the beam attack to the player and i cant find anything

ripe scarab
#

idk if this'll work

fiery flint
#

also thats what i wrote

#

and i dont want the item to drop at the location

#

i want it to be given to the player

ripe scarab
# fiery flint that is not what im looking for
on death:
    victim is a villager
    attacker is a player
    if attacker's held item is a prismarine shard named "Crystal Charge":
        clear the drops
        chance of 100%:
            set {_drop} to egg named "Hello"
            give {_drop} to attacker
            broadcast "Hello"
#

try this

#

oops

#

maybe that'll work

fiery flint
#

nope

ripe scarab
#

are there any errors?

fiery flint
#

the crystal charge ability doesnt count as a player kill

fiery flint
ripe scarab
#

I just realized

#

uh

fiery flint
#

yeah.

ripe scarab
#

if im not mistaken

#

(warning: im just a begginer, well not really -anything i say may be false) you can define a reason and in the on death event if thats the reason of death then it'll work

#

I forgot how though, im pretty sure there is a way

#

I used this before for a few things

#

uh ig you'll have to wait for someone more professional than me 😭

fiery flint
#

i think i found a fix

#

but ill do it tmrw

ripe scarab
#

alright

ripe scarab
# fiery flint i think i found a fix

I know I am way too late but you can do something like this:

on death:
  victim is a villager
  if metadata "death_reason" of victim is "crystal charge":
    clear the drops
    chance of 100%:
      set {_drop} to egg named "Hello"
      give {_drop} to attacker
      broadcast "Hello"

you'll still need to define the death reason or wtv (in the function i think)

ripe scarab
#

the death reason/metadata or smth

fiery flint
#

how

ripe scarab
#

thats the problem, I don't know how to do so 😭
try the "fix" you've found tomorrow or wait for someone thats knows more than me

fiery flint
#

ok i think i know how

ripe scarab
#

alright

#

how

fiery flint
#

make the function

ripe scarab
#

huh

fiery flint
#

function death_reason(d: death reason):

#

or smth

ripe scarab
#

I think

#

ye

#

something like that might work, if it doesn't then 🤷‍♂️

tame current
tame current
#

you can just do like

#

make {_p} damage entity by 1

#

or sum

fiery flint
#

tysm

tame current
#

never worth to work harder

fiery flint
#

and it also removes the fact it damages only by hearts and it damages by normal damage now