Solved Changing (and "locking") player time without effecting other players.

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

JadedDragoon

Member
Feb 5, 2017
6
2
0
40
This is an old feature of essentials... but I'd rather pour gasoline over myself and light a match than use essentials or any of it's derivatives. I _only_ need the /ptime (day/night) command.

The idea is a command that from the perspective of the player that ran the command it puts the sun overhead and places the daylight ambient light level over the surface of the world. I don't expect it to effect anything other than the apparent position of the sun and the outdoor light level. Hostile mobs will still spawn, sapplings will still refuse to grow (unless they have another light source), etc. Ideally /ptime day would lock the apparent time to daytime, /ptime night would lock it to night time, and /ptime reset would restore the player's perspective to match that of the server.

I can't find anything in the documentation that seems to indicate skript has the power to let me do this but, frankly, the documentation is a bit of a mess and I've been having a fair amount of trouble finding everything. It would be an effect, surely, if it's available at all, but so far I've not been able to find one that does what I need by search. Any chance someone can save me from having to read every single effect one by one to see if it's in there some where?
 
These look like exactly what I need. TY.

Thought I'd already looked through SkQuery's documentation. Apparently, I simply missed it.
[doublepost=1486354871,1486354485][/doublepost]Wait... those are expressions right? Can I "set" expressions? Was under the impression I could only use expressions to retrieve information about something, not change it.
 
Wait... those are expressions right? Can I "set" expressions? Was under the impression I could only use expressions to retrieve information about something, not change it.

It depends on the expression and how it is implemented, but you can certainly set plenty of expressions. How else would you set damage in damage events? Or set a player's tool, or an item's name or lore? Or setting the block at the event-location of a block event? Those are all expressions but they support being set.
 
I see, point taken. I guess, it comes down to try it and see, ty.
[doublepost=1486368425,1486362560][/doublepost]Sharing for anyone that finds this (requires Skript and SkQuery). Works like a charm:

code_language.skript:
options:
    dayTime:    12:00
    nightTime:    0:00

command /ptime:
    description: Displays world and player time.
    permission: skript.playertime.view
    executable by: players
    aliases: /ptv
    trigger:
        message "Your world time is: %time%"
        message "Your player time is: %time of player%"

command /ptday:
    description: Locks player time to day.
    permission: skript.playertime.set
    executable by: players
    aliases: /ptd
    trigger:
        set time of player to {@dayTime}
        message "You are now seeing things from a sunnier perspective!"

command /ptnight:
    description: Locks player time to night.
    permission: skript.playertime.set
    executable by: players
    aliases: /ptn
    trigger:
        set time of player to {@nightTime}
        message "Your outlook just got a little darker..."

command /ptclear:
    description: Sets player time to match world time and unlocks it.
    permission: skript.playertime.set
    executable by: players
    aliases: /ptc
    trigger:
        #Why 6:00? Because cats, that's why.
        set relative time of player to 6:00
        message "It's always good to consider the viewpoints of others."
 
Status
Not open for further replies.