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.

Location spawn

Discussion in 'Skript' started by NiklasBroz, Aug 31, 2018.

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

    NiklasBroz Member

    Joined:
    Aug 31, 2018
    Messages:
    4
    Likes Received:
    0
    How do i do so a location spawn cookies forever but if i type /stopcookiespawn it stop spawning them but if i type /togglecookiespawn it spawns again Pls help me ( sorry for bad english )
     
  2. jjpwn1

    jjpwn1 Member

    Joined:
    Aug 18, 2018
    Messages:
    12
    Likes Received:
    8
    Code (Skript):
    1. command /setcookiespawn:
    2.     trigger:
    3.         set {cookie.location} to player's location
    4.         add 1 to y-coord of {cookie.location} #Prevents items from being glitched inside a block
    5.         broadcast "Cookie location set at %{cookie.location}%"
    6.  
    7. command /togglecookiespawn:
    8.     trigger:
    9.         set {cookie.activated} to true if {cookie.activated} is false otherwise false
    10.         broadcast "Cookie Activated: %{cookie.activated}%"
    11.        
    12. every 1 second:
    13.     if {cookie.activated} is true:
    14.         drop 1 cookie at {cookie.location} without velocity
    15.  
    This code will set a location for the cookie to spawn, and spawn cookies at that location every one second. It can be toggled.
     
  3. Efnilite

    Supporter

    Joined:
    May 12, 2018
    Messages:
    218
    Likes Received:
    15
    Medals:
    use list vars kthx bye

    And use this code, way more efficient.
    Code (Skript):
    1.  
    2. command /setcookie:
    3.     trigger:
    4.         set {_x} to location of player
    5.         set y coordinate of {_x} to (y coordinate of {_x} + 1)
    6.         set {cookie::spawn} to {_x}
    7.         broadcast "Cookie spawn has been set at %{_x}%"
    8.         while {cookie::spawn} is set:
    9.             drop 1 cookie at {cookie::spawn}
    10.             wait 1 second
    11.  
    12. command /delcookie:
    13.     trigger:
    14.         delete {cookie::spawn}
    15.         broadcast "RIP cookie spawn"
    Please refrain to using periodical loops, and use while loops instead since they are way better and only need 1 trigger (the command in this case)
     
    #3 Efnilite, Sep 1, 2018
    Last edited: Sep 1, 2018
Thread Status:
Not open for further replies.

Share This Page

Loading...