Change music and give magic to player commands!

The Wonderland Open Source Project

Moderators: ILoveWonderland, Sammy_P, Lazy Loof

Post Reply
ALEXALEX976
Silver Wonderlander
Posts: 42
Joined: Wed Dec 02, 2009 5:46 pm

Change music and give magic to player commands!

Post by ALEXALEX976 » Sun May 05, 2019 11:05 am

Change music:
https://www.youtube.com/watch?v=kFq-dr- ... e=youtu.be

Give Magic:
https://www.youtube.com/watch?v=0ynzSGj ... e=youtu.be

And here is the code (only the parts that I added, you just need to copy them in function ActivateCommand in file adventures.bb)

Code: Select all

	Case 14 ; CMD 14: Data1 is the music track number
		If currentmusic<>Data1 And GlobalMusicVolume2>0
			If ChannelPlaying (MusicChannel)=1
				StopChannel (MusicChannel)
			EndIf
			If Data1 >0
				If Data1 =21
					MusicChannel=PlayMusic ("data\models\ladder\valetfile.ogg")
				Else
					MusicChannel=PlayMusic ("data\music\"+Data1+".ogg")
				EndIf
			EndIf	
			CurrentMusic=Data1
			levelmusic=CurrentMusic
		EndIf 
	Case 15 ; CMD 15: Data 1 is the Magic number (0=Floing, 1=Pow etc.), Data 2 is the muber of charges (default is 9)
		For j=0 To 99
			If InventoryItem(j)=1001
				PlaySoundFX(80,-1,-1)
				CurrentSpell=Data1 
				InventoryTexture(j)=16+CurrentSpell
				If Data2>0
					CurrentSpellPower=Data2
				Else  
					CurrentSpellPower=9
				EndIf 		
				; activate glove icon
				DeleteIcon(0)
				If CurrentSpell=5 And IndigoActive=3
					CreateIcon(0,0,16+CurrentSpell,1002+CurrentSpell,"X "+CurrentSpellPower+" X","Activate")
				Else
					CreateIcon(0,0,16+CurrentSpell,1002+CurrentSpell,"- "+CurrentSpellPower+" -","Activate")
		
				EndIf
			EndIf 
		Next 
Edit: I added the complete adventures.bb file
Enjoy! :)
You do not have the required permissions to view the files attached to this post.
Last edited by ALEXALEX976 on Sun May 05, 2019 5:22 pm, edited 1 time in total.
Muzozavr
Rainbow Spirit Chaser
Posts: 5643
Joined: Wed Jan 11, 2006 2:55 pm

Re: Change music and give magic to player commands!

Post by Muzozavr » Sun May 05, 2019 12:04 pm

Ni-i-i-i-i-ice!

Can the music command change music in any order or does it just "scroll" through the list up and down?

And how does it work with save/load, does the current state of the music get saved?
Rest in peace, Kym. I hardly knew ya.
Rest in peace, Marinus. A bright star, you were ahead of me on my own tracks of thought. I miss you.
ALEXALEX976
Silver Wonderlander
Posts: 42
Joined: Wed Dec 02, 2009 5:46 pm

Re: Change music and give magic to player commands!

Post by ALEXALEX976 » Sun May 05, 2019 12:12 pm

It can change the music in whatever track you want in any order. The video is just a demo where I put a general cmd button of every track in that order just to test. About saving/loading, I have not test it but I assume yes because I also set the levelmusic variable to the new value, I will check it later to be 100% sure.
User avatar
Pawelec
Rainbow Master
Posts: 690
Joined: Tue Jul 15, 2008 8:37 am

Re: Change music and give magic to player commands!

Post by Pawelec » Wed Jun 05, 2019 8:34 pm

As the music file path is exposed it seems possible to finally add custom music support, the question is how to handle that with CMD14 and WLV file format.
"Let us return to the past; it will be progress."
by Giuseppe Verdi
Post Reply