Stopping sound before time?

Non-platform specific questions.

Postby Diana Kennedy » Sat Jan 14, 2006 10:36 am

twobob wrote:In your script, are you using the variables/functions button at the bottom of the script editor to add the sound –


Ahm...No. I am not sure.

In fact, what I did before was to ad the sound via the action function "ad-action->play-sound and there I could choose the file indeed in a pop-up box, set volume, hear it and so on. But there was no scripting involved.

Then I did as I described in the posting above, with script, but there I could not find a way to control and hear the sound. I am am confused about which way is the right.
User avatar
Diana Kennedy
 
Posts: 257
Joined: Wed Dec 07, 2005 12:34 am
Location: France, where Presidents who got shot in Texas do exile ;-)
Score: 0 Give a positive score

Postby Diana Kennedy » Sun Jan 15, 2006 7:49 am

Okay, I am still stuck. Image

So I decided to try my luck by uploading a .ged file. Not the original, it would be too huge. I created an example file with only the hunter, the horse and of course all sounds and animations. But nothing more.
The state as it is now: left Click on the blue filled "aim-area", the arrow is created and the horse flees at a galop, galopp sound is played. press right crtl key and arrow is shot. If Horse is hit, it falls down...galopp sounds continues!
I want them to stop.

I hate to annoy with my own stupidity, but this issue is a major one. My game-project considerably lives of realistic sound actions.

File: http://johnfkennedy.chez-alice.fr/belege/sound.zip

The data-files are loose and probably need to be-packed into a data-folder.
User avatar
Diana Kennedy
 
Posts: 257
Joined: Wed Dec 07, 2005 12:34 am
Location: France, where Presidents who got shot in Texas do exile ;-)
Score: 0 Give a positive score

Postby twobob » Sun Jan 15, 2006 12:04 pm

In the actor control for your actor tarpin, click on remove in events – activation event – playsound and remove this action.
Now click on add in events – activation event for aim – add action – script editor
In the script editor click on the variable button at bottom, and add a variable, i.e stopmysound, with integer and global as options. Then click on add then close(not the script editor)
Still in the script editor for tarpan – click on variables/functions – click on PlaySound2 and choose your sound. Click OK. In the script editor you should have something like the following:
PlaySound2("D:\\temp\\sound\\data\\horse-gallop.wav", 1.000000, 1, 0.000000);
In front of this add stopmysound=
So now in the script editor it will be something like:
stopmysound= PlaySound2("D:\\temp\\sound\\data\\horse-gallop.wav", 1.000000, 1, 0.000000);
Now click add button and immediate action and come out of the script editor, and click close for activation event

Still in the actor control for tarpin, click on add in events – collision – choose on any side of actor arrow –add action- script editor
In the script editor add the following:
stopSound(stopmysound);
Click on add – immediate action and close collision event.

I have tested and works fine. You could also use stopmysound variable for say when the actor tarpin is out of vision using the script editor again.
twobob
 
Posts: 33
Joined: Sat Sep 10, 2005 10:29 am
Location: England
Score: 2 Give a positive score

Postby Diana Kennedy » Mon Jan 16, 2006 6:09 am

twobob, I love you! :D

Yes, it works real fine now! Thank you so much! I really hope I can return the help / favor one day.

Just two little questions, for my better understanding:

1. What is the particular reason that it has to be the function "playsound2" why not 1 or a 3?

2. Will the game auto-update the path to the sound? In the script-Editor indeed the whole path to the file's initial source is shown. I guess the file will be imported in the data folder. Will the game update this information?

I have tested and works fine. You could also use stopmysound variable for say when the actor tarpin is out of vision using the script editor again.


Yes, I will do so. There's plenty of possibilities now.

Again, thank you so very much for your kind patience and your great help!!
User avatar
Diana Kennedy
 
Posts: 257
Joined: Wed Dec 07, 2005 12:34 am
Location: France, where Presidents who got shot in Texas do exile ;-)
Score: 0 Give a positive score

Postby twobob » Mon Jan 16, 2006 9:20 am

Got there in the end – well done for carrying on, it’s all so easy to give up when you are first learning a new concept.

I think playSound2 is just an updated version of playSound, and that playSound is just a leftover function from previous versions – someone correct me if I’m wrong.

If you now save your game to a different directory, the path to the sound files gets updated to the data directory to where you have saved your game.

