#Generic magic wands datapack to learn
1 messages · Page 1 of 1 (latest)
<@&1201956957406109788>
💬 While you wait, take this time to provide more context and details.
✅ Once your question has been resolved (or you no longer need it), please click Resolve Question or run /resolve
my first thought was setting a scoreboard to idk 20, and in tick, I remove 1 from this scoreboard if the score exceeds 1, but I don't think it would work in multiplayer
that's correct using a score is the best way to make th cooldown work
I think my struggle is making a recursive function that still works for @s
well in your tick function you can run a function as every player like this execute as @a run function example:function
then wouldn't it run for all players ?
yea but it runs once through all the commands for every player thats online so each player basicaly get's it's own copy of that function where @s refrences the current player running the function
np
how could I make a projectile that when you are hit by it, you get some effects
and it also run the command /damage to the hit target
Pretty sure slowcasts can do that? If they can you would probably still use a raycast
do you have any tutorial or anything on slowcast ? I have no idea what it is
Slowcast
>>> This guide is too long for Discord, please follow the link below!.
Raycast
>>> # Raycasting Guide
Raycasting is when we shoot a line from the player's eyes in the direction they are looking. We use this to get what the player is looking at, and do something to it, such as spawning an explosion.
Raycasting is very simple. All we need do is run a recursive function. This function will run at the player's eyes, check if there is a block at ~ ~ ~, and if there is not, then move 0.1 blocks forward and run itself again. This creates a loop, which will eventually hit a block.
start_raycast function:
# Set the distance limit on the raycast. (10 x limit in blocks, so 1000 would be 100 blocks)
scoreboard players set .limit <any objective> 1000
# Start the raycast
execute at @s anchored eyes positioned ^ ^ ^.1 run function <namespace>:raycast
raycast function:
# Remove one from the limit
scoreboard players remove .limit <objective> 1
# Optional - place a particle, to make the raycast leave a trail
particle minecraft:dust 1 0 0 1 ~ ~ ~
# If the raycast has hit a block, do something
execute unless block ~ ~ ~ #<namespace>:pass_through run setblock ~ ~ ~ diamond_block
# If the raycast hasn't hit a block, continue, but only if the limit is 1 or more (1..)
execute if block ~ ~ ~ #<namespace>:pass_through positioned ^ ^ ^0.1 if score .limit <objective> matches 1.. run function <namespace>:raycast```
namespace/tags/block/**pass_through**.json:```
{
"replace": false,
"values": [
"minecraft:air",
"minecraft:cave_air",
"minecraft:void_air"
]
}
This should be it! Make sure you add all the functions, and fill in all the blanks (indicated by <this>). Then, you can run the start_raycast function as a player, and it should work.
ty !
Those 2 should be good
Np
amazing :)
thx you all for helping and answering so fast
No problem
Though I do need to go in 3 minutes so if you have another question for me you should ask now :)
I would need to read what you sent me about slowcast before asking any question
so I'm good rn !
ty :)
Alr
?
is a slowcast more "tps friendly" than tp'ing a marker ?
It might be, but normally a single raycast (typing a marker basically) shouldn't cause too much lag
Tping*
I understood what you meant dw x)
I'm facing an issue
this function works perfectly except for this part
When I do "/execute as <myname> run function wands:particles/fire_particle" in a command block on repeat
it doesn't work
Nvm it works now for some unknown reasons
I can't get this to work for some reasons ?
I pretty much copied functions
and I replaced steps and duration with these values
and when i'm next to a cow, I do
/execute positioned ~ ~1 ~ summon minecraft:marker run function wands:withering_wand/withering_laser/setup_withering_laser
and I don't get the output (that's the end.mcfunction in the tutorial)
I decided to try with the tutorial given on the datapack HUB wiki and I still can't get it too work ?
I don't even get the fire particles :(
I tried to replace the marker with a fireball
and all it does is it creates a bunch of fireball that aren't moving
and I tried to summon a cow where the markers are supposed to be and nothing happens even tho it's supposed to detect a collision with an entity ?
I think you're getting a little too lost in the weeds, and it's making it tough for us to tell exactly where you are and what you want/need.
How about we start from square one. What code do you currently have, what do you want to happen, and what is happening instead?
ok sure !
so, I want a wand that progressively creates a laser that gives a potion effect to the targets it hits
and after X seconds, I want to create a bigger projectile that does damage and apply a stronger potion effect (wither 2 becomes wither 3 for example)
and I was told to use slowcast
so I tried to use the tutorial on the website's wiki
but it's not working
(the files names are terribly long I apologize x))
execute anchored eyes positioned ^ ^ ^.3 summon minecraft:marker run function wands:withering_wand/withering_laser/setup_withering_laser
that's the function which starts when I hold right click for at least more than 1.5s
that's setup_withering_laser.mcfunction
that's temp_tick_withering_laser.mcfunction
duration_withering_laser.mcfunction
step_withering_laser.mcfunction
say kaka
particle flame ~ ~ ~ .1 .1 .1 0 1
execute as @e[type=!player,type=!marker,dx=0] positioned ~-.99 ~-.99 ~-.99 if entity @s[dx=0] positioned ~.99 ~.99 ~.99 unless function wands:withering_wand/withering_laser/hit_withering_laser run kill @n[tag=slowcast]
tp ~ ~ ~
execute if score slowcast.steps temp matches 1.. positioned ^ ^ ^.1 run function wands:withering_wand/withering_laser/step_withering_laser```
(sorry I just figured out how to send text this way)
hit_withering_laser.mcfunction
tellraw @p {"text":"it works"}
Alright, and now try using the summon helpers button. I can try and help later but I don't have time to comb through this super thoroughly right this moment
ok ty !
<@&1166082198152159386> <@&1202694677766348840>
Please note that you still might not immediately get a response since all helpers are human beings and volunteers (and also might be sleeping right now)
Try scrolling up literally at all
#1324676155126845482 message
Ah
I guess I'm just scrapping this one