Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

FPSC Classic Scripts / Playing music while an enemy is attacking?

Author
Message
King Of Khaos
15
Years of Service
User Offline
Joined: 25th Feb 2009
Location: Not ALL the windows were locked...
Posted: 20th Oct 2009 06:54
Can somebody please tell me how to make it so certain music starts playing when an enemy spawns, but stops and goes back to the normal background music when it is destroyed?

At night i lay awake on my bed, gazing up at the stars, and i wonde-hey, where'd the roof go?
Plystire
21
Years of Service
User Offline
Joined: 18th Feb 2003
Location: Staring into the digital ether
Posted: 20th Oct 2009 10:46
Use the "music=X" command in their spawn and destroy scripts.


The one and only,


Scurvy Lobster
18
Years of Service
User Offline
Joined: 3rd Mar 2006
Location: Denmark
Posted: 20th Oct 2009 13:08
You can also look at how I handle music with trigger zones in Sands of Myth and the script presented here.

It won't give a perfect solution for your question but it might be a good inspiration.

King Of Khaos
15
Years of Service
User Offline
Joined: 25th Feb 2009
Location: Not ALL the windows were locked...
Posted: 20th Oct 2009 23:41
Quote: "Use the "music=X" command in their spawn and destroy scripts."



How do i do that?

At night i lay awake on my bed, gazing up at the stars, and i wonde-hey, where'd the roof go?
Plystire
21
Years of Service
User Offline
Joined: 18th Feb 2003
Location: Staring into the digital ether
Posted: 21st Oct 2009 04:05
Find out what script your enemy is using for appearing and destroying (AKA dieing)

Find them in the scriptbank folder, open them in Notepad, and then change them.


The one and only,


King Of Khaos
15
Years of Service
User Offline
Joined: 25th Feb 2009
Location: Not ALL the windows were locked...
Posted: 21st Oct 2009 05:28
Ok, i found what scripts the enemy is using, but its extremely short and i cant find "music" in there.

At night i lay awake on my bed, gazing up at the stars, and i wonde-hey, where'd the roof go?
Plystire
21
Years of Service
User Offline
Joined: 18th Feb 2003
Location: Staring into the digital ether
Posted: 21st Oct 2009 23:55
That's why you add it to the script.


The one and only,


King Of Khaos
15
Years of Service
User Offline
Joined: 25th Feb 2009
Location: Not ALL the windows were locked...
Posted: 22nd Oct 2009 00:12 Edited at: 22nd Oct 2009 00:15
I did, but nothing happened. Yes, i put the path of the music i wanted to play where the "x" is, but when i test the game, no music plays. Please, can you be more detailed? I really need this in my game by a certain time.

At night i lay awake on my bed, gazing up at the stars, and i wonde-hey, where'd the roof go?
Nickydude
Retired Moderator
18
Years of Service
User Offline
Joined: 4th Nov 2006
Location: Look outside...
Posted: 22nd Oct 2009 03:05
Make sure the music is in the "audiobank" folder somewhere.

King Of Khaos
15
Years of Service
User Offline
Joined: 25th Feb 2009
Location: Not ALL the windows were locked...
Posted: 22nd Oct 2009 03:16
I did, but still nothing. Is there anything else i need to add before or after the "music=x"? Sorry i'm not very smart at all with scripting.

At night i lay awake on my bed, gazing up at the stars, and i wonde-hey, where'd the roof go?
King Of Khaos
15
Years of Service
User Offline
Joined: 25th Feb 2009
Location: Not ALL the windows were locked...
Posted: 22nd Oct 2009 05:08
Anybody? PLEASE i really need this for my game so i have time to work on it before the halloween contest ends.

At night i lay awake on my bed, gazing up at the stars, and i wonde-hey, where'd the roof go?
AdrianoJones Wannabe
15
Years of Service
User Offline
Joined: 2nd Jul 2009
Location: Ontario, Canada
Posted: 22nd Oct 2009 05:29
Quote: "Anybody? PLEASE i really need this for my game so i have time to work on it before the halloween contest ends."


You're very pushy.

-Adrian

