How to make custom tags to projectiles?

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

Davi3684

Member
Dec 29, 2017
15
0
0
21
Minecraft Version:1.8
---
Full Code:
code_language.skript:
on join:
    if {bc.rifle.%player%} is not set:
        set {bc.rifle.%player%} to 0
       
command /getweapons:
    trigger:
        if {bc.rifle.%player%} is 0:
            set {bc.r0.ammo.%player%} to 16
            set {bc.r0.leftammo.%player%} to 64
            set {no.ammo.r0.%player%} to 0
            give a wooden pickaxe named "Rifle %{bc.r0.ammo.%player%}%/%{bc.r0.leftammo.%player%}%" to the player
           
on right click:
    if player is holding a wooden pickaxe named "Rifle %{bc.r0.ammo.%player%}%/%{bc.r0.leftammo.%player%}%":
        if {no.ammo.r0.%player%} is 0:
            shoot arrow from player at speed 5
            addTag(last shot arrow, r0)
       
       

            set {bc.r0.ammo.%player%} to {bc.r0.ammo.%player%} - 1 
            set the name of the player's tool to "Rifle %{bc.r0.ammo.%player%}%/%{bc.r0.leftammo.%player%}%"
           
            if {bc.r0.ammo.%player%} is 0:
                if {bc.r0.leftammo.%player%} is 0:
                    set {no.ammo.r0.%player%} to 1
                else:
                    message "Reloading" 
                    set the name of the player's tool to "Reloading..."
                    wait 20 ticks
                    set the name of the player's tool to "Reloading.."
                    wait 20 ticks
                    set the name of the player's tool to "Reloading."
                    wait 20 ticks
                    set {bc.r0.leftammo.%player%} to {bc.r0.leftammo.%player%} - 16
                    set {bc.r0.ammo.%player%} to 16
                    set the name of the player's tool to "Rifle %{bc.r0.ammo.%player%}%/%{bc.r0.leftammo.%player%}%"
           
            wait 5 ticks
        else:
            message "Out of ammo"
           

on damage:
   
    projectile is a arrow
    hasTag(projectile, r0):
        set damage to 1

code_language.skript:
on right click:
    if player is holding a wooden pickaxe named "Rifle %{bc.r0.ammo.%player%}%/%{bc.r0.leftammo.%player%}%":
        if {no.ammo.r0.%player%} is 0:
            shoot arrow from player at speed 5
            addTag(last shot arrow, r0)

on damage:
   
    projectile is a arrow
    hasTag(projectile, r0):
        set damage to 1

Other Useful Info: I keep getting an error that says that addTag(last shot arrow, r0) and hasTag(projectile, r0) is not booleans

I'm using TagAPI, SkRayfall, SkQuerry, SkStuff, Umbaska, and TuSKe




Have you tried searching the docs? Yes
Have you tried searching the forums? Yes
What other methods have you tried to fix it? I've tried many different things but none seems to work
 
Hmm, I don't know much but I remember seeing an advanced skript and they somehow gave projectiles a uuid and tracked it from there, if I find it I'll reply again..
[doublepost=1514568101,1514568013][/doublepost]The guy that had the whole uuid of projectile thing solved, removed his post from my thread, so I'm not much help :/
 
Hmm, I don't know much but I remember seeing an advanced skript and they somehow gave projectiles a uuid and tracked it from there, if I find it I'll reply again..
[doublepost=1514568101,1514568013][/doublepost]The guy that had the whole uuid of projectile thing solved, removed his post from my thread, so I'm not much help :/

Anyways thanks for your time ^^
 
add "s around r0 so it's
code_language.skript:
if hasTag(projectile, "r0") is true:

and

addTag(last shot arrow, "r0")

upload_2017-12-29_18-38-12.png

I still get the same error
[doublepost=1514576850,1514569146][/doublepost]I found another way to do it:
code_language.skript:
on right click:
    if player is holding a wooden pickaxe named "Rifle %{bc.r0.ammo.%player%}%/%{bc.r0.leftammo.%player%}%":
        if {no.ammo.r0.%player%} is 0:
            shoot arrow from player at speed 5
            set {bc.type.%last shot arrow%} to 1

on damage:
   
    projectile is a arrow
    if {bc.type.%projectile%} is 1:
        set damage to 1

Thanks for all the help even though it didn't work I still appreciate your time and support ^^
 
View attachment 1592
I still get the same error
[doublepost=1514576850,1514569146][/doublepost]I found another way to do it:
code_language.skript:
on right click:
    if player is holding a wooden pickaxe named "Rifle %{bc.r0.ammo.%player%}%/%{bc.r0.leftammo.%player%}%":
        if {no.ammo.r0.%player%} is 0:
            shoot arrow from player at speed 5
            set {bc.type.%last shot arrow%} to 1

on damage:
 
    projectile is a arrow
    if {bc.type.%projectile%} is 1:
        set damage to 1

Thanks for all the help even though it didn't work I still appreciate your time and support ^^
While that's an ok method. Using metadatas is a way better because they can be deleted immediately after server restart without having to add a delete method. Metadatas is highly recommended when applying "tags" on blocks, players, and entities. An example is something like this,
code_language.skript:
# Setting a metadata variable
set metadata value "tagName" of projectile to 1

# Grabbing variable from metadata
set {_variable} to metadata value "tagName" of projectile

On the other hand, using default variables on entities and blocks can be a cluster in the variable file (which you do not want) if you forgot to add a delete variable for them. That's why metadatas are preferable because you don't have to add a way of deleting them after not needing them and disappears when a server restarts/shutdown.

And all you need is Skellett to do this.
 
Status
Not open for further replies.