Solved Random chest spawn

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

    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.

hasanas

Member
Feb 7, 2017
12
0
0
How would I go about having a chest spawn at a random of 5 different set locations every 3 hours? currently I have this:

command /chestspawn <text>:
usage: /chestspawn 1/2/3/4/5
trigger:
if arg-1 is "1":
set {location.1.chestspawn} to location of player
message "Set chestspawn 1!"
if arg-1 is "2":
set {location.2.chestspawn} to location of player
message "Set chestspawn 2!"
if arg-1 is "3":
set {location.3.chestspawn} to location of player
message "Set chestspawn 3!"
if arg-1 is "4":
set {location.4.chestspawn} to location of player
message "Set chestspawn 4!"
if arg-1 is "5":
set {location.5.chestspawn} to location of player
message "Set chestspawn 5!"

on script load:
every 3 hours set block at {location.1.chestspawn} OR {location.2.chestspawn} OR {location.3.chestspawn} OR {location.4.chestspawn} OR {location.5.chestspawn} to ender chest

The setting of the spawns works fine but I can't get the spawning itself to work :emoji_frowning:

Help would be greatly appreciated! Thank you!
Kind regards, hasanas
 
Your syntax is a bit unclever, use syntaxes like this:

code_language.skript:
command chestspawn <integer>:
    usage: chestspawn <1-5>
    trigger:
        arg 1 is between 1 and 5:
            set {location.%arg 1%.chestspawn} to player's location
            send "Chestspawn %arg 1% created."
            
every 3 hours:
    set {_random} to a random integer between 1 and 5
    set block at {location.%{_random}%.chestspawn} to chest
    broadcast "Chest spawned at %{location.%{_random}%.chestspawn}%"
 
  • Like
Reactions: hasanas
Your syntax is a bit unclever, use syntaxes like this:

code_language.skript:
command chestspawn <integer>:
    usage: chestspawn <1-5>
    trigger:
        arg 1 is between 1 and 5:
            set {location.%arg 1%.chestspawn} to player's location
            send "Chestspawn %arg 1% created."
           
every 3 hours:
    set {_random} to a random integer between 1 and 5
    set block at {location.%{_random}%.chestspawn} to chest
    broadcast "Chest spawned at %{location.%{_random}%.chestspawn}%"

thanks a bunch! I only started since 2 days so it may be a bit unclever :emoji_stuck_out_tongue:
 
Status
Not open for further replies.