Staredit Network > Forums > SC1 UMS Mapmaking Assistance > Topic: Creating a fade-able music loop
Creating a fade-able music loop
Sep 8 2016, 3:17 am
By: Pr0nogo  

Sep 8 2016, 3:17 am Pr0nogo Post #1



Having some problems with creating a music loop in my single player campaign mission. Right now, the issue seems to be detecting the number of deaths the player has accrued of 'Terran Marker'. Using 'at least', 'at most', and 'exactly' have all proven fruitless currently. I've screencapped the 3 triggers below.



This sets the timer that is slowly counted down, one death at a time. The amount of deaths is equivalent to the total running time of the song that plays in the background.



This is the actual counter. The switch is set correctly by a trigger with an 'always' condition. I also have 3 hypertriggers present in the map, owned by a player with no other triggers currently (and thus no wait blocks are possible).



This plays the first 10 second chunk of the song. Its only condition (other than the switch being set, which we already know occurs) is that at least 1 death has been subtracted from the main timer, indicating that the counter is active. Using 'at least' is fine for the first chunk, but obviously cannot be used for later trigger conditions because they have to occur after the first one. Using 'exactly' and 'at most' simply results in no sound being played.

Is there an obvious solution to this problem that I've missed?




Sep 8 2016, 3:22 am O)FaRTy1billion[MM] Post #2

👻 👾 👽 💪

Is the first trigger supposed to have preserve trigger?

Also who owns the triggers? If it is owned by any more than a single player, it will subtract more than 1 death each cycle and the "exactly" amount might get skipped over.



TinyMap2 - Latest in map compression! ( 7/09/14 - New build! )
EUD Action Enabler - Lightweight EUD/EPD support! (ChaosLauncher/MPQDraft support!)
EUDDB - topic - Help out by adding your EUDs! Or Submit reference files in the References tab!
MapSketch - New image->map generator!
EUDTrig - topic - Quickly and easily convert offsets to EUDs! (extended players supported)
SC2 Map Texture Mask Importer/Exporter - Edit texture placement in an image editor!
\:farty\: This page has been viewed [img]http://farty1billion.dyndns.org/Clicky.php?img.gif[/img] times!

Sep 8 2016, 3:29 am Pr0nogo Post #3



The first trigger is supposed to only be run once.

Only the player the music plays for (player 1) owns the triggers.

Removing the game pause had no effect and setting them to exactly resulted in the same issue as before.




Sep 8 2016, 3:46 am O)FaRTy1billion[MM] Post #4

👻 👾 👽 💪

Quote from Pr0nogo
The first trigger is supposed to only be run once.
Then where is the timer reset?



TinyMap2 - Latest in map compression! ( 7/09/14 - New build! )
EUD Action Enabler - Lightweight EUD/EPD support! (ChaosLauncher/MPQDraft support!)
EUDDB - topic - Help out by adding your EUDs! Or Submit reference files in the References tab!
MapSketch - New image->map generator!
EUDTrig - topic - Quickly and easily convert offsets to EUDs! (extended players supported)
SC2 Map Texture Mask Importer/Exporter - Edit texture placement in an image editor!
\:farty\: This page has been viewed [img]http://farty1billion.dyndns.org/Clicky.php?img.gif[/img] times!

Sep 8 2016, 5:01 am Oh_Man Post #5

Find Me On Discord (Brood War UMS Community & Staredit Network)

Use at least and at most for condition. Then use set for action to bypass and stop the wav playing more than once.




Sep 8 2016, 11:01 am NudeRaider Post #6

We can't explain the universe, just describe it; and we don't know whether our theories are true, we just know they're not wrong. >Harald Lesch

Here's how it's supposed to work. Using different players, trigger order or count modificators (exactly, at least, at most) might break it, so for now copy it exactly to confirm it's working, then implement changes if you feel they are necessary.

