Question on music when firing a weapon

Freeform discussion about anything related to modding Transcendence.
Post Reply
Tshark9999
Miner
Miner
Posts: 34
Joined: Sat Dec 01, 2012 8:22 pm

I have a question. How do I set it so that when I fire a certain weapon, it plays a music file as long as I hold down the fire button, but stops when I don't? Also, if possible, could I make it so that if I fire the weapon again, it starts from where the music stopped the last time I stopped firing? I've just started modding, and so far I only know how to make a simple weapon mod. If possible, it would be nice if you included a code snippet in the reply.
EditorRUS
Militia Lieutenant
Militia Lieutenant
Posts: 148
Joined: Tue Oct 30, 2012 6:30 pm

I am really afraid of asking you what kind of weapon you're making, but...

NYAN-NYAN-NYAN-NYAN-NYAN-NYAN-NYAN-NYAN-NYAN-NYAN-NYAN-NYAN-NYAN-NYAN-NYAN-NYAN-NYAN-NYAN-NYAN-NYAN-NYAN-NYAN-NYAN-NYAN-NYAN-NYAN-NYAN?!

Well, whatever.

It's like you make a weapon with charging.
First, make <OnFireWeapon>
Second, OnFireWeapon should check if it's not already "charging" (playing music in your example), if so, then play music file and make a variable "PlayingMusic" to not equal Nil.
Third, OnFireWeapon should end-1 with "(objAddObjTimerEvent %Firerate+1%)" on some event which should set "PlayingMusic" var to Nil.
Third, OnFireWeapon should end with "(objAddObjTimerEvent %Firerate+2%)" on some event which would check if "PlayingMusic" is Nil, and, if so, stop playing music.
Tshark9999
Miner
Miner
Posts: 34
Joined: Sat Dec 01, 2012 8:22 pm

RPC already helped me a ton with this, and we got it to work. So far, I have a dubstep gun and a Nyan cat gun XD. I'm working on getting it balanced before uploading it to xelerus. It has its own music files though, all royalty/copyright free :D
Post Reply