Solved Sleeping bag (I love Tymen van Essen)

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

CringeBoy

Active Member
May 20, 2021
65
0
6
Romania
Is it possible to make a white wool carpet as a sleeping bag? Like you place it and then the sleeping bag will appear in a gui and when you die you can choose to respawn to that sleeping bag with a 180 seconds cooldown.
 
yes. that is possible.

add the placed 'sleeping bag' to a list, pull the locations of that list for your respawn gui. ad a sub variable with time for how long you want it to be on cooldown. remove the location from the list if you break the carpets.

have you tried to code anything yet?
 
yes. that is possible.

add the placed 'sleeping bag' to a list, pull the locations of that list for your respawn gui. ad a sub variable with time for how long you want it to be on cooldown. remove the location from the list if you break the carpets.

have you tried to code anything yet?
I tried, but I actually can't make it cuz I suck, its because I am new to scripts.
 
tbh, im crazy for still trying to help you.

this will make the basic things you wanted. you will still have to add that cooldown timer.
and if you want my code from your other thread to work with a separate entry on the gui there is a quite easy way to do that. but it is better to have that run separately so that if a player choses to close the gui they will still be at some spawn.
i've also added a command to clear all set beds of a player. works only for online players.
destroying a white carpet will also remove the saved spot for any player that has gone offline since setting it.
and you might wanna add logic to add beds to the skript. as they will not show up in the gui.

but honestly, you should try to do some scripting yourself instead of making 8 different threads.

Code:
on player respawn:
    wait 1 tick
    if {sleeproll::%event-player's UUID%::*} is set:
        create new gui with chest inventory with 3 rows named "Sleepingrolls"
        loop integers between 1 and size of {sleeproll::%event-player's UUID%::*}:
            if loop-number < 27:
                set {_loopv} to loop-number
                set {_bedname} to {sleeproll::%event-player's UUID%::%{_loopv}%}'s location
                if loop-number = 1:
                    set {_bedname} to "your most recent bed @ %{_bedname}%"
                edit gui last gui:
                    make gui loop-number - 1 with any bed named "%{_bedname}%":
                        teleport event-player to {sleeproll::%event-player's UUID%::%{_loopv}%}
        open gui last gui to event-player

command /clearbeds [<player=%event-player%>]:
    trigger:
        clear {sleeproll::%arg 1's UUID%::*}

on rightclick:
    if clicked block is white carpet:
        if {sleeproll::%event-player's UUID%::*} does not contain event-block:
            set {sleeproll::%event-player's UUID%::*} to reversed {sleeproll::%event-player's UUID%::*}
            message "set bed %event-location%" to event-player
            add event-block to {sleeproll::%event-player's UUID%::*}
            set {sleeproll::%event-player's UUID%::*} to reversed {sleeproll::%event-player's UUID%::*}

on break of white carpet:
    loop all the offline players:
        if {sleeproll::%loop-offline player's UUID%::*} does not contain event-block:
            loop integers between 1 and size of {sleeproll::%loop-offline player's UUID%::*}:
                if event-block's location is {sleeproll::%loop-offline player's UUID%::%loop-value-2%}'s location:
                    delete {sleeproll::%loop-offline player's UUID%::%loop-value-2%}
                    if size of {sleeproll::%loop-offline player's UUID%::*} < 2:
                        clear {sleeproll::%loop-offline player's UUID%::*}
 
tbh, im crazy for still trying to help you.

this will make the basic things you wanted. you will still have to add that cooldown timer.
and if you want my code from your other thread to work with a separate entry on the gui there is a quite easy way to do that. but it is better to have that run separately so that if a player choses to close the gui they will still be at some spawn.
i've also added a command to clear all set beds of a player. works only for online players.
destroying a white carpet will also remove the saved spot for any player that has gone offline since setting it.
and you might wanna add logic to add beds to the skript. as they will not show up in the gui.

but honestly, you should try to do some scripting yourself instead of making 8 different threads.

Code:
on player respawn:
    wait 1 tick
    if {sleeproll::%event-player's UUID%::*} is set:
        create new gui with chest inventory with 3 rows named "Sleepingrolls"
        loop integers between 1 and size of {sleeproll::%event-player's UUID%::*}:
            if loop-number < 27:
                set {_loopv} to loop-number
                set {_bedname} to {sleeproll::%event-player's UUID%::%{_loopv}%}'s location
                if loop-number = 1:
                    set {_bedname} to "your most recent bed @ %{_bedname}%"
                edit gui last gui:
                    make gui loop-number - 1 with any bed named "%{_bedname}%":
                        teleport event-player to {sleeproll::%event-player's UUID%::%{_loopv}%}
        open gui last gui to event-player

command /clearbeds [<player=%event-player%>]:
    trigger:
        clear {sleeproll::%arg 1's UUID%::*}

on rightclick:
    if clicked block is white carpet:
        if {sleeproll::%event-player's UUID%::*} does not contain event-block:
            set {sleeproll::%event-player's UUID%::*} to reversed {sleeproll::%event-player's UUID%::*}
            message "set bed %event-location%" to event-player
            add event-block to {sleeproll::%event-player's UUID%::*}
            set {sleeproll::%event-player's UUID%::*} to reversed {sleeproll::%event-player's UUID%::*}

on break of white carpet:
    loop all the offline players:
        if {sleeproll::%loop-offline player's UUID%::*} does not contain event-block:
            loop integers between 1 and size of {sleeproll::%loop-offline player's UUID%::*}:
                if event-block's location is {sleeproll::%loop-offline player's UUID%::%loop-value-2%}'s location:
                    delete {sleeproll::%loop-offline player's UUID%::%loop-value-2%}
                    if size of {sleeproll::%loop-offline player's UUID%::*} < 2:
                        clear {sleeproll::%loop-offline player's UUID%::*}
I wouldn't imagine that someone would write that much code just for a random person. Thank you so much, also I am getting 3 errors.
Code:
[ERROR] Can't understand this condition/effect: create new gui with chest inventory with 3 rows named "Sleepingrolls" (sleepingbag.sk, line 4: create new gui with chest inventory with 3 rows named "Sleepingrolls"')

[ERROR] can't understand this condition: 'edit gui last gui' (sleepingbag.sk, line 11: edit gui last gui:')

[ERROR] Can't understand this condition/effect: open gui last gui to event-player (sleepingbag.sk, line 14: open gui last gui to event-player')
 
Status
Not open for further replies.