Staredit Network > Forums > SC1 UMS Mapmaking Assistance > Topic: Music Loop Won't Work
Music Loop Won't Work
Jun 13 2010, 7:20 pm
By: substantialdisorder  

Jun 13 2010, 7:20 pm substantialdisorder Post #1



Hi, I'm trying to loop a .wav file for my map, but it's not working. Here are my triggers:

Trigger("All players"){
Conditions:
Always();

Actions:
Set Switch("Switch1", clear);
}

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

Trigger("All players"){
Conditions:
Switch("Switch1", not set);

Actions:
Play WAV("staredit\\wav\\pain.wav", 0);
Set Deaths("Player 9", "Gantrithor (Carrier)", Set To, 0);
Set Switch("Switch1", set);
Preserve Trigger();
}

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

Trigger("All players"){
Conditions:
Switch("Switch1", set);

Actions:
Set Deaths("Player 9", "Gantrithor (Carrier)", Set To, 200);
Wait(9266);
Preserve Trigger();
}

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

Trigger("All players"){
Conditions:
Deaths("Player 9", "Gantrithor (Carrier)", Exactly, 200);

Actions:
Set Switch("Switch1", clear);
Preserve Trigger();
}

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

Thank you for your help in advance.



None.

Jun 13 2010, 7:30 pm NudeRaider Post #2

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

What the hell? I'm not completely getting the purpose of those triggers, but the first one does nothing and P9 deaths can't be set.
Use one of P1-8 and an unused unit like neutral - neutral - cantina.

Also you making it too complicated.
All you need is 1 trigger:

All Players
C: Switch 1 is cleared
A: play wav
A: wait(9266)
A: Preserve

Optionally you can add another trigger that controls the switch. A set switch means music off.




Jun 13 2010, 7:41 pm substantialdisorder Post #3



Sorry, first time using Death count triggers.

I fixed it to this, so it plays it once, but it doesn't loop.
Trigger("All players"){
Conditions:
Always();

Actions:
Set Switch("Switch1", set);
}

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

Trigger("All players"){
Conditions:
Switch("Switch1", set);

Actions:
Play WAV("staredit\\wav\\pain.wav", 0);
Set Switch("Switch1", clear);
Preserve Trigger();
}

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

Trigger("All players"){
Conditions:
Switch("Switch1", not set);

Actions:
Wait(9266);
Set Switch("Switch1", set);
Preserve Trigger();
}

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



None.

Jun 13 2010, 8:01 pm Azrael Post #4



Can you post the map?

Post has been edited 2 time(s), last time on Oct 12 2010, 12:14 pm by DevliN. Reason: Mineral abuse.




Jun 13 2010, 8:04 pm NudeRaider Post #5

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

Why don't you do what I recommend? Is there any reason you need it that complicated?




Jun 13 2010, 8:33 pm rockz Post #6

ᴄʜᴇᴇsᴇ ɪᴛ!

http://www.staredit.net/files/1987/
Copy this.



"Parliamentary inquiry, Mr. Chairman - do we have to call the Gentleman a gentleman if he's not one?"

Jun 13 2010, 9:12 pm Aristocrat Post #7



Sorry, first time using Death count triggers.

I fixed it to this, so it plays it once, but it doesn't loop.
Trigger("All players"){
Conditions:
Always();

Actions:
<snip>
------------------//

That will only play it for Player 1 (or the first player). The off-state of the switch will make it not run for all players after that.

Using waits like that causes wait blocks as well. Use hyper triggers. Then, multiply the number of seconds in your WAV by the fraction 250/21, and round up. That's the number of deaths you want for your WAV if you add 1 death to it every turn.

Since WAV playing is single-player, you should just use an unused death count for Current Player. Never use global variables like switches for single player actions unless you know what you are doing.



None.

Jun 13 2010, 9:19 pm samsizzle Post #8



Why do you need the switch? Just have the sound play when you have 0 deaths of whatever DC and set the DC to however long the sound is and constantly subtract 1 DC.



None.

Jun 14 2010, 1:59 am substantialdisorder Post #9



@NudeRaider: I didn't use it because I realized my Hyper Triggers would cause wait blocks.
@Azrael.Wrath: I got it to work! Here's my code:

Trigger("All players"){
Conditions:
Always();

Actions:
Set Deaths("Player 8", "Cantina", Subtract, 1);
Preserve Trigger();
}

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

Trigger("All players"){
Conditions:
Deaths("Player 8", "Cantina", Exactly, 0);

Actions:
Set Deaths("Player 8", "Cantina", Set To, 111);
Preserve Trigger();
}

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

Trigger("All players"){
Conditions:
Deaths("Player 8", "Cantina", At most, 1);

Actions:
Play WAV("staredit\\wav\\pain.wav", 0);
Preserve Trigger();
}

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

@rockz: The example is too confusing, but thank you nevertheless. :)
@Aristocrat: Thanks to you and http://forums.starcraft.org/showthread.php?t=37246, I got it to work. Thank you very very much.
@samsizzle: That's what I did, except I used a P15 Scarab on the map so it went really fast. I had to do some reading to figure out what I was doing wrong.



None.

Jun 14 2010, 5:25 am rockz Post #10

ᴄʜᴇᴇsᴇ ɪᴛ!

That's going to bug up real quick.

Change the first 2 triggers to be owned by player 8.



