Play music only to one player?

nabbig2

New Member
Reaction score
43
Code:
playmusic1
    Events
        Player - Player 1 (Red) types a chat message containing -song1 as An exact match
    Conditions
    Actions
        Set Player1music = Player 1 (Red)
        Custom script:   call StartSoundForPlayerBJ(GetOwningPlayer(GetTriggerUnit()),gg_snd_PH1)

Still says error.......................oh geez...:banghead:
 

vypur85

Hibernate
Reaction score
803
Code:
Custom script:   call StartSoundForPlayerBJ(GetOwningPlayer(GetTriggerUnit()),[B]gg_snd_PH1[/B])

That's because the bolded sound doesn't exist in the sound editor. (Edit: Actually I'm not sure about this. Probably it's because it's considered as 3D sound).


Try this:
Code:
Melee Initialization
    Events
        Player - Player 1 (Red) skips a cinematic sequence
    Conditions
    Actions
        Custom script:   call StartSoundForPlayerBJ (GetTriggerPlayer(), gg_snd_[B]RainOfFireLoop1[/B])

Copy the exact trigger above. (For the custom script, just copy and paste, MAKE SURE it's exact =.=). Then, go to the SOUND EDITOR.

1. Go to the Abilities folder.
2. Then Spells folder.
3. Then Demon folder.
4. Then select RainOfFireLoop1.
5. Right-click then select Use as Sound.
6. You will see something is created on your right hand side panel named RainOfFireLoop1.wav. Now double-click this and unselect 3D Sound.
7. Test the game. Press Escape. See if the sound plays.

If it still doesn't play or show an error script, paste your CURRENT trigger here again. Don't quote my trigger. I want your trigger.
 

wraithseeker

Tired.
Reaction score
122
Use get local player = 0 which is player red i think jass follows by 0 = red 1 = blue go read up on the tutorial submission area, there is a get local player tutorial or just post this on the jass help asking them how do you play a sound with get local player im positive this can only be done in get local player =D
 

nabbig2

New Member
Reaction score
43
Code:
Custom script:   call StartSoundForPlayerBJ(GetOwningPlayer(GetTriggerUnit()),[B]gg_snd_PH1[/B])

That's because the bolded sound doesn't exist in the sound editor. (Edit: Actually I'm not sure about this. Probably it's because it's considered as 3D sound).


Try this:
Code:
Melee Initialization
    Events
        Player - Player 1 (Red) skips a cinematic sequence
    Conditions
    Actions
        Custom script:   call StartSoundForPlayerBJ (GetTriggerPlayer(), gg_snd_[B]RainOfFireLoop1[/B])

Copy the exact trigger above. (For the custom script, just copy and paste, MAKE SURE it's exact =.=). Then, go to the SOUND EDITOR.

1. Go to the Abilities folder.
2. Then Spells folder.
3. Then Demon folder.
4. Then select RainOfFireLoop1.
5. Right-click then select Use as Sound.
6. You will see something is created on your right hand side panel named RainOfFireLoop1.wav. Now double-click this and unselect 3D Sound.
7. Test the game. Press Escape. See if the sound plays.

If it still doesn't play or show an error script, paste your CURRENT trigger here again. Don't quote my trigger. I want your trigger.

Okay, that does work, thankyou Vipur. Now, how do I get my song to work?
 

Chocobo

White-Flower
Reaction score
409
Do you want it as a music or a sound.


MUSIC :
JASS:
function StartMusicLocal takes player p,string s returns nothing
    if p==GetLocalPlayer() then
        call PlayMusic(s)
    endif
endfunction

function LocalMusic takes nothing returns nothing
    call StartMusicLocal(GetTriggerPlayer(),"war3mapImported\\bgm.mp3")
    //for 1 "\" you must use "\\", ex: path is war3mapImported\bgm.mp3, you have to use "war3mapImported\\bgm.mp3"
endfunction

function InitTrig_Test takes nothing returns nothing
    local trigger t=CreateTrigger()
    call TriggerRegisterPlayerEventEndCinematic(t,Player(0))
    call TriggerAddAction(t,function LocalMusic)
endfunction


SOUND :
JASS:
function LocalMusic takes nothing returns nothing
    local sound s //just for test it points to no string
    call StartSoundForPlayerBJ(GetTriggerPlayer(),s)
    //put the variable that handles the sound "s"
endfunction

function InitTrig_Test takes nothing returns nothing
    local trigger t=CreateTrigger()
    call TriggerRegisterPlayerEventEndCinematic(t,Player(0))
    call TriggerAddAction(t,function LocalMusic)
endfunction
 

Cokemonkey11

New Member
Reaction score
18
remove the udg_

udg_ stands for "user defined variable". It's so that the variables you create in the globals area can't interfere syntax-wise with the globals in the game.

thats confusing, I assume UDG is user definined globalvariable? or something?
 

nabbig2

New Member
Reaction score
43
Do you want it as a music or a sound.


MUSIC :
JASS:
function StartMusicLocal takes player p,string s returns nothing
    if p==GetLocalPlayer() then
        call PlayMusic(s)
    endif
endfunction

function LocalMusic takes nothing returns nothing
    call StartMusicLocal(GetTriggerPlayer(),"war3mapImported\\bgm.mp3")
    //for 1 "\" you must use "\\", ex: path is war3mapImported\bgm.mp3, you have to use "war3mapImported\\bgm.mp3"
endfunction

function InitTrig_Test takes nothing returns nothing
    local trigger t=CreateTrigger()
    call TriggerRegisterPlayerEventEndCinematic(t,Player(0))
    call TriggerAddAction(t,function LocalMusic)
endfunction


SOUND :
JASS:
function LocalMusic takes nothing returns nothing
    local sound s //just for test it points to no string
    call StartSoundForPlayerBJ(GetTriggerPlayer(),s)
    //put the variable that handles the sound "s"
endfunction

function InitTrig_Test takes nothing returns nothing
    local trigger t=CreateTrigger()
    call TriggerRegisterPlayerEventEndCinematic(t,Player(0))
    call TriggerAddAction(t,function LocalMusic)
endfunction

Thanks, I did the music one, but it does nothing. That's all I paste into the code, right? I think I am doing something wrong.
 

saw792

Is known to say things. That is all.
Reaction score
280
You don't paste that code into the Custom Script action. If you want to use the music code make a new blank trigger and call it Test. Then go to Edit > Convert to Custom Text, and delete everything that appears. Then paste the music code into the blank space there.

Replace "war3mapImported\\bgm.mp3" with the filename of your imported music (using a double slash as the comment says, and remembering it must be between " ").

If you want to rename the trigger you must also change one other part of the code, the part where it says 'InitTrig_Test'. Replace that with 'InitTrig_NewName' with spaces replaced by underscores.
 

nabbig2

New Member
Reaction score
43
The trigger's name is "g". I tried this, but it says error....


Code:
function Trig_g_Actions takes nothing returns nothing
endfunction

//===========================================================================
function InitTrig_g takes nothing returns nothing
    set gg_trg_g = CreateTrigger(  )
    call TriggerAddAction( gg_trg_g, function Trig_g_Actions )
endfunction

function StartMusicLocal takes player p,string s returns nothing
    if p==GetLocalPlayer() then
        call PlayMusic(s)
    endif
endfunction

function LocalMusic takes nothing returns nothing
    call StartMusicLocal(GetTriggerPlayer(),"war3mapImported\\PH1.mp3")
    //for 1 "\" you must use "\\", ex: path is war3mapImported\PH1.mp3, you have to use "war3mapImported\\bgm.mp3"
endfunction

function InitTrig_g takes nothing returns nothing
    local trigger t=CreateTrigger()
    call TriggerRegisterPlayerEventEndCinematic(t,Player(0))
    call TriggerAddAction(t,function LocalMusic)
endfunction
 

nabbig2

New Member
Reaction score
43
So it would look like this? It says error again...:banghead:

Code:
//===========================================================================
function InitTrig_g takes nothing returns nothing
    set gg_trg_g = CreateTrigger(  )
    call TriggerAddAction( gg_trg_g, function Trig_g_Actions )
endfunction

function StartMusicLocal takes player p,string s returns nothing
    if p==GetLocalPlayer() then
        call PlayMusic(s)
    endif
endfunction

function LocalMusic takes nothing returns nothing
    call StartMusicLocal(GetTriggerPlayer(),"war3mapImported\\PH1.mp3")
    //for 1 "\" you must use "\\", ex: path is war3mapImported\PH1.mp3, you have to use "war3mapImported\\bgm.mp3"
endfunction

function InitTrig_g takes nothing returns nothing
    local trigger t=CreateTrigger()
    call TriggerRegisterPlayerEventEndCinematic(t,Player(0))
    call TriggerAddAction(t,function LocalMusic)
endfunction

(Thanks for helping by the way.......)
 

saw792

Is known to say things. That is all.
Reaction score
280
You didn't delete everything from the box before you pasted. It must be empty first.
 

DiDdY

New Member
Reaction score
14
Code:
function Trig_g_Actions takes nothing returns nothing
endfunction

//===========================================================================
function InitTrig_g takes nothing returns nothing
    set gg_trg_g = CreateTrigger(  )
    call TriggerAddAction( gg_trg_g, function Trig_g_Actions )
endfunction

function StartMusicLocal takes player p,string s returns nothing
    if p==GetLocalPlayer() then
        call PlayMusic(s)
    endif
endfunction

function LocalMusic takes nothing returns nothing
    call StartMusicLocal(GetTriggerPlayer(),"war3mapImported\\PH1.mp3")
    //for 1 "\" you must use "\\", ex: path is war3mapImported\PH1.mp3, you have to use "war3mapImported\\bgm.mp3"
endfunction

function InitTrig_g takes nothing returns nothing
    local trigger t=CreateTrigger()
    call TriggerRegisterPlayerEventEndCinematic(t,Player(0))
    call TriggerAddAction(t,function LocalMusic)
endfunction

So it would look like this? It says error again...:banghead:

Code:
//===========================================================================
function InitTrig_g takes nothing returns nothing
    set gg_trg_g = CreateTrigger(  )
    call TriggerAddAction( gg_trg_g, function Trig_g_Actions )
endfunction

function StartMusicLocal takes player p,string s returns nothing
    if p==GetLocalPlayer() then
        call PlayMusic(s)
    endif
endfunction

function LocalMusic takes nothing returns nothing
    call StartMusicLocal(GetTriggerPlayer(),"war3mapImported\\PH1.mp3")
    //for 1 "\" you must use "\\", ex: path is war3mapImported\PH1.mp3, you have to use "war3mapImported\\bgm.mp3"
endfunction

function InitTrig_g takes nothing returns nothing
    local trigger t=CreateTrigger()
    call TriggerRegisterPlayerEventEndCinematic(t,Player(0))
    call TriggerAddAction(t,function LocalMusic)
endfunction

(Thanks for helping by the way.......)

delete the first InitTrig_g function

Tell me, did you delete the first InitTrig_g function?

Code:
function Trig_g_Actions takes nothing returns nothing
endfunction

To me it seems as if you deleted the first Trig_g_Actions function. Try deleting the right thing please.

Code:
function Trig_g_Actions takes nothing returns nothing
endfunction

//===========================================================================
[COLOR="Red"]function InitTrig_g takes nothing returns nothing
    set gg_trg_g = CreateTrigger(  )
    call TriggerAddAction( gg_trg_g, function Trig_g_Actions )
endfunction[/COLOR]

function StartMusicLocal takes player p,string s returns nothing
    if p==GetLocalPlayer() then
        call PlayMusic(s)
    endif
endfunction

function LocalMusic takes nothing returns nothing
    call StartMusicLocal(GetTriggerPlayer(),"war3mapImported\\PH1.mp3")
    //for 1 "\" you must use "\\", ex: path is war3mapImported\PH1.mp3, you have to use "war3mapImported\\bgm.mp3"
endfunction

function InitTrig_g takes nothing returns nothing
    local trigger t=CreateTrigger()
    call TriggerRegisterPlayerEventEndCinematic(t,Player(0))
    call TriggerAddAction(t,function LocalMusic)
endfunction

Delete the red part.
 

nabbig2

New Member
Reaction score
43
Okay, I have this but it does nothing:

Code:
function StartMusicLocal takes player p,string s returns nothing
    if p==GetLocalPlayer() then
        call PlayMusic(s)
    endif
endfunction

function LocalMusic takes nothing returns nothing
    call StartMusicLocal(GetTriggerPlayer(),"war3mapImported\\PH1.mp3")
    //for 1 "\" you must use "\\", ex: path is war3mapImported\PH1.mp3, you have to use "war3mapImported\\PH1.mp3"
endfunction

function InitTrig_g takes nothing returns nothing
    local trigger t=CreateTrigger()
    call TriggerRegisterPlayerEventEndCinematic(t,Player(0))
    call TriggerAddAction(t,function LocalMusic)
endfunction
 

saw792

Is known to say things. That is all.
Reaction score
280
Well actually... that trigger plays the music when player 1 (red) presses escape (so test it that way first). It is easily modified to work from a chat string, give me a few minutes.

Edit:
JASS:
function StartMusicLocal takes player p,string s returns nothing
    if p==GetLocalPlayer() then
        call PlayMusic(s)
    endif
endfunction

function LocalMusic takes nothing returns nothing
    call StartMusicLocal(GetTriggerPlayer(),"war3mapImported\\PH1.mp3")
    //for 1 "\" you must use "\\", ex: path is war3mapImported\PH1.mp3, you have to use "war3mapImported\\PH1.mp3"
endfunction

function InitTrig_g takes nothing returns nothing
    local trigger t=CreateTrigger()
    call TriggerRegisterPlayerChatEvent( t, Player(0), "-play1", true )
    call TriggerRegisterPlayerChatEvent( t, Player(1), "-play1", true )
    call TriggerRegisterPlayerChatEvent( t, Player(2), "-play1", true )
    call TriggerRegisterPlayerChatEvent( t, Player(3), "-play1", true )
    call TriggerRegisterPlayerChatEvent( t, Player(4), "-play1", true )
    call TriggerRegisterPlayerChatEvent( t, Player(5), "-play1", true )
    call TriggerRegisterPlayerChatEvent( t, Player(6), "-play1", true )
    call TriggerRegisterPlayerChatEvent( t, Player(7), "-play1", true )
    call TriggerRegisterPlayerChatEvent( t, Player(8), "-play1", true )
    call TriggerRegisterPlayerChatEvent( t, Player(9), "-play1", true )
    call TriggerAddAction(t,function LocalMusic)
endfunction


That will trigger when any of the first ten players type -play1.
To add more players copy the
JASS:
    call TriggerRegisterPlayerChatEvent( t, Player(0), "-play1", true )
line and replace Player (0) with Player (10), Player (11), etc.
 

nabbig2

New Member
Reaction score
43
Thankyou a lot, but it plays no music. It lags for about .1 seconds (don't worry about the lag) which means it must be doing something, but it plays nothing...:confused:
 

saw792

Is known to say things. That is all.
Reaction score
280
I assume you imported the music file? Go to the import manager and make sure the path of the imported file is the same as the one in the trigger. If all else fails feel free to post the map so we can have a proper look at the problem.
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • Monovertex Monovertex:
    Hmm, how do I change my signature?
  • tom_mai78101 tom_mai78101:
    Signatures can be edit in your account profile. As for the old stuffs, I'm thinking it's because Blizzard is now under Microsoft, and because of Microsoft Xbox going the way it is, it's dreadful.
  • The Helper The Helper:
    I am not big on the recipes I am just promoting them - I use the site as a practice place promoting stuff
    +2
  • Monovertex Monovertex:
    @tom_mai78101 I must be blind. If I go on my profile I don't see any area to edit the signature; If I go to account details (settings) I don't see any signature area either.
  • The Helper The Helper:
    You can get there if you click the bell icon (alerts) and choose preferences from the bottom, signature will be in the menu on the left there https://www.thehelper.net/account/preferences
  • The Helper The Helper:
    I think I need to split the Sci/Tech news forum into 2 one for Science and one for Tech but I am hating all the moving of posts I would have to do
  • The Helper The Helper:
    What is up Old Mountain Shadow?
  • The Helper The Helper:
    Happy Thursday!
    +1
  • Varine Varine:
    Crazy how much 3d printing has come in the last few years. Sad that it's not as easily modifiable though
  • Varine Varine:
    I bought an Ender 3 during the pandemic and tinkered with it all the time. Just bought a Sovol, not as easy. I'm trying to make it use a different nozzle because I have a fuck ton of Volcanos, and they use what is basically a modified volcano that is just a smidge longer, and almost every part on this thing needs to be redone to make it work
  • Varine Varine:
    Luckily I have a 3d printer for that, I guess. But it's ridiculous. The regular volcanos are 21mm, these Sovol versions are about 23.5mm
  • Varine Varine:
    So, 2.5mm longer. But the thing that measures the bed is about 1.5mm above the nozzle, so if I swap it with a volcano then I'm 1mm behind it. So cool, new bracket to swap that, but THEN the fan shroud to direct air at the part is ALSO going to be .5mm to low, and so I need to redo that, but by doing that it is a little bit off where it should be blowing and it's throwing it at the heating block instead of the part, and fuck man
  • Varine Varine:
    I didn't realize they designed this entire thing to NOT be modded. I would have just got a fucking Bambu if I knew that, the whole point was I could fuck with this. And no one else makes shit for Sovol so I have to go through them, and they have... interesting pricing models. So I have a new extruder altogether that I'm taking apart and going to just design a whole new one to use my nozzles. Dumb design.
  • Varine Varine:
    Can't just buy a new heatblock, you need to get a whole hotend - so block, heater cartridge, thermistor, heatbreak, and nozzle. And they put this fucking paste in there so I can't take the thermistor or cartridge out with any ease, that's 30 dollars. Or you can get the whole extrudor with the direct driver AND that heatblock for like 50, but you still can't get any of it to come apart
  • Varine Varine:
    Partsbuilt has individual parts I found but they're expensive. I think I can get bits swapped around and make this work with generic shit though
  • Ghan Ghan:
    Heard Houston got hit pretty bad by storms last night. Hope all is well with TH.
  • The Helper The Helper:
    Power back on finally - all is good here no damage
    +2
  • V-SNES V-SNES:
    Happy Friday!
    +1
  • The Helper The Helper:
    New recipe is another summer dessert Berry and Peach Cheesecake - https://www.thehelper.net/threads/recipe-berry-and-peach-cheesecake.194169/
  • The Helper The Helper:
    I think we need to add something to the bottom of the front page that shows the Headline News forum that has a link to go to the News Forum Index so people can see there is more news. Do you guys see what I am saying, lets say you read all the articles on the front page and you get to the end and it just ends, no kind of link for MOAR!
  • The Helper The Helper:
    Happy Wednesday!
    +1

      The Helper Discord

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top