I love Taylor Swift. She's awesome.
Hey guys! Help me! Join the creative design forums! http://creativedesign.candorweb.com/index.php
King Of Khaos
15
Years of Service
User Offline
Joined: 25th Feb 2009
Location: Not ALL the windows were locked...
Posted: 22nd Oct 2009 05:39
Quote: "You're very pushy."



Pushy? are you kidding me? I just need this before it's too late. I'm not pushing anybody to answer me, i'm simply bumping up the thread by asking if anybody could help me. If me being "pushy" bothers you, then stay out of this thread.

At night i lay awake on my bed, gazing up at the stars, and i wonde-hey, where'd the roof go?
AdrianoJones Wannabe
15
Years of Service
User Offline
Joined: 2nd Jul 2009
Location: Ontario, Canada
Posted: 22nd Oct 2009 05:44
Quote: "Pushy? are you kidding me? I just need this before it's too late. I'm not pushing anybody to answer me, i'm simply bumping up the thread by asking if anybody could help me. If me being "pushy" bothers you, then stay out of this thread."


Hm....
Well you're acting like you HAVE to have it. Is it really that essential?

-Adrian

I love Taylor Swift. She's awesome.
Hey guys! Help me! Join the creative design forums! http://creativedesign.candorweb.com/index.php
King Of Khaos
15
Years of Service
User Offline
Joined: 25th Feb 2009
Location: Not ALL the windows were locked...
Posted: 22nd Oct 2009 05:48
Obviously i don't HAVE to have it, as if my life depends on it, its just very important to me that i get this finished before the contest ends.

At night i lay awake on my bed, gazing up at the stars, and i wonde-hey, where'd the roof go?
AdrianoJones Wannabe
15
Years of Service
User Offline
Joined: 2nd Jul 2009
Location: Ontario, Canada
Posted: 22nd Oct 2009 05:51
Well I don't want to seem mean or anything, but you just seemed very demanding that's all.

-Adrian

I love Taylor Swift. She's awesome.
Hey guys! Help me! Join the creative design forums! http://creativedesign.candorweb.com/index.php
King Of Khaos
15
Years of Service
User Offline
Joined: 25th Feb 2009
Location: Not ALL the windows were locked...
Posted: 22nd Oct 2009 06:01
Sorry if i did, i'm just short on patience, and im getting worked up about the whole thing.

At night i lay awake on my bed, gazing up at the stars, and i wonde-hey, where'd the roof go?
King Of Khaos
15
Years of Service
User Offline
Joined: 25th Feb 2009
Location: Not ALL the windows were locked...
Posted: 23rd Oct 2009 03:40
I don't want to sound pushy again, but is there anybody out there that can help me? Please?

At night i lay awake on my bed, gazing up at the stars, and i wonde-hey, where'd the roof go?
Plystire
21
Years of Service
User Offline
Joined: 18th Feb 2003
Location: Staring into the digital ether
Posted: 23rd Oct 2009 05:53
Well, aside from the basics, here's something I found to get that bit of "extra" help from people because it helps THEM see what you're doing.

Post your script so we can look at it

No body here is psychic. We don't know what your script looks like at all. For all we know, you missed a colon, you forgot a comma, you used a condition as an action, you didn't give a certain command a parameter, etc. The list goes on and on with what could be wrong with what you're doing.

If your music is in the audiobank, then the only thing I can see as being a problem would be your script.


The one and only,


King Of Khaos
15
Years of Service
User Offline
Joined: 25th Feb 2009
Location: Not ALL the windows were locked...
Posted: 23rd Oct 2009 07:41 Edited at: 23rd Oct 2009 07:43
Well sorry to upset you, even though i did exactly what you said, even in different ways, over and over again, and still nothing. So here they are

The spawn:



The destroy:


At night i lay awake on my bed, gazing up at the stars, and i wonde-hey, where'd the roof go?
bass guy1669
17
Years of Service
User Offline
Joined: 24th Mar 2007
Location: The Zone
Posted: 23rd Oct 2009 08:19
Try taking the spaces out of the file name
If that doesn't work then convert the file to a .ogg then try again

come see night shift at http://forum.thegamecreators.com/?m=forum_view&t=106003&b=25 see you there
King Of Khaos
15
Years of Service
User Offline
Joined: 25th Feb 2009
Location: Not ALL the windows were locked...
Posted: 23rd Oct 2009 08:52
Quote: "Try taking the spaces out of the file name
If that doesn't work then convert the file to a .ogg then try again
"