"Parliamentary inquiry, Mr. Chairman - do we have to call the Gentleman a gentleman if he's not one?"

Jun 14 2010, 9:20 am NudeRaider Post #11

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

@NudeRaider: I didn't use it because I realized my Hyper Triggers would cause wait blocks.
When P8 is a computer player, then let him own the hyper triggers. It will still be in effect for every player.

Quote from rockz
That's going to bug up real quick.

Change the first 2 triggers to be owned by player 8.
Yeah, you have the trigger owned by All Players, so when you are testing alone All Players is only 1 Player and thus after 111 trigger loops you hit 111 death counts.
But when more players come into play they will all add to the dc too so it'll hit 111 much faster.




Jun 14 2010, 9:40 am samsizzle Post #12



@samsizzle: That's what I did, except I used a P15 Scarab on the map so it went really fast. I had to do some reading to figure out what I was doing wrong.
What? Does this mean that the P15 scarab trick makes the trigger loop faster? are you freakin kidding me?



None.

Jun 14 2010, 11:46 am Aristocrat Post #13



Quote from samsizzle
@samsizzle: That's what I did, except I used a P15 Scarab on the map so it went really fast. I had to do some reading to figure out what I was doing wrong.
What? Does this mean that the P15 scarab trick makes the trigger loop faster? are you freakin kidding me?
No, trigger loops are still happening at 250/21 times per second.

You can get the play wav to work by using "Current Player" for the DCs. Using P8 DCs and triggers actually do not work the way you described it.



None.

Jun 14 2010, 4:57 pm Azrael Post #14



You can use "All Players" if you change "Player 8" to "Current Player," which is what you'd want to do if you have 8 player slots.




Jun 15 2010, 12:40 am substantialdisorder Post #15



@samizzle: No, I'm not kidding you. I assumed wrongly. That's all.
@NudeRaider and Azrael: It's going to be an 8 player game but I've been testing it out with P8 as computer.

Thank you all. The music loops fine now, but it doesn't start right away. Any suggestions?



None.

Jun 15 2010, 2:21 am rockz Post #16

ᴄʜᴇᴇsᴇ ɪᴛ!

move the bottom trigger up one.



"Parliamentary inquiry, Mr. Chairman - do we have to call the Gentleman a gentleman if he's not one?"

Jun 15 2010, 12:20 pm Aristocrat Post #17



Seriously, just do something like this. It works in 8 players, it takes only two triggers, and it cannot possibly get any simpler for a non-waitblocking mechanism.

Code
<Hyper Triggers Not Shown>

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

Trigger("All players"){
Conditions:
    Always();

Actions:
    Preserve Trigger();
    Set Deaths("Current Player", "Mining Platform", Subtract, 1);
}

//-----------------------------------------------------------------//
Trigger("All players"){
Conditions:
    Deaths("Current Player", "Mining Platform", Exactly, 0);

Actions:
    Play WAV("staredit\\wav\\Shanghai Alice Gengakudan.wav", 101923);
    Set Deaths("Current Player", "Mining Platform", Set To, 1210);
    Preserve Trigger();
}

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


Obviously, replace the WAV name with yours and the set deaths number to (the number of seconds your WAV) times 250/21, rounded up.



None.

Jun 15 2010, 2:29 pm NudeRaider Post #18

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

I recommend adding the following condition so each player can switch off the music at will.
Easiest implementation is:
- A civ walks to a beacon which sets 'Mining Platform' to 15000 (or any number >= 1301) for music off
- and another beacon which sets 'Mining Platform' to 0 for music on.
Quote
<Hyper Triggers Not Shown>

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

Trigger("All players"){
Conditions:
Deaths("Current Player", "Mining Platform", At most, 1300);

Actions:
Preserve Trigger();
Set Deaths("Current Player", "Mining Platform", Subtract, 1);
}

//-----------------------------------------------------------------//
Trigger("All players"){
Conditions:
Deaths("Current Player", "Mining Platform", Exactly, 0);

Actions:
Play WAV("staredit\\wav\\Shanghai Alice Gengakudan.wav", 101923);
Set Deaths("Current Player", "Mining Platform", Set To, 1210);
Preserve Trigger();
}

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





Options
  Back to forum
Please log in to reply to this topic or to report it.
Members in this topic: None.
[06:47 am]
NudeRaider -- lil-Inferno
lil-Inferno shouted: nah
strong
[05:41 am]
Ultraviolet -- 🤔 so inf is in you?
[04:57 am]
O)FaRTy1billion[MM] -- my name is mud
[04:35 am]
Ultraviolet -- mud, meet my friend, the stick
[10:07 pm]
lil-Inferno -- nah
[2024-5-16. : 8:36 pm]
Ultraviolet -- Inf, we've got a job for you. ASUS has been very naughty and we need our lil guy to go do their mom's to teach them if they fuck around, they gon' find out
[2024-5-16. : 5:25 pm]
NudeRaider -- there he is, right on time! Go UV! :D
[2024-5-16. : 5:24 pm]
lil-Inferno -- poopoo
[2024-5-16. : 5:14 pm]
UndeadStar -- I wonder if that's what happened to me. A returned product (screen) was "officially lost" for a while before being found and refunded. Maybe it would have remained "lost" if I didn't communicate?
[2024-5-16. : 3:36 pm]
NudeRaider -- :lol:
Please log in to shout.


Members Online: Moose, Sylph-Of-Space