Metadata help

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

BoatXD

New Member
Jul 24, 2017
6
1
0
24
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?
 
I'm not sure about randomSK, but I got it to work like this. sets the spawner right where the block was placed.
code_language.skript:
on place:
    if name of held item contains "test":
        set {_x} to the x coordinate of event-location
        set {_y} to the y coordinate of event-location
        set {_z} to the z coordinate of event-location
        make player execute command "/setblock %{_x}% %{_y}% %{_z}% minecraft:mob_spawner 0 replace {SpawnData:{id:Villager_Golem}}"
 
I'm not sure about randomSK, but I got it to work like this. sets the spawner right where the block was placed.
code_language.skript:
on place:
    if name of held item contains "test":
        set {_x} to the x coordinate of event-location
        set {_y} to the y coordinate of event-location
        set {_z} to the z coordinate of event-location
        make player execute command "/setblock %{_x}% %{_y}% %{_z}% minecraft:mob_spawner 0 replace {SpawnData:{id:Villager_Golem}}"
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
 
  • Like
Reactions: Wynnevir
Status
Not open for further replies.