#Generic magic wands datapack to learn

1 messages · Page 1 of 1 (latest)

glossy olive
#

I'm making a datapack with wands. So far, I managed to make sure you have to keep pressing your right click to charge the wand before using it, if you stop, you have to restart. What I would like to do is add a cooldown but I don't really know how I could make it

abstract pendantBOT
#

<@&1201956957406109788>

Someone will come and help soon!

💬 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

glossy olive
#

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

amber silo
#

that's correct using a score is the best way to make th cooldown work

glossy olive
#

I think my struggle is making a recursive function that still works for @s

amber silo
#

well in your tick function you can run a function as every player like this execute as @a run function example:function

glossy olive
#

then wouldn't it run for all players ?

amber silo
#

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

glossy olive
#

Oh yeah, I think I understand

#

thx !

amber silo
#

np

glossy olive
#

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

dense coyote
#

Pretty sure slowcasts can do that? If they can you would probably still use a raycast

glossy olive
#

do you have any tutorial or anything on slowcast ? I have no idea what it is

thin sedgeBOT
#

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.

glossy olive
#

ty !

dense coyote
#

Those 2 should be good

dense coyote
glossy olive
#

thx you all for helping and answering so fast

dense coyote
#

No problem

#

Though I do need to go in 3 minutes so if you have another question for me you should ask now :)

glossy olive
#

I would need to read what you sent me about slowcast before asking any question

#

so I'm good rn !

#

ty :)

dense coyote
#

Alr

glossy olive
#

I got a quick question x)

dense coyote
#

?

glossy olive
#

is a slowcast more "tps friendly" than tp'ing a marker ?

dense coyote
#

It might be, but normally a single raycast (typing a marker basically) shouldn't cause too much lag

glossy olive
#

ok !

#

ty

glossy olive
#

I understood what you meant dw x)

glossy olive
#

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

glossy olive
#

Nvm it works now for some unknown reasons

glossy olive
#

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)

glossy olive
#

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 :(

glossy olive
#

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 ?

winter swan
#

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?

glossy olive
#

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"}

winter swan
#

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

glossy olive
#

ok ty !

abstract pendantBOT
# abstract pendant <@&1201956957406109788>

<@&1166082198152159386> <@&1202694677766348840>

🙇 Helpers Arise!

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)

dense coyote
#

?

#

What?

winter swan
#

Try scrolling up literally at all
#1324676155126845482 message

dense coyote
#

Ah

glossy olive
#

I guess I'm just scrapping this one