LocalPlayer() Issue with Music...

Lord_Kakashi

The Wabbits are attacking
Reaction score
27
Its been a while since I've needed some help from this site, but now is the time i guess, since I'm sort of stuck on this issue.

I tried to search around for a bit, and I saw a post mentioning a tutorial on it, although I haven't been able to find it, even after using the search function..

What i would like to do.. is make a trigger, which allows for players to individually decide if they want the background music on or off..

e.g. Player 1 red types -music off, and it turns off, but for player 1 only!
so players 2,3,4...11 would still be able to listen to it..

At the same time you should of course be able to turn it back on in the same way without it affecting the other players.
Currently this is what i have, but it doesn't work very well. Apart from disabling the music for all players, and starting it again, for all players..

Code:
Turn on
    Events
        Player - Player 1 (Red) types a chat message containing -music on as An exact match
    Conditions
    Actions
        Custom script:   if GetLocalPlayer() == Player(0) then
        Custom script:   call StartSound(udg_music)
        Custom script:   endif
        Game - Display to (Player group((Triggering player))) the text: Music on

Code:
Turn off
    Events
        Player - Player 1 (Red) types a chat message containing -music off as An exact match
    Conditions
    Actions
        Custom script:   if GetLocalPlayer() == Player(0) then
        Custom script:   call StopSoundBJ( udg_music, false )
        Custom script:   endif
        Game - Display to (Player group((Triggering player))) the text: Music off

I only did the triggers for player 1 to test if it worked before applying it to all players.. And it didn't work.. Shut off the music for all players, and turned it back on for all players..

Oh and "udg_music" is a sound variable which I've set at map initialization.
 

Lord_Kakashi

The Wabbits are attacking
Reaction score
27
Isn't it more simple to play a music and to ask to press Ctrl+M to stop playing the music (not sound)?

Maybe but it would be more fun if the other thing was possible :D

and by the way.. they will have to stop the sound as i'm playing the background music as a sound, not as music.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top