• Hey! Register here to create your account, engage with the community, and talk about what is new!

How do i create a trail of particles that follow the arrow after i shoot the bow and have it stop when the arrow hits something

luapus

New member
Joined
Jul 17, 2021
Messages
3
Reaction score
0
I tried using a "while variable =" block after the "shoot bow event" block and repeatedly create particles at the location of my arrow while the variable = 1. When the arrow hit the ground, the "projectile hit event" block would detect it and change the said variable to 0 which stops the particles. However, to do this i have to use a game variable and not a local variable which means that when one arrow hits the ground all the arrows that i shot out that are still in the air will have its particles stopped. How can i fix this?
 
Solution
luapus your variable on the project block is set to local

the thread ends there

also I dont think %projectile is a thing in variable names but someone else will need to confirm that.

Regardless, you're using a local variable on Shoot Bow, and a local variable on ProjHit.
Both of these variables are confined to their individual thread. Setting "%projectile whatever the variable was called" on ProjHit does not affect ShootBow. Thats why the loop in ShootBow remains 1.

Ive already told you this in-game

in fact, I've already answered this question in-game aswell.

This is why I asked "do you understand how you can take all of the information I gave you, and end up with this solution because if you haven't you have not learnt...

rednax100v2

New member
Joined
Dec 24, 2020
Messages
10
Reaction score
1
luapus your variable on the project block is set to local

the thread ends there

also I dont think %projectile is a thing in variable names but someone else will need to confirm that.

Regardless, you're using a local variable on Shoot Bow, and a local variable on ProjHit.
Both of these variables are confined to their individual thread. Setting "%projectile whatever the variable was called" on ProjHit does not affect ShootBow. Thats why the loop in ShootBow remains 1.

Ive already told you this in-game

in fact, I've already answered this question in-game aswell.

This is why I asked "do you understand how you can take all of the information I gave you, and end up with this solution because if you haven't you have not learnt anything"
and you replied "maybe". Clearly, you haven't learnt anything.


I'll repeat it the solution to your problem again for you though:

when you shoot the bow, use Selection to select every arrow. I've already told you that projectiles are Entities. You can use Select: entities by condition: if the entity: is type -> arrow.

Repeat while the selected size is greater than 1. I've shown you the Selection Size game variable. then, For every target in your selection, display a particle at its location. This part I might have forgotten to give you. You can either use a Process, set to "for each in selection", or just a simple "Repeat for each in list", the list being the UUID's of the current selection. I might have also forgotten to tell you this bit as well, but you need a select inside the loop as well if you're using while Selection Size > 0.

When the arrow hits the floor, it'll automatically be taken out of the selection (assuming the selection is in the loop), and therefore no more particles will be displayed at its location.

When all arrows have hit the floor, the selected size will be 0, and the (now) unnecessary looping will be stopped.

Alternatively, you could put this on a global loop that repeats forever, as you dont need to start or end a loop when new projctiles are created.. Repeating for every projectile in a selection, when the selection is 0, No particles are displayed, but the loop keeps running.


If you require more help, you can ask me to repeat everything to you a third time. Hopefully giving you the answer, without the method of getting there will help you. Since that's how you think that works.

As you should remember, giving a toddler a calculator teaches it, division. Giving it the answers without a method is plenty of teaching enough. Although to be fair, if the toddler has infinite memory, or your toddler is a computer, it can just memorize every possible division scenario, rather than teach it how to actually divide.

Hope this helps :)


[edit]
I just remembered a second method that I use on my own plot, If you know the upper cap on how long the arrow stays airborne, you can just use a Repeat N times loop instead, and not have to deal with all of the complicated selection stuff.

For example, on my plot, I know that a snowball that is fired using game code is going to stay airborne for no longer than3 seconds. So, I have a Repeat N times set to 60, with a delay of 1 tick.

This doesn't look as clean if someone is paying constant attention, as the particles still stay for at most 3 seconds after the snowball hits, but it still works, and the particles are not displayed permanently after the projectile lands.
 
Last edited:
Solution
Top Bottom