I tried both and neither worked.

At night i lay awake on my bed, gazing up at the stars, and i wonde-hey, where'd the roof go?
Plystire
21
Years of Service
User Offline
Joined: 18th Feb 2003
Location: Staring into the digital ether
Posted: 23rd Oct 2009 12:30
He is correct about the spaces. Your file names may not contain space, however your file name must be exactly what the file's name is... so the solution here would be to remove the spaces from the actual file's name, and then correct the name in your script.


The one and only,


King Of Khaos
15
Years of Service
User Offline
Joined: 25th Feb 2009
Location: Not ALL the windows were locked...
Posted: 24th Oct 2009 09:15
Ok, the music now starts when the enemy spawns. But once it dies, the music keeps playing...

At night i lay awake on my bed, gazing up at the stars, and i wonde-hey, where'd the roof go?
starmind 001
FPSC Reloaded Backer
17
Years of Service
User Offline
Joined: 23rd Sep 2007
Location:
Posted: 24th Oct 2009 09:24
Model packs I have done this , so I will share a simple way of do this. I will give you a step by step process.

Here we go!

1: Set your trigger zone

2: Set your enemy that you want to spawn with your normal scripts ( meaning use "appear1" )

3: Now set an Item, like health pack, to spawn with your enemy and give it the script "repeatsound" as your start. In the first sound file put the music that you want to play here.

4: Now place the item in a place in which the player will either leave the room and pick it up or set a trigger to destroy it as the player leaves. and you will have what you want fast and simple.

King Of Khaos
15
Years of Service
User Offline
Joined: 25th Feb 2009
Location: Not ALL the windows were locked...
Posted: 24th Oct 2009 09:33
starmind 001, i really appreciate you sharing this with me, but i need the music to stop as soon as the enemy dies, otherwise the whole rest of the time the player is walking on his way to leave the room, the music will still be playing, and he might think that the enemy is still lurking around or something.

At night i lay awake on my bed, gazing up at the stars, and i wonde-hey, where'd the roof go?
Plystire
21
Years of Service
User Offline
Joined: 18th Feb 2003
Location: Staring into the digital ether
Posted: 24th Oct 2009 13:00
I shal quote myself in the VERY FIRST reply to this thread.

Quote: "Use the "music=X" command in their spawn and destroy scripts"


Use "music=0" to turn music off.


The one and only,


starmind 001
FPSC Reloaded Backer
17
Years of Service
User Offline
Joined: 23rd Sep 2007
Location:
Posted: 24th Oct 2009 16:49
That will work for you I have done it in my game star trek the room and PLy's script work you just need to type it Right. I was just giving you something that did not need scripting.

spawn:


destroy:



starmind 001
FPSC Reloaded Backer
17
Years of Service
User Offline
Joined: 23rd Sep 2007
Location:
Posted: 24th Oct 2009 23:44
Model packs I found my game that I made last year with this effect and re-uploaded just for you to see. Here:

http://forum.thegamecreators.com/?m=forum_view&t=149555&b=25&p=0

King Of Khaos
15
Years of Service
User Offline
Joined: 25th Feb 2009
Location: Not ALL the windows were locked...
Posted: 24th Oct 2009 23:51
Now when i do anything else, no music plays at all

At night i lay awake on my bed, gazing up at the stars, and i wonde-hey, where'd the roof go?
Plystire
21
Years of Service
User Offline
Joined: 18th Feb 2003
Location: Staring into the digital ether
Posted: 25th Oct 2009 01:46
Then instead of "music=0" have it play the music that's supposed to be playing regularly.


The one and only,


King Of Khaos
15
Years of Service
User Offline
Joined: 25th Feb 2009
Location: Not ALL the windows were locked...
Posted: 25th Oct 2009 07:47
That worked, but now i can't get the music i want to play when the player is fighting the enemy to play. Ive looked at the script over and over, but nothing seems wrong with it.




At night i lay awake on my bed, gazing up at the stars, and i wonde-hey, where'd the roof go?
Plystire
21
Years of Service
User Offline
Joined: 18th Feb 2003
Location: Staring into the digital ether
Posted: 25th Oct 2009 08:20
Where is the script where you change the music back?


