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

Help with shooting projectiles

Fghj240

Active member
Joined
Jun 5, 2021
Messages
54
Reaction score
8
As I can assume many of you probably did, the first thing I made when I joined was a fireball wand. Problem is when I'm moving at high speed launch location eye doesn't cut it. I end up going too fast and hitting myself in the back with my fireball. Is there a way to make the ball spawn 1 block IN FRONT of my eye location or make the projectile pass through me?

Also, how do I set projectile damage? I tried making a gun that fires fast moving arrows but due to arrow damage being calculated based of velocity the arrows hit much harder than usual. How do I set their damage to a custom amount.

Finally, I've seen in a lot of plots where you can shoot projectiles made of particles. How do I do this?
 
Solution
Question 1.
This can be most easily achieved through variable manipulation.
Set Variable -> Shift Location in Direction. Set a local variable (eg. "Loc") to the eye location shifted 1 block forward. You can use a decimal number here as well to attempt to alleviate the blind spot that this would cause with the wand.

Question 2.
Set Event Damage is on a game action. You can use it paired with an entity tag or name on a projectile with the proj damage player action and that should do the trick there.

Question 3.
First thing I thought of was raycasts. These are achieved by shifting a location rapidly to emulate the effect of a projectile or hitscan weapon. To do this, set a location, repeatedly shift its direction, check for blocks (and...

EarInfection

New member
Overlord
Joined
Jun 8, 2021
Messages
5
Reaction score
2
Question 1.
This can be most easily achieved through variable manipulation.
Set Variable -> Shift Location in Direction. Set a local variable (eg. "Loc") to the eye location shifted 1 block forward. You can use a decimal number here as well to attempt to alleviate the blind spot that this would cause with the wand.

Question 2.
Set Event Damage is on a game action. You can use it paired with an entity tag or name on a projectile with the proj damage player action and that should do the trick there.

Question 3.
First thing I thought of was raycasts. These are achieved by shifting a location rapidly to emulate the effect of a projectile or hitscan weapon. To do this, set a location, repeatedly shift its direction, check for blocks (and stop the repeat if the block location isn't air if you want it to recognize walls), check for players with selections and damage them accordingly, stopping the repeat if the selection size is over however many players you want it to hit at once. Raycasts are best explained in person with another user who knows how to do them and most supports should know what to do there. They're definitely my favorite though lmao
 
Solution

Fghj240

Active member
Joined
Jun 5, 2021
Messages
54
Reaction score
8
Question 1.
This can be most easily achieved through variable manipulation.
Set Variable -> Shift Location in Direction. Set a local variable (eg. "Loc") to the eye location shifted 1 block forward. You can use a decimal number here as well to attempt to alleviate the blind spot that this would cause with the wand.

Question 2.
Set Event Damage is on a game action. You can use it paired with an entity tag or name on a projectile with the proj damage player action and that should do the trick there.

Question 3.
First thing I thought of was raycasts. These are achieved by shifting a location rapidly to emulate the effect of a projectile or hitscan weapon. To do this, set a location, repeatedly shift its direction, check for blocks (and stop the repeat if the block location isn't air if you want it to recognize walls), check for players with selections and damage them accordingly, stopping the repeat if the selection size is over however many players you want it to hit at once. Raycasts are best explained in person with another user who knows how to do them and most supports should know what to do there. They're definitely my favorite though lmao
How does the 2nd question work? Set event damage only works on damage events, and I'm confused about what you meant when you said to "use it paired with an entity tag or name on a projectile with the proj damage player action"
 

ARMcPro

Forum adept
Overlord
Joined
Oct 20, 2020
Messages
1,260
Reaction score
356
How does the 2nd question work? Set event damage only works on damage events, and I'm confused about what you meant when you said to "use it paired with an entity tag or name on a projectile with the proj damage player action"
on Projectile Damage Player Event, put an If Entity or something to detect the bullet with, then place a Game Action -> Event Manipulation -> Set Event Damage and put a number in chest
 

EvilsSouls

Forum adept
Overlord
Joined
Apr 16, 2021
Messages
208
Reaction score
18
on Projectile Damage Player Event, put an If Entity or something to detect the bullet with, then place a Game Action -> Event Manipulation -> Set Event Damage and put a number in chest
Hmm yea, or he could do (it isn't as good, but it still works, just wanted to say it

Player Event: Proj damage Player
Game action: Cancel Event
Player Action: Damage
(Chest paramters: <num of dam>)
 

Fghj240

Active member
Joined
Jun 5, 2021
Messages
54
Reaction score
8
on Projectile Damage Player Event, put an If Entity or something to detect the bullet with, then place a Game Action -> Event Manipulation -> Set Event Damage and put a number in chest
How do I tell which projectile hit? Say I want to have two different arrow launchers that do different damage or I want player arrows to do less damage than skeleton arrows? I guess I could rename the projectile but I don't want text flying everywhere
 

ARMcPro

Forum adept
Overlord
Joined
Oct 20, 2020
Messages
1,260
Reaction score
356
How do I tell which projectile hit? Say I want to have two different arrow launchers that do different damage or I want player arrows to do less damage than skeleton arrows? I guess I could rename the projectile but I don't want text flying everywhere
You can name it and use Set Name Visible, Change the tag inside the chest to Disable, and make the block's target Last Entity Spawned on player shoot event or right click (to change the block's target shit-right click the sign)
 

Fghj240

Active member
Joined
Jun 5, 2021
Messages
54
Reaction score
8
You can name it and use Set Name Visible, Change the tag inside the chest to Disable, and make the block's target Last Entity Spawned on player shoot event or right click (to change the block's target shit-right click the sign)
That didn't work...

Or actually it works with everything except arrows.
 
Last edited:

Fghj240

Active member
Joined
Jun 5, 2021
Messages
54
Reaction score
8
if you are using Player Shoot Event, make the Entity Action's target "Projectile" instead
What no more code is when player right click if player holding item then shift location in direction (variable,current location,1 forwards) then fire projectile (variable [for location] arrow, 50 [for projectile speed]) then set name of entity to AssaultBullet with show name off then set no gravity on the arrow.

then when proj damage player if entity has name assault bullet (shift click selected projectile) then set event damage to 3.

It does a lot more than 3 damage.
 

ARMcPro

Forum adept
Overlord
Joined
Oct 20, 2020
Messages
1,260
Reaction score
356
What no more code is when player right click if player holding item then shift location in direction (variable,current location,1 forwards) then fire projectile (variable [for location] arrow, 50 [for projectile speed]) then set name of entity to AssaultBullet with show name off then set no gravity on the arrow.

then when proj damage player if entity has name assault bullet (shift click selected projectile) then set event damage to 3.

It does a lot more than 3 damage.
huh weird, I just tried it and it works
 
Top Bottom