(Re-)Start Music
Players

  • Force of P1
  • Conditions

  • Current Player has suffered exacly 0 deaths of 'Cantina'
  • Current Player brings at least 1 'Chooser' to 'Music ON'
  • Actions

  • Set deaths of 'Cantina' to 238 (this is for 20s. Formula is: 1000/84 * length of song in s)
  • Preserve


  • Play music chunk 1
    Players

  • Force of P1
  • Conditions

  • Current Player suffered exactly 238 deaths of 'Cantina'
  • Current Player brings at least 1 'Chooser' to 'Music ON'
  • Actions

  • Play WAV 'chunk 1'
  • Preserve


  • Play music chunk 2
    Players

  • Force of P1
  • Conditions

  • Current Player suffered exactly 119 deaths of 'Cantina'
  • Current Player brings at least 1 'Chooser' to 'Music ON'
  • Actions

  • Play WAV 'chunk 2'
  • Preserve


  • counter
    Players

  • Force of P1
  • Conditions

  • Current Player brings at least 1 'Chooser' to 'Music ON'
  • Actions

  • Subtract 1 deaths of 'Cantina'
  • Preserve


  • This is a very basic setup, because the simpler it is, the more robust and easier to bugfix it is. Music will stop after at most 10s when the chooser is moved away, and will take up to 10s to restart, depending on where the counter stopped. The former can be prevented by using smaller chunks, the latter obviously needs improving, when it's confirmed running. I'd simply set Cantina to 0 when the civ is moved away, so the music begins anew.




    Sep 8 2016, 11:40 am Pr0nogo Post #7



    Quote from O)FaRTy1billion[MM]
    Then where is the timer reset?
    It's in the trigger that plays the final chunk of the song.

    Quote from Oh_Man
    Use at least and at most for condition. Then use set for action to bypass and stop the wav playing more than once.
    Can you give me an example of this in action?

    Quote from NudeRaider
    Here's how it's supposed to work. [...] This is a very basic setup, because the simpler it is, the more robust and easier to bugfix it is.
    Wouldn't removing the secondary condition (in your case, the bring condition) be better than including it at all? Why is this simpler/more robust than a switch? In my triggers there's not even an action that turns the switch off because I've been having these problems to begin with.

    I have 10 second chunks and it switches to a 10 second faded-out chunk when the song is set to end so a different track can take over. This transition process can take up to 20 seconds and can be as quick as 10 seconds. Even if I were to use a second death counter as a boolean (0 is standard, 1 is fade) it's no different than using a switch and should perform identically.

    I'll post again when I have time to try your method instead.




    Sep 8 2016, 4:31 pm NudeRaider Post #8

    We can't explain the universe, just describe it; and we don't know whether our theories are true, we just know they're not wrong. >Harald Lesch

    Quote from Pr0nogo
    Wouldn't removing the secondary condition (in your case, the bring condition) be better than including it at all? Why is this simpler/more robust than a switch? In my triggers there's not even an action that turns the switch off because I've been having these problems to begin with.
    several reasons:
    - I have no reason to distrust the robustness of bring (however you're right, it leaves more room for user mistakes, so you can remove it if you suspect an error with it)
    - you gotta have user interaction at some point to make it work
    - the switch which needs another trigger to be set or cleared
    - you have neither visual feedback nor control over the condition when using a trigger controlled switch




    Sep 9 2016, 6:35 pm Pr0nogo Post #9



    I've successfully implemented your system, including a fade. I've also had success changing it over to a switch-based system.

    The map is available here if you want to review what I did. It only loops for up to 60 seconds before going back to the first chunk.

    The exact same system has been implemented into my campaign mission, and does not work. Once again, only the first chunk plays. No other chunks play. There is no instance of the switch being cleared in any of the triggers. I've completely wiped all other data from the map, and even then, it is malfunctioning in the exact same way as before.

    Here's the map. I hope someone else can make some sense of the issue. Thanks for all your help so far.




    Sep 9 2016, 8:09 pm NudeRaider Post #10

    We can't explain the universe, just describe it; and we don't know whether our theories are true, we just know they're not wrong. >Harald Lesch

    Thing is, debugging is hard work. And sometimes there's a tiny mistake you just don't find because you know how it's supposed to work, so remaking the system is often faster, so I took the "easy route".




    Sep 9 2016, 9:48 pm Roy Post #11

    An artist's depiction of an Extended Unit Death

    Quote from Pr0nogo
    I also have 3 hypertriggers present in the map, owned by a player with no other triggers currently (and thus no wait blocks are possible).
    Triggers owned by missing players do not run. Player 8 is a human player, so if it's empty, your map has no hyper triggers.

    Added the following trigger to your map (copied from here), and the music works as expected:
    The Hyper Trigger
    Players

  • All Players
  • Conditions

  • All Players has suffered exactly 0 deaths of Cave.
  • Actions

  • Modify deaths for Current Player: Add 1 for Cave.
  • Wait for 0 milliseconds.
  • Modify deaths for Current Player: Subtract 1 for Cave.
  • Wait for 0 milliseconds.
  • Preserve Trigger.


  • Or, if you prefer SCMD code:
    Code
    Trigger("All players"){
    Conditions:
        Deaths("All players", "Cave", Exactly, 0);

    Actions:
        Set Deaths("Current Player", "Cave", Add, 1);
        Wait(0);
        Set Deaths("Current Player", "Cave", Subtract, 1);
        Wait(0);
        Preserve Trigger();
    }

    //-----------------------------------------------------------------//





    Sep 9 2016, 10:07 pm Pr0nogo Post #12



    Oh, I must have forgotten to switch player 8 to computer. That's embarrassing. I'll debug it when I get home.




    Sep 9 2016, 11:08 pm Sacrieur Post #13

    Still Napping

    I'd still recommend to switching to use the HT.

    You won't have to worry about who owns the trigger. Using it in place of previous methods will lead to a complete hassle-free mapping experience.



    None.

    Sep 10 2016, 12:18 am Pr0nogo Post #14



    Do you mean using Roy's suggestion? Should I include that in every trigger that needs a hyper?




    Sep 10 2016, 12:28 am Sacrieur Post #15

    Still Napping

    Quote from Pr0nogo
    Do you mean using Roy's suggestion? Should I include that in every trigger that needs a hyper?

    Yes, Roy's suggestion.

    You replace all of your hyper triggers with that single trigger. It's a one trigger solution.



    None.

    Sep 10 2016, 1:29 am Pr0nogo Post #16



    I'll test that out. Weird that I hadn't heard of it before. Thanks for the heads up guys.




    Sep 10 2016, 1:52 am Pr0nogo Post #17



    When trying to implement Roy's suggestin in Classic Trigedit, it changes the UI to a death table calculation, like so:



    Is this functionally the same as the normal GUI input method of death calculations? The same thing happens when trying to input 'Current Player' instead of 'All Players'.

    In the meantime, I'll try to use the code, although for some reason trigedit never saves my changes when I input them (I got this to save, testing now).

    Post has been edited 1 time(s), last time on Sep 10 2016, 1:59 am by Pr0nogo.




    Sep 10 2016, 2:09 am O)FaRTy1billion[MM] Post #18

    👻 👾 👽 💪

    I think it's fixed by filling in player last or something. If you are indeed using terran marine, then it is functionally identical.



    TinyMap2 - Latest in map compression! ( 7/09/14 - New build! )
    EUD Action Enabler - Lightweight EUD/EPD support! (ChaosLauncher/MPQDraft support!)
    EUDDB - topic - Help out by adding your EUDs! Or Submit reference files in the References tab!
    MapSketch - New image->map generator!
    EUDTrig - topic - Quickly and easily convert offsets to EUDs! (extended players supported)
    SC2 Map Texture Mask Importer/Exporter - Edit texture placement in an image editor!
    \:farty\: This page has been viewed [img]http://farty1billion.dyndns.org/Clicky.php?img.gif[/img] times!

    Sep 10 2016, 2:23 am Pr0nogo Post #19



    I've fixed it and the music seems fine, although it does desync at first because of the fact that the starting game speed is normal. That can be messed with, though. Looks like this issue has been resolved. Thanks everyone!




    Options
      Back to forum
    Please log in to reply to this topic or to report it.
    Members in this topic: None.
    [2024-4-14. : 9:21 pm]
    O)FaRTy1billion[MM] -- there are some real members mixed in those latter pages, but the *vast* majority are spam accounts
    [2024-4-14. : 9:21 pm]
    O)FaRTy1billion[MM] -- there are almost 3k pages
    [2024-4-14. : 9:21 pm]
    O)FaRTy1billion[MM] -- the real members stop around page 250
    [2024-4-14. : 9:20 pm]
    O)FaRTy1billion[MM] -- look at the members list
    [2024-4-12. : 12:52 pm]
    Oh_Man -- da real donwano
    da real donwano shouted: This is the first time I've seen spam bots like this on SEN. But then again, for the last 15 years I haven't been very active.
    it's pretty common
    [2024-4-11. : 9:53 pm]
    da real donwano -- This is the first time I've seen spam bots like this on SEN. But then again, for the last 15 years I haven't been very active.
    [2024-4-11. : 4:18 pm]
    IlyaSnopchenko -- still better than "Pakistani hookers in Sharjah" that I've seen advertised in another forum
    [2024-4-11. : 4:07 pm]
    Ultraviolet -- These guys are hella persistent
    [2024-4-11. : 3:29 pm]
    Vrael -- You know, the outdoors is overrated. Got any indoor gym and fitness equipment?
    [2024-4-10. : 8:11 am]
    Sylph-Of-Space -- Hello!
    Please log in to shout.


    Members Online: eksxo, Roy