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

Radicc

Member
Oct 7, 2022
17
0
1
18
i tried to make a skript with skulls and when you broke a skull it would rename it to the name it had before it was placed

Rich (BB code):
on place:
    id of event-block = 144
    set {skull::%event-block%} to location of event-block
    set {skull::%event-block%::name} to name of event-block
    set {skull::%event-block%::lore::*} to formatted lore of event-block

    set {_skullnbt::*} to "%nbt of event-block%" split at """"
    set {skull::%event-block%::nbt::id} to {_skullnbt::2}
    set {skull::%event-block%::nbt::value} to {_skullnbt::4}
    set {skull::%event-block%::nbt} to "{SkullOwner:{Id:""%{skull::%event-block%::nbt::id}%"",Properties:{textures:[{Value:""%{skull::%event-block%::nbt::value}%""}]}}}"

on break:
    id of event-block = 144
    set name of event-item to {skull::%event-block%::name}

also tried

Rich (BB code):
on break:
    cancel event
    set {_skull} to player skull with nbt {skull::%event-block%::nbt}
    set name of {_skull} to {skull::%event-block%::name}
    drop {_skull} at player
    set event-block to air
    clear {skull::%event-block%::*}
    delete {skull::%event-block%}

and last there is the lore, for some reason i cant set that either :emoji_slight_smile:
 
i tried to make a skript with skulls and when you broke a skull it would rename it to the name it had before it was placed

Rich (BB code):
on place:
    id of event-block = 144
    set {skull::%event-block%} to location of event-block
    set {skull::%event-block%::name} to name of event-block
    set {skull::%event-block%::lore::*} to formatted lore of event-block

    set {_skullnbt::*} to "%nbt of event-block%" split at """"
    set {skull::%event-block%::nbt::id} to {_skullnbt::2}
    set {skull::%event-block%::nbt::value} to {_skullnbt::4}
    set {skull::%event-block%::nbt} to "{SkullOwner:{Id:""%{skull::%event-block%::nbt::id}%"",Properties:{textures:[{Value:""%{skull::%event-block%::nbt::value}%""}]}}}"

on break:
    id of event-block = 144
    set name of event-item to {skull::%event-block%::name}

also tried

Rich (BB code):
on break:
    cancel event
    set {_skull} to player skull with nbt {skull::%event-block%::nbt}
    set name of {_skull} to {skull::%event-block%::name}
    drop {_skull} at player
    set event-block to air
    clear {skull::%event-block%::*}
    delete {skull::%event-block%}

and last there is the lore, for some reason i cant set that either :emoji_slight_smile:
Maybe instead of checking/setting stuff if a skull is broken or placed you could check something like:

Code:
on pick up:
   if event-item is (Skull Item Here):
      remove 1 of event-item from player's inventory
      set {_item} to event-item
      # Code to set properties of event-item here
      give player 1 of {_item}
 
Maybe instead of checking/setting stuff if a skull is broken or placed you could check something like:

Code:
on pick up:
   if event-item is (Skull Item Here):
      remove 1 of event-item from player's inventory
      set {_item} to event-item
      # Code to set properties of event-item here
      give player 1 of {_item}
But how would i check it's location when it was broken? When i pick it up event-item sends "player head item|s" and event-location would return location it was picked up not where it was broken
 
What was the purpose of the message above me?
that is not the problem, i can cancel event and drop item but the item doesn't get a name when i do it that way either

forgot to click reply so it removed the text when i did
 
that is not the problem, i can cancel event and drop item but the item doesn't get a name when i do it that way either

forgot to click reply so it removed the text when i did
Ohhhh. Give me a bit more time to calibrate the situation because I forgot what this was about.
 
that is not the problem, i can cancel event and drop item but the item doesn't get a name when i do it that way either

forgot to click reply so it removed the text when i did
I think I got it.

