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.
#how do i make my shooting prismarine link the mob kill to player?
1 messages · Page 1 of 1 (latest)
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
on death:
victim is a villager
attacker is a player
drop egg at location of victim
idk if this'll work
that is not what im looking for
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
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
nope
are there any errors?
the crystal charge ability doesnt count as a player kill
no
oh thats why
I just realized
uh
yeah.
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 😭
alright
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)
still doesnt work
yeah but you have to define it in the function
the death reason/metadata or smth
how
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
ok i think i know how
make the function
huh
Can you not just do
Make player damage x by y
wdym
what your doing in the function is damage entity by x
you can just do like
make {_p} damage entity by 1
or sum
i also had to remove metadata since player is already the attacker
and it also removes the fact it damages only by hearts and it damages by normal damage now