Solved Shoot arrow that cannot be picked up?

  • 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!

  • LOOKING FOR A VERSION OF SKRIPT?

    You can always check out skUnity Downloads for downloads and any other information about Skript!

Status
Not open for further replies.

SeriousGuy888

Member
Jul 20, 2019
2
0
1
23
Already solved.

Hi. I'm trying to write a guns script. The gun would fire an arrow but I don't want people to be able to pick up those arrows. Is there a way to do that?

Code:
    if player has 1 {@pistolammo}:
        shoot arrow from the player at speed 2
        #I want to make it shoot an arrow that can't be picked up
        remove 1 {@pistolammo} from player

Nevermind. I found a solution.


Code:
on right click with iron hoe:
    name of player's held item is "§rPistol §7(Right Click)"
    cancel event
    if player does not have 1 {@pistolammo}:
        set action bar of player to "§4You do not have ammo!"
    if player has 1 {@pistolammo}:
        shoot an arrow from the player at speed 4
        set {_arrow} to last shot arrow
        remove 1 {@pistolammo} from player
        add "{pickup:0b}" to the nbt of {_arrow}
 
Last edited:
Try with:
code_language.skript:
on pickup:
    if event-item is arrow:
        cancel event
At the moment it is the only way I can think of doing in script.
 
You can do it with skript-mirror, here is a quick little test I did, and it worked
code_language.skript:
import:
    org.bukkit.entity.AbstractArrow$PickupStatus

command /test:
    trigger:
        shoot arrow from the player at speed 2
        set {_a} to last shot arrow
        {_a}.setPickupStatus(PickupStatus.DISALLOWED)
 
Try with:
code_language.skript:
on pickup:
    if event-item is arrow:
        cancel event
At the moment it is the only way I can think of doing in script.
Is there a way I maybe put a tag on the arrow that I spawned and detect that? Or maybe can I can do something with the reason the arrow was spawned like on the Skript documentation where you can detect the reason a mob is spawned.
 
Is there a way I maybe put a tag on the arrow that I spawned and detect that? Or maybe can I can do something with the reason the arrow was spawned like on the Skript documentation where you can detect the reason a mob is spawned.
I didn't try that command. But try using:
code_language.skript:
on pickup:
    if event-item is arrow: # or 'if event-item is a arrow'
        cancel event
[doublepost=1563787989,1563787915][/doublepost]or as ShaneBee said, try using Skript-mirror with the code was he sent.
 
You can do it with skript-mirror, here is a quick little test I did, and it worked
code_language.skript:
import:
    org.bukkit.entity.AbstractArrow$PickupStatus

command /test:
    trigger:
        shoot arrow from the player at speed 2
        set {_a} to last shot arrow
        {_a}.setPickupStatus(PickupStatus.DISALLOWED)
What minecraft version are you using? As skript mirror is not updated as far as I know. Thanks!
 
Status
Not open for further replies.