So I just bought cubik studio and the first thing i am making is a paintball resource pack like a gun and mask but after i had made the gun i realized that it will just shoot a gun not a snowball now i am making a map so is it possible to use some thing else and it will summon a snowball? because i rlly want this to work.
-THX Need_Not
-THX Need_Not
Create an account or sign in to comment.
5
1
You will need to use raycasting and a right click detector (unless your gun is a retextured carrot on a stick) which would summon a snowball relative to where you are facing. Unfortunately, you have to be good with commands.
1
ok but do you happen to know the command? if not ill find it
1
A complete raycasting function, just need to fill in the gaps for your specific use
Just fixed it running for multiple entities in the ray. Technically it doesn't actually get the closest to the actual hit point, but it is pretty close
execute as <shooter> at @s anchored eyes positioned ^ ^ ^ anchored feet run function start_ray
# start_ray.mcfunction
tag @s add ray
scoreboard players set #hit temp 0
scoreboard players set #distance temp 0
function ray
tag @s remove ray
# ray.mcfunction
execute unless block ~ ~ ~ #trace_through run function hit_block
execute if score #hit temp matches 0 positioned ~-0.05 ~-0.05 ~-0.05 as @e[tag=!ray,dx=0,sort=nearest] if score #hit temp matches 0 positioned ~-0.85 ~-0.85 ~-0.85 if entity @s[dx=0] run function hit_entity
scoreboard players add #distance temp 1
execute if score #hit temp matches 0 if score #distance temp matches ..<max distance> positioned ^ ^ ^0.1 run function ray
# hit_entity.mcfunction
scoreboard players set #hit temp 1
<your commands for when an entity is hit>
# hit_block.mcfunction
scoreboard players set #hit temp 1
<your commands for when a block is hit>
(edited)12Just fixed it running for multiple entities in the ray. Technically it doesn't actually get the closest to the actual hit point, but it is pretty close
1
btw This was what someone else sent in a command blocking discord (dont know if he is in planet mc)
1
so i would have to manuly add everyone's name?