The one and only,


King Of Khaos
15
Years of Service
User Offline
Joined: 25th Feb 2009
Location: Not ALL the windows were locked...
Posted: 25th Oct 2009 08:30
Here



At night i lay awake on my bed, gazing up at the stars, and i wonde-hey, where'd the roof go?
Hockeykid
DBPro Tool Maker
17
Years of Service
User Offline
Joined: 26th Sep 2007
Location:
Posted: 25th Oct 2009 08:33 Edited at: 25th Oct 2009 08:35


Ehum here you go

The commands "runfpidefault" and "destroy" both cause the script to stop executing right away, meaning your line right below them never gets run.

Plystire
21
Years of Service
User Offline
Joined: 18th Feb 2003
Location: Staring into the digital ether
Posted: 25th Oct 2009 08:33
I think the problem is the order in which you made things happen. The commands "runfpidefault" and "destroy" both cause the script to stop executing right away, meaning your line right below them never gets run.

So try moving your music lines above the lines before them.


The one and only,


Hockeykid
DBPro Tool Maker
17
Years of Service
User Offline
Joined: 26th Sep 2007
Location:
Posted: 25th Oct 2009 08:34
Quote: "I think the problem is the order in which you made things happen. The commands "runfpidefault" and "destroy" both cause the script to stop executing right away, meaning your line right below them never gets run.

So try moving your music lines above the lines before them.


The one and only,"


Hmm wonder who told you that

Plystire
21
Years of Service
User Offline
Joined: 18th Feb 2003
Location: Staring into the digital ether
Posted: 25th Oct 2009 08:36
It definitely couldn't be that little bird on my shoulder.


... Oh wait, yeah it was.


The one and only,


Hockeykid
DBPro Tool Maker
17
Years of Service
User Offline
Joined: 26th Sep 2007
Location:
Posted: 25th Oct 2009 08:38
Quote: "It definitely couldn't be that little bird on my shoulder."


Are you referring to the big Fenix on your shoulder, in other words me?

Plystire
21
Years of Service
User Offline
Joined: 18th Feb 2003
Location: Staring into the digital ether
Posted: 25th Oct 2009 08:39
I was more refering to the little orange bird on my shoulder coughing up smoke.


The one and only,


King Of Khaos
15
Years of Service
User Offline
Joined: 25th Feb 2009
Location: Not ALL the windows were locked...
Posted: 25th Oct 2009 23:34
It works! Thank you so much!

At night i lay awake on my bed, gazing up at the stars, and i wonde-hey, where'd the roof go?
King Of Khaos
15
Years of Service
User Offline
Joined: 25th Feb 2009
Location: Not ALL the windows were locked...
Posted: 25th Oct 2009 23:57
One more thing... I'm sure this is easy and probably obvious but i don't know how to do it. How do you change the volume of the global background music? Yes, i have searched.

At night i lay awake on my bed, gazing up at the stars, and i wonde-hey, where'd the roof go?
AdrianoJones Wannabe
15
Years of Service
User Offline
Joined: 2nd Jul 2009
Location: Ontario, Canada
Posted: 26th Oct 2009 00:30
Why don't you open it up in Audacity and edit it to your liking?

-Adrian

I love Taylor Swift. She's awesome.
Hey guys! Help me! Join the creative design forums! http://creativedesign.candorweb.com/index.php
King Of Khaos
15
Years of Service
User Offline
Joined: 25th Feb 2009
Location: Not ALL the windows were locked...
Posted: 26th Oct 2009 01:17
Sorry, didn't think of that, thanks.

At night i lay awake on my bed, gazing up at the stars, and i wonde-hey, where'd the roof go?
Plystire
21
Years of Service
User Offline
Joined: 18th Feb 2003
Location: Staring into the digital ether
Posted: 26th Oct 2009 13:30
musicvolume=X


The one and only,


Samuellx3
17
Years of Service
User Offline
Joined: 19th Jan 2007
Location: Caaaardiff!
Posted: 29th Oct 2009 14:29
In the end, it all worked out okay. Don't you just love a happy ending here kids!

~ ViRaL =]

Login to post a reply

Server time is: 2024-11-25 07:40:54
Your offset time is: 2024-11-25 07:40:54