Change music during stage

  • Thread starter Thread starter LeeBrother
  • Start date Start date
L

LeeBrother

Guest
Hi!
I want the game to change bgm at a certain point, like when picking up an item. I peeked into the script section, it seems not very hard to script, although i dont know how to set it up or where to put it in.
Any suggestions, maybe without script?
Thanks!
 
You can try this:
Code:
name boss1
health 1
nolife 1
type enemy
lifespan 1

anim spawn
	delay 1
	offset 1 1
	frame data/chars/misc/empty.gif

anim idle
	loop 0
@script
    void vSelf = getlocalvar("self");
if(frame==0)
{
      playmusic("DATA/music/dd1boss.BOR", 1);
}@end_script
	offset 1 1
	#offset 11 16
	delay 20
	hitfx data/sounds/empty.wav
#	attackone 1
#		attack3  0  0  400  400  0  0  0  1  0  1000
	frame data/chars/misc/empty.gif
	delay 1
	movea -100
	frame data/chars/misc/empty.gif
	frame data/chars/misc/empty.gif
	frame data/chars/misc/empty.gif
	frame data/chars/misc/empty.gif
	frame data/chars/misc/empty.gif
	frame data/chars/misc/empty.gif
	frame data/chars/misc/empty.gif
	frame data/chars/misc/empty.gif
	frame data/chars/misc/empty.gif
	frame data/chars/misc/empty.gif
	frame data/chars/misc/empty.gif
	frame data/chars/misc/empty.gif
	frame data/chars/misc/empty.gif
	frame data/chars/misc/empty.gif
	frame data/chars/misc/empty.gif
	frame data/chars/misc/empty.gif
	frame data/chars/misc/empty.gif
	frame data/chars/misc/empty.gif
	frame data/chars/misc/empty.gif
	frame data/chars/misc/empty.gif
	frame data/chars/misc/empty.gif
	frame data/chars/misc/empty.gif
	frame data/chars/misc/empty.gif
	frame data/chars/misc/empty.gif
	frame data/chars/misc/empty.gif
	frame data/chars/misc/empty.gif
	frame data/chars/misc/empty.gif
	frame data/chars/misc/empty.gif
	frame data/chars/misc/empty.gif
	frame data/chars/misc/empty.gif
	frame data/chars/misc/empty.gif
you "know it" on models.txt. I use it spawning it on a level, but you can try spawning it when picking an item.
 
In stages you can add music like you would wait/at commands etc.

Like this

Code:
music   data/music/newmusic.ogg
at        600

But if you want it changed by item pickup, you will need script.

What exactly do you want to do thou?
 
BeasTie said:
In stages you can add music like you would wait/at commands etc.

Like this

Code:
music   data/music/newmusic.ogg
at        600

But if you want it changed by item pickup, you will need script.

What exactly do you want to do thou?

.... Seriously? You can do that? I've been using my script method (the one Die_In_Fire posted) for years! When did this command exist!?
 
Beastie, I did that, like, 3 years ago when I was working on my last update of Dragon Duo mod. Demo is 3 years old though. Posted in Lavalit years ago.
 
I didn't know about it till I used Crime Buster as ref. I used Bloodbane's scripted version of Crime Buster long time ago for train stage. I was using the music for one sub boss I made before the boss music along with the boss char plays. Probably it was for practice or something I think. I can't remember. It can be possible for having an enemy character that has a large lifebar like a boss char without an input of 'boss 1'. That char can die without having other enemies dying at the same time.

BTW Beastie. You beat me by posting the same solution of the "spawn"-ing for music. Thought you knew it before I did.

I don't feel like uploading the last version (made 3 years ago) of Dragon Duo because . I'm just glad no one approved it in Lavalit. I meant for the game to be fun though. I wanna make Dragon Duo a lot better than my previous one I have.
 
Well everyone just told me script the solution too when I asked about this like less than a year ago :P

With the script method, could that be added directly to stages now with latest builds as @script section? instead of needing it's own entity?

---

There is also the loop settings you could mess around with and create one music file that has each section in it. 
Some games music were designed like this, like original Syndicate game where it plays one part of the loop when no enemies are on screen, when enemies appear it switches to the second loop which is more intense. 
 
NickyP said:
.... Seriously? You can do that? I've been using my script method (the one Die_In_Fire posted) for years! When did this command exist!?

That command was on Lavalit on a thread about changing music inside a stage for a boss battle, in which the boss entity isn't using the boss 1 command, and depends on stage location (this was long before your script method). The reason I use your script method, is because I usually change music on boss battles before spawning a boss, so it doesn't matter where in the stage the characters are, as it depends on spawn/group instead of depending on location.
So as LeeBrother said he wanted for a item pickup, I think the script solution is better. LeeBrpther do you want for an effect like Mario's hammer on Donkey Kong? or the star power on smb1?

BeasTie said:
With the script method, could that be added directly to stages now with latest builds as @script section? instead of needing it's own entity? 
that would be sweet!
 
BeasTie said:
In stages you can add music like you would wait/at commands etc.

Like this

Code:
music   data/music/newmusic.ogg
at        600

Thanks BeasTie, i'll keep that in mind!
@Die_In_Fire
That script works great, exactely what i needed, thank you guys!  :)
 
...

Seriously, this is a stunning revelation here! Do you guys know how many times I'd make blank enemies and stuff to change the music to something, then change it back? In one unreleased demo, I have five different music-changing entities. Five! And all this time I could have literally just wrote "music at etc"!

Wow. All that extra work for nothing.  ;D But I suppose the script method is more reliable in the end.
 
BeasTie said:
With the script method, could that be added directly to stages now with latest builds as @script section? instead of needing it's own entity?

It depends on how the music change would be. Script tag in level texts are run once so it can't be used to change music based on current situation. If you want music to change based on number of active entities, you need a blank entity to do this

Do you guys know how many times I'd make blank enemies and stuff to change the music to something, then change it back?

Yeah, sorry about that. Newer builds allow script to be declared directly in level texts so there are more obsolete blank enemies now. Same here though, I have many blank entities to change level aspects which are obsolete now.
I love declaring scripts in level texts, it really help especially in Random Encounters feature I have done in our D&D mod.
 
Back
Top Bottom