Custom Arrows

Script Custom Arrows 1.0.0

  • Welcome to skUnity!

    Welcome to skUnity! This is a forum where members of the Skript community can communicate and interact. Skript Resource Creators can post their Resources for all to see and use.

    If you haven't done so already, feel free to join our official Discord server to expand your level of interaction with the comminuty!

    Now, what are you waiting for? Join the community now!

Supported Minecraft Versions
  1. 1.18
  2. 1.19
  3. 1.20

This resource allows you to create your own custom arrows easily within minutes.

Installation

Put the script file inside your scripts folder. Requires skript-reflect and SkBee.

Usage

1. Create a custom arrow and register it using the register function. Do not register 2 or more arrows with the same ID or they will be overwritten.
Code:
on load:
  set {_arrow} to arrow named "My Awesome Arrow!"
  registerCustomArrow("awesome", {_arrow}) # "awesome" is the ID

2. (Optional) Create a shoot listener for your custom arrow that will be triggered when an arrow is shot.
Code:
function arrow_awesome_shoot(shooter: player, projectile: entity, bow: item, event: event):
  broadcast {_shooter}
Let's break this down.
We put awesome in the function name because that is the ID of the custom arrow.
{_shooter} is the player who shot the arrow.
{_projectile} is the arrow entity.
{_bow} is the bow/crossbow that was used to shoot the arrow.
{_event} is the raw event that can be used to run methods. If you don't know what this is you probably don't need it.
Keep in mind that you can name the variables whatever you want! You can also not include all of them. Example:
Code:
function arrow_awesome_shoot(shooter: player, projectile: entity, bow: item, event: event): # VALID
function arrow_awesome_shoot(shooter: player, projectile: entity, bow: item): # VALID
function arrow_awesome_shoot(shooter: player, bow: item, projectile: entity): # INVALID, the variables are not in order.

3. (Optional) Create a hit listener for your custom arrow that will be called whenever the arrow hits a block or an entity.
Code:
function arrow_awesome_hit(victim: entity, block: block, event: event):
  broadcast {_victim}
{_victim} is the entity that got hit by the arrow. It may not always be set!!!
{_block} is the block that was hit by the arrow. It may not always be set!!!
{_event} is the raw event that can be used to run methods.

4. Give yourself the arrow.
Code:
give player {custom.arrow::awesome}

Example Implementation

Code:
# Register the arrow
on load:
  set {_arrow} to tipped arrow named "&6&lFire Arrow" with nbt (nbt from "{CustomPotionColor:16741120}") with all flags hidden
  registerCustomArrow("fire", {_arrow})

function arrow_fire_shoot(shooter: player, projectile: entity, bow: item):
  # Punish the player for using the wrong bow
  if {_bow}'s name isn't "&6&lFire Bow":
    ignite {_shooter} for 3 seconds
    send "&cYou burnt yourself while shooting the fire arrow because you aren't using the fire bow." to {_shooter}
 
  # Create particles until it hits the ground
  while {_projectile} isn't on ground:
    wait 1 tick
    play flame at {_projectile}

# When it hits something, create an explosion
function arrow_fire_hit(victim: entity, block: block):
  set {_location} to {_victim} ? {_block}
  create an explosion with strength 10 at {_location} with fire

Result:


Author
erenkara
Downloads
74
Views
1,086
First release
Last update
Rating
5.00 star(s) 2 ratings

More resources from erenkara

Latest reviews

This skript was exactly what i was looking for. I had to sign up just to leave this review, god bless.
erenkara
erenkara
Thank you! ❤️
Always great to see what eren is gonna make next (and then I cry when it gets less downloads than 6 lines of stolen code)
erenkara
erenkara
Thanks for the review! ❤️