Ambiental music

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

Simone Dutto

Member
Nov 28, 2020
1
0
1
26
Hi, I'm trying to figure out a way to add custom ambiental music in the game, but i want to make that when a player will be teleported in another world the music stops.

I tried with this:
on join:
chance of 100%:
if player isn't in world "Flat":
wait 1 minute
play sound "MUSIC_DISC.13" in jukebox category at player for player
wait 4 minutes
play sound "MUSIC_DISC.BLOCKS" in jukebox category at player for player
wait 4 minutes
play sound "MUSIC_DISC.MELLOHI" in jukebox category at player for player
wait 3 minutes
play sound "MUSIC_DISC.STAL" in jukebox category at player for player
wait 3 minutes
play sound "MUSIC_DISC.MALL" in jukebox category at player for player
wait 3 minutes
play sound "MUSIC_DISC.WARD" in jukebox category at player for player
wait 3 minutes
play sound "MUSIC_DISC.WAIT" in jukebox category at player for player
wait 10 minutes
if player is in world "Flat":
stop all conditionals

(sorry for my bad english)
 
1. chance of 100% is absolutely unnecessary.
2. I would do something like this:
Code:
on join:
    if player is in "yourworld":
        set {playmusic::%player%} to true
        #play your first song
        wait X minutes
        if {playmusic::%player%} != true:
            stop
        #play your second song
        #...

on world enter:
    if player is in world "yournonmusicworld":
        stop all conditionals #I copied this from your original code, I have never used this expression   
        clear {playmusic::%player%}

on quit:
    if {playmusic::%player%} is set:
        clear {playmusic::%player%}
Additionally, you can play the music again when the player gets to the first world:
Code:
on world enter:
    if player is in world "yourworld":
        set {playmusic::%player%} to true
        #your music code
 
Status
Not open for further replies.