It does help if you know a little bit about c programming but you can pick bits and pieces up as you progress.
Also going over the demos seeing how they are put together can give you fresh ideas on how to approach a situation. The advantage that you have is that you are very good at graphics.
twobob
 
Posts: 33
Joined: Sat Sep 10, 2005 10:29 am
Location: England
Score: 2 Give a positive score

Postby Diana Kennedy » Thu Jan 19, 2006 2:55 pm

Twobob,

t does help if you know a little bit about c programming but you can pick bits and pieces up as you progress.
Also going over the demos seeing how they are put together can give you fresh ideas on how to approach a situation. The advantage that you have is that you are very good at graphics


Thank you. In fact I came to the GE because I am an artist wanting to make a game. You are right, I will have to learn C bit by bit. It is very difficult. Most tutorials start at a too high point.


Now I have unfortunately a new little problem: The galpping sound works, even when the actor Tarpan is NOT created! Means: When you click on the aim, the sound plays. But the tarpan actor has "no" in create at startup and is only created with a timer by a text actor. How can I avoid this?
User avatar
Diana Kennedy
 
Posts: 257
Joined: Wed Dec 07, 2005 12:34 am
Location: France, where Presidents who got shot in Texas do exile ;-)
Score: 0 Give a positive score

Postby Novice » Thu Jan 19, 2006 3:05 pm

Move the playsound from mouse down to create actor.
Why do i always get stuck?
User avatar
Novice
 
Posts: 399
Joined: Mon Aug 29, 2005 10:54 am
Location: Relative
Score: 5 Give a positive score

Postby Diana Kennedy » Thu Jan 19, 2006 3:11 pm

Hm...But then, the sound will probably play as soon as the actor is created and that is NOT what is intended. The sound should play when one clicks on the aming point so that the actor changes path and animation AND plays sound.
User avatar
Diana Kennedy
 
Posts: 257
Joined: Wed Dec 07, 2005 12:34 am
Location: France, where Presidents who got shot in Texas do exile ;-)
Score: 0 Give a positive score

Postby Novice » Thu Jan 19, 2006 4:18 pm

Sorry about that, use an if statement with actor count to check the horse is created to play the sound.
Code: Select all
if (ActorCount(Horse)==1) playSound....;
Why do i always get stuck?
User avatar
Novice
 
Posts: 399
Joined: Mon Aug 29, 2005 10:54 am
Location: Relative
Score: 5 Give a positive score

Postby Diana Kennedy » Thu Jan 19, 2006 4:23 pm

Novice wrote:Sorry about that, use an if statement with actor count to check the horse is created to play the sound.
Code: Select all
if (ActorCount(Horse)==1) playSound....;



Hm...It gaves me an error message. The code I made was:

Code: Select all
if (ActorCount(yellowtarpan)==1)galoppsound = PlaySound2("data/horse-gallop.wav", 1.000000, 1, 0.000
User avatar
Diana Kennedy
 
Posts: 257
Joined: Wed Dec 07, 2005 12:34 am
Location: France, where Presidents who got shot in Texas do exile ;-)
Score: 0 Give a positive score

Postby Novice » Thu Jan 19, 2006 4:51 pm

You have to put the name of the actor in quotation marks.
Code: Select all
if (ActorCount("yellowtarpan")==1)galoppsound = PlaySound2("data/horse-gallop.wav", 1.000000, 1, 0.000
Why do i always get stuck?
User avatar
Novice
 
Posts: 399
Joined: Mon Aug 29, 2005 10:54 am
Location: Relative
Score: 5 Give a positive score

Postby Diana Kennedy » Fri Jan 20, 2006 5:13 am

It works! Thank ou very much! 8) 8) 8)
User avatar
Diana Kennedy
 
Posts: 257
Joined: Wed Dec 07, 2005 12:34 am
Location: France, where Presidents who got shot in Texas do exile ;-)
Score: 0 Give a positive score

Postby Novice » Fri Jan 20, 2006 2:04 pm

No prob :)
Why do i always get stuck?
User avatar
Novice
 
Posts: 399
Joined: Mon Aug 29, 2005 10:54 am
Location: Relative
Score: 5 Give a positive score

Previous

Return to General

Who is online

Users browsing this forum: No registered users and 1 guest

cron