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.

Solved A player head on a fence

Discussion in 'Skript' started by Aralwen, Aug 23, 2018.

Thread Status:
Not open for further replies.
  1. Aralwen

    Aralwen Active Member

    Joined:
    May 26, 2017
    Messages:
    164
    Likes Received:
    14
    Hello, when a player dies, I'm looking to place a fence and over that fence the player's head. I found for the fence, for cons for the player's head, I do not see how to do.

    Questions:
    • How to place the block on the barrier
    • How to define the player's head instead of a basic head
    Code:

    Code (Skript):
    1. on death:
    2.     set {_location} to victim's location
    3.     force victim to respawn
    4.     set {_x} to x coord of {_location}
    5.     set {_y} to y coord of {_location}
    6.     set {_y} to {_y} +1
    7.     set {_z} to z coord of {_location}
    8.     set {_location2} to location {_x}, {_y}, {_z} in world of victim
    9.     set block at {_location} to dark_oak_fence #That work
    10.     set block at {_location2} to player head #That doesn't work and how to define the player's head
    Thank's in advance for helping me !

     
  2. Best Answer:
    Post #12 by jjpwn1, Aug 23, 2018
  3. ShaneBee

    Moderator Resource Staff Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,184
    Likes Received:
    220
    Okay so I searched and I searched and turns out Skript doesn't handle players heads as blocks,... BUT... Skellett does.
    So if you have skellett you can do this
    Code (Skript):
    1. on death:
    2.     set block at victim to dark oak fence
    3.     set block at location above location of victim to floor head
    4.     set skull owner of block at location above location of victim to victim
    5.  
     
  4. Aralwen

    Aralwen Active Member

    Joined:
    May 26, 2017
    Messages:
    164
    Likes Received:
    14
    Thank you very much for your research, the head lands well, but does not display the player's. Moreover, it shows an error in the console

    [​IMG]
     
  5. ShaneBee

    Moderator Resource Staff Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,184
    Likes Received:
    220
    oops... try "on death of player" in stead of "on death"
     
  6. Aralwen

    Aralwen Active Member

    Joined:
    May 26, 2017
    Messages:
    164
    Likes Received:
    14
    Always the same problem
     
  7. ShaneBee

    Moderator Resource Staff Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,184
    Likes Received:
    220
    damn.... it might be an issue with 1.8
     
  8. Aralwen

    Aralwen Active Member

    Joined:
    May 26, 2017
    Messages:
    164
    Likes Received:
    14
    I found how to no longer have the errors in the console : add a wait 1 tick after set block
    By cons the head is still a skeleton head and not that head of the player.
    It must come from the id floor head, but player head doesn't work :/
     
  9. ShaneBee

    Moderator Resource Staff Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,184
    Likes Received:
    220
    Yeah again, i really have no idea... this is why i work with up to date servers... 1.8 seems to have too many problems with skript / plugin development
     
  10. Aralwen

    Aralwen Active Member

    Joined:
    May 26, 2017
    Messages:
    164
    Likes Received:
    14
    I do not like new versions at all :emoji_frowning:
    I will do some research, if ever an idea comes to you, do not hesitate to retort :emoji_slight_smile:
     
  11. ShaneBee

    Moderator Resource Staff Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,184
    Likes Received:
    220
    Will do.... its super hard for me to fix things that aren't working for you if they are working for me... thats the unfortunate part :emoji_frowning:
     
  12. Aralwen

    Aralwen Active Member

    Joined:
    May 26, 2017
    Messages:
    164
    Likes Received:
    14
    Yeah I understand :emoji_frowning:
    Thanks anyway :emoji_grinning:
     
    • Friendly Friendly x 1
  13. jjpwn1

    jjpwn1 Member

    Joined:
    Aug 18, 2018
    Messages:
    12
    Likes Received:
    8
    An easy alternative is to simply use vanilla minecraft's basic fill command:

    Code (Skript):
    1. /fill x1 y1 z1 x2 y2 z2 minecraft:skull 1 replace {SkullType:3, ExtraType:Notch}"
    Where the number "1" represents the orientation of the skull, and "ExtraType" representing the Skull Owner's name.

    The only thing left to do is to integrate this command into Skript, like so:

    Code (Skript):
    1. on death:
    2.     set {_location} to victim's location
    3.     force victim to respawn
    4.     set {_x} to x coord of {_location}
    5.     set {_y} to y coord of {_location}
    6.     set {_y} to {_y} +1
    7.     set {_z} to z coord of {_location}
    8.     set {_location2} to location {_x}, {_y}, {_z} in world of victim
    9.     set block at {_location} to dark_oak_fence #That work
    10.     execute console command "/fill %{_x}% %{_y}% %{_z}% %{_x}% %{_y}% %{_z}% minecraft:skull 1 replace {SkullType:3, ExtraType:%victim%}" #Vanilla work-around
    The only problem with this method is that Mojang will occasionally update the command syntax of it's commands, and so you might have to update it to fit whatever version of Minecraft you're using. This command was tested on 1.12.2.
     
    • Agree Agree x 1
  14. Aralwen

    Aralwen Active Member

    Joined:
    May 26, 2017
    Messages:
    164
    Likes Received:
    14
    It works, thank you very much! (and sorry for the response time)
     
Thread Status:
Not open for further replies.

Share This Page

Loading...