Code:
on place:
  if event-block is any skull:
    set {_name} to name of event-block
    add {_name} to {skulln::%player's uuid%::*}
    add event-block to {skull::%player's uuid%::*}

on break:
  set {_eb} to event-block
  loop {skull::%player's uuid%::*}:
    if loop-value is {_eb}:
      cancel event
      set {_item} to loop-index
      set {_name} to {skulln::%player's uuid%::%{_item}%}
      set {_reb} to {_eb} named "%{_name}%"
      drop 1 of {_reb}
 
Last edited:
I think I got it.

Code:
on place:
  if event-block is any skull:
    set {_name} to name of event-block
    add {_name} to {skulln::%player's uuid%::*}
    add event-block to {skull::%player's uuid%::*}

on break:
  set {_eb} to event-block
  loop {skull::%player's uuid%::*}:
    if loop-value is {_eb}:
      cancel event
      set {_item} to loop-index
      set {_name} to {skull::%player's uuid%::%{_item}%}
      set {_reb} to {_eb} with name "%{_name}%"
      drop 1 of {_reb}
Nope, your skript doen't work and i fixed the variable.

the closest i got was
Code:
on place:
    id of event-block = 144
    cancel event
    set {_name} to name of player's held item
    set {skull::%location of event-block%} to location of event-block
    set {skull::%location of event-block%::name} to {_name}
    set {skull::%location of event-block%::lore::*} to formatted lore of event-block
    set {_skullnbt::*} to "%nbt of event-block%" split at """"
    set {skull::%location of event-block%::nbt::id} to {_skullnbt::2}
    set {skull::%location of event-block%::nbt::value} to {_skullnbt::4}
    set {skull::%location of event-block%::nbt} to "{SkullOwner:{Id:""%{skull::%event-block%::nbt::id}%"",Properties:{textures:[{Value:""%{skull::%event-block%::nbt::value}%""}]}}}"
    uncancel event
on break:
    id of event-block = 144
    set name of event-item to {skull::%location of event-block%::name}
    clear {skull::%event-item%::*}
    delete {skull::%event-item%}
(i saved nbt so if i had to cancel event and drop the head i had the skin)
 
Nope, your skript doen't work and i fixed the variable.

the closest i got was
Code:
on place:
    id of event-block = 144
    cancel event
    set {_name} to name of player's held item
    set {skull::%location of event-block%} to location of event-block
    set {skull::%location of event-block%::name} to {_name}
    set {skull::%location of event-block%::lore::*} to formatted lore of event-block
    set {_skullnbt::*} to "%nbt of event-block%" split at """"
    set {skull::%location of event-block%::nbt::id} to {_skullnbt::2}
    set {skull::%location of event-block%::nbt::value} to {_skullnbt::4}
    set {skull::%location of event-block%::nbt} to "{SkullOwner:{Id:""%{skull::%event-block%::nbt::id}%"",Properties:{textures:[{Value:""%{skull::%event-block%::nbt::value}%""}]}}}"
    uncancel event
on break:
    id of event-block = 144
    set name of event-item to {skull::%location of event-block%::name}
    clear {skull::%event-item%::*}
    delete {skull::%event-item%}
(i saved nbt so if i had to cancel event and drop the head i had the skin)
Uncancel event..? Why do you even need to cancel it?
 
If i don't cancel it, name of tool or blocks will return none
Okay, I used java code for this one. Only requirement is skript-reflect.

Code:
import:
  java.lang.System
  java.lang.Object
  java.lang.Enum

import:
  org.bukkit.inventory.meta.SkullMeta

on load:
  add player head to {lv::*}
  add zombie head to {lv::*}
  add dragon head to {lv::*}
  add creeper head to {lv::*}
  add skeleton head to {lv::*}
  add wither skeleton head to {lv::*}

on place:
  if {lv::*} contains event-block:
    set {_name} to name of event-block
    set {_nbtcheck} to event-block.hasOwner()
    if {_nbtcheck} is true:
      set {_nbt} to event-block.getOwningPlayer()
      add {_nbt} to {skullb::%player's uuid%::*}
    else:
      add "false" to {skullb::%player's uuid%::*}
    add {_name} to {skulln::%player's uuid%::*}
    add event-block to {skull::%player's uuid%::*}

on break:
  set {_eb} to event-block
  loop {skull::%player's uuid%::*}:
    if loop-value is {_eb}:
      cancel event
      set {_item} to loop-index
      set {_name} to {skulln::%player's uuid%::%{_item}%}
      set {_reb} to {_eb} named "%{_name}%"
      if {skullb::%player's uuid%::%{_item}%} does not contain "false":
        set {_nbt} to {skullb::%player's uuid%::%{_item}%} parsed as offline player
        {_reb}.setOwningPlayer({_nbt})
      drop 1 of {_reb}