1. 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!

  2. LOOKING FOR A VERSION OF SKRIPT?

    You can always check out our Wiki for downloads and any other information about Skript!

Dismiss Notice
This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

How to make custom tags to projectiles?

Discussion in 'Skript' started by Davi3684, Dec 29, 2017.

Tags:
Thread Status:
Not open for further replies.
  1. Davi3684

    Davi3684 Member

    Joined:
    Dec 29, 2017
    Messages:
    15
    Likes Received:
    0
    Minecraft Version:1.8
    ---
    Full Code:
    Code (Skript):
    1.  
    2. on join:
    3.     if {bc.rifle.%player%} is not set:
    4.         set {bc.rifle.%player%} to 0
    5.        
    6. command /getweapons:
    7.     trigger:
    8.         if {bc.rifle.%player%} is 0:
    9.             set {bc.r0.ammo.%player%} to 16
    10.             set {bc.r0.leftammo.%player%} to 64
    11.             set {no.ammo.r0.%player%} to 0
    12.             give a wooden pickaxe named "Rifle %{bc.r0.ammo.%player%}%/%{bc.r0.leftammo.%player%}%" to the player
    13.            
    14. on right click:
    15.     if player is holding a wooden pickaxe named "Rifle %{bc.r0.ammo.%player%}%/%{bc.r0.leftammo.%player%}%":
    16.         if {no.ammo.r0.%player%} is 0:
    17.             shoot arrow from player at speed 5
    18.             addTag(last shot arrow, r0)
    19.        
    20.        
    21.  
    22.             set {bc.r0.ammo.%player%} to {bc.r0.ammo.%player%} - 1
    23.             set the name of the player's tool to "Rifle %{bc.r0.ammo.%player%}%/%{bc.r0.leftammo.%player%}%"
    24.            
    25.             if {bc.r0.ammo.%player%} is 0:
    26.                 if {bc.r0.leftammo.%player%} is 0:
    27.                     set {no.ammo.r0.%player%} to 1
    28.                 else:
    29.                     message "Reloading"
    30.                     set the name of the player's tool to "Reloading..."
    31.                     wait 20 ticks
    32.                     set the name of the player's tool to "Reloading.."
    33.                     wait 20 ticks
    34.                     set the name of the player's tool to "Reloading."
    35.                     wait 20 ticks
    36.                     set {bc.r0.leftammo.%player%} to {bc.r0.leftammo.%player%} - 16
    37.                     set {bc.r0.ammo.%player%} to 16
    38.                     set the name of the player's tool to "Rifle %{bc.r0.ammo.%player%}%/%{bc.r0.leftammo.%player%}%"
    39.            
    40.             wait 5 ticks
    41.         else:
    42.             message "Out of ammo"
    43.            
    44.  
    45. on damage:
    46.    
    47.     projectile is a arrow
    48.     hasTag(projectile, r0):
    49.         set damage to 1
    50.  
    51.  
    Code (Skript):
    1.  
    2. on right click:
    3.     if player is holding a wooden pickaxe named "Rifle %{bc.r0.ammo.%player%}%/%{bc.r0.leftammo.%player%}%":
    4.         if {no.ammo.r0.%player%} is 0:
    5.             shoot arrow from player at speed 5
    6.             addTag(last shot arrow, r0)
    7.  
    8. on damage:
    9.    
    10.     projectile is a arrow
    11.     hasTag(projectile, r0):
    12.         set damage to 1
    13.  
    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
     
  2. Selvati

    Selvati Active Member

    Joined:
    Jun 26, 2017
    Messages:
    190
    Likes Received:
    9
    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..
    --- Double Post Merged, Dec 29, 2017, Original Post Date: Dec 29, 2017 ---
    The guy that had the whole uuid of projectile thing solved, removed his post from my thread, so I'm not much help :/
     
  3. Davi3684

    Davi3684 Member

    Joined:
    Dec 29, 2017
    Messages:
    15
    Likes Received:
    0
    Anyways thanks for your time ^^
     
    • Friendly Friendly x 1
  4. it_twit

    it_twit Member

    Joined:
    Jan 26, 2017
    Messages:
    37
    Likes Received:
    3
    Medals:
    add "s around r0 so it's
    Code (Skript):
    1.  
    2. if hasTag(projectile, "r0") is true:
    3.  
    4. and
    5.  
    6. addTag(last shot arrow, "r0")
    7.  
     
  5. Davi3684

    Davi3684 Member

    Joined:
    Dec 29, 2017
    Messages:
    15
    Likes Received:
    0
    upload_2017-12-29_18-38-12.png
    I still get the same error
    --- Double Post Merged, Dec 29, 2017, Original Post Date: Dec 29, 2017 ---
    I found another way to do it:
    Code (Skript):
    1.  
    2. on right click:
    3.     if player is holding a wooden pickaxe named "Rifle %{bc.r0.ammo.%player%}%/%{bc.r0.leftammo.%player%}%":
    4.         if {no.ammo.r0.%player%} is 0:
    5.             shoot arrow from player at speed 5
    6.             set {bc.type.%last shot arrow%} to 1
    7.  
    8. on damage:
    9.    
    10.     projectile is a arrow
    11.     if {bc.type.%projectile%} is 1:
    12.         set damage to 1
    13.  
    Thanks for all the help even though it didn't work I still appreciate your time and support ^^
     
  6. White

    White Well-Known Member

    Joined:
    Jan 26, 2017
    Messages:
    445
    Likes Received:
    25
    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 (Skript):
    1. # Setting a metadata variable
    2. set metadata value "tagName" of projectile to 1
    3.  
    4. # Grabbing variable from metadata
    5. 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.
     
Thread Status:
Not open for further replies.

Share This Page

Loading...