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.

Metadata help

Discussion in 'Skript' started by BoatXD, Jul 24, 2017.

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

    BoatXD New Member

    Joined:
    Jul 24, 2017
    Messages:
    6
    Likes Received:
    1
    on place:
    if name of held item contains "IronGolem":
    set {_loc} to location of event-block
    #set event-block to monster spawner
    make player execute command "/setblock ~ ~ ~ minecraft:mob_spawner 0 replace {EntityId:Zombie}"
    message "%entity type of location of event-block%"

    when I do this it sets the block underneath the player to a spider spawner- how can I use randomsk to set the event-block with custom metadata of an IronGolem spawner?
     
  2. ShaneBee

    Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,183
    Likes Received:
    234
    I'm not sure about randomSK, but I got it to work like this. sets the spawner right where the block was placed.
    Code (Skript):
    1. on place:
    2.     if name of held item contains "test":
    3.         set {_x} to the x coordinate of event-location
    4.         set {_y} to the y coordinate of event-location
    5.         set {_z} to the z coordinate of event-location
    6.         make player execute command "/setblock %{_x}% %{_y}% %{_z}% minecraft:mob_spawner 0 replace {SpawnData:{id:Villager_Golem}}"
     
  3. ShaneBee

    Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,183
    Likes Received:
    234
    yeah I ended up finding that out, sorry haha.
    on place:
    if name of held item contains "&c&l&nIron Golem&r &espawner":
    run player command "/setblock %event-block's x coordinate% %event-block's y coordinate% %event-block's z coordinate% minecraft:mob_spawner 0 replace {EntityId:VillagerGolem}" as op
    message "&e&lSPAWNER: &d&o%entity type of location of event-block% &espawner has successfully been placed."
    make console execute command "/execute %player% ~ ~ ~ playsound random.orb %player% ~ ~ ~ 1000 0.1"

    that was my final code
     
    Wynnevir likes this.
Thread Status:
Not open for further replies.

Share This Page

Loading...