1. Updated Resource Submission Rules: All model & skin resource submissions must now include an in-game screenshot. This is to help speed up the moderation process and to show how the model and/or texture looks like from the in-game camera.
    Dismiss Notice
  2. DID YOU KNOW - That you can unlock new rank icons by posting on the forums or winning contests? Click here to customize your rank or read our User Rank Policy to see a list of ranks that you can unlock. Have you won a contest and still haven't received your rank award? Then please contact the administration.
    Dismiss Notice
  3. From the gates of hell, the 5th Special Effect Contest Results have emerged.
    Dismiss Notice
  4. Rubbed the right way, the genie is out of its lamp! The 12th Concept Art Contest Results have been announced.
    Dismiss Notice
  5. Race against the odds and Reforge, Don't Refund. The 14th Techtree Contest has begun!
    Dismiss Notice
  6. Check out the Staff job openings thread.
    Dismiss Notice
Dismiss Notice
60,000 passwords have been reset on July 8, 2019. If you cannot login, read this.

How to Play Music Without Lagging Game?

Discussion in 'Triggers & Scripts' started by Ramsey, Mar 12, 2014.

  1. Ramsey

    Ramsey

    Joined:
    Oct 19, 2008
    Messages:
    162
    Resources:
    2
    Maps:
    2
    Resources:
    2
    Everytime a trigger runs the Play Music - any default wc3 song, it lags the game for like half a second.

    I looked up answers to this question and i saw something like leave it how it is and people will just think its the laggers lagging hahhhaha but no i cant do that



    is there a certain order for the triggers or something?
    I just have it as -Stop last playing music Then -Play Music-Whatever
     
  2. IcemanBo

    IcemanBo

    Joined:
    Sep 6, 2013
    Messages:
    6,262
    Resources:
    22
    Maps:
    3
    Spells:
    11
    Template:
    1
    Tutorials:
    4
    JASS:
    3
    Resources:
    22
    Do you use this?
    Sound - Stop music Instantly
     
  3. Ramsey

    Ramsey

    Joined:
    Oct 19, 2008
    Messages:
    162
    Resources:
    2
    Maps:
    2
    Resources:
    2

    Yea but it's Sound - Stop music after fading
     
  4. IcemanBo

    IcemanBo

    Joined:
    Sep 6, 2013
    Messages:
    6,262
    Resources:
    22
    Maps:
    3
    Spells:
    11
    Template:
    1
    Tutorials:
    4
    JASS:
    3
    Resources:
    22
    You can choose Immediatly/Instantly idk what's exactly written in english editor.
     
  5. Ramsey

    Ramsey

    Joined:
    Oct 19, 2008
    Messages:
    162
    Resources:
    2
    Maps:
    2
    Resources:
    2

    That will remove the lag?


    So in final it will be:

    Sound - stop last playing music instantly
    Sound - play NEW music

    OR should there be a small wait inbetween too?
     
  6. IcemanBo

    IcemanBo

    Joined:
    Sep 6, 2013
    Messages:
    6,262
    Resources:
    22
    Maps:
    3
    Spells:
    11
    Template:
    1
    Tutorials:
    4
    JASS:
    3
    Resources:
    22
    No wait in between, try it out. I think it worked for me long time ago, but Im not very sure. ;)
     
  7. DysfunctionaI

    DysfunctionaI

    Joined:
    Mar 6, 2006
    Messages:
    281
    Resources:
    1
    Tutorials:
    1
    Resources:
    1
    OK so I gotta ask: how large is the sound file and what type of file is it?

    In any case, you could probably easily solve this with preloading the sound at map init (or at time elapsed 0.00, I forget). I can't write the function atm, but just google "warcraft 3 preload sound" or whatever, you basically just play the sound at the start of the game with zero volume, so no one hears it, but the lag from loading the sound will be taken care of on init.

    Also, you might wanna be positive that there's nothing else that would lag in the trigger that plays the music, because I've never heard lag caused by playing sounds.
     
  8. Adiktuz

    Adiktuz

    Joined:
    Oct 16, 2008
    Messages:
    9,674
    Resources:
    23
    Models:
    2
    Packs:
    1
    Maps:
    1
    Spells:
    16
    Tutorials:
    1
    JASS:
    2
    Resources:
    23
    Most objects will cause a lag the first time they are used. To counter it you can opt to "preload" them during map init (obviously the costs would be longer loading times + more chance to hit OP limit)
     
  9. Zwiebelchen

    Zwiebelchen

    Joined:
    Sep 17, 2009
    Messages:
    6,823
    Resources:
    12
    Models:
    5
    Maps:
    1
    Spells:
    1
    Tutorials:
    1
    JASS:
    4
    Resources:
    12
    I always use the Sound functions instead of Play Music. Works without lag. Only downside is that the music volume controller in game options will not work this way.
     
  10. BPower

    BPower

    Joined:
    Mar 18, 2012
    Messages:
    1,709
    Resources:
    21
    Spells:
    15
    Tutorials:
    1
    JASS:
    5
    Resources:
    21
    Which is not a big problem, because you can set sound properties like volume per sound.
     
  11. Ramsey

    Ramsey

    Joined:
    Oct 19, 2008
    Messages:
    162
    Resources:
    2
    Maps:
    2
    Resources:
    2
    No i figured it out, Icemanbo is right.

    Using the triggers:
    Sound - Immediately stop last playing music
    Sound - Play new music

    does not lag at all compared to

    Sound - Stop last playing music after fading
    Sound - Play new music


    So yeah do not use Stop music after fading unless you put a few seconds wait after it