Playmaker Forum

PlayMaker Help & Tips => PlayMaker Help => Topic started by: Dev_Sebas on August 26, 2011, 03:23:39 PM

Title: Shot[SOLVED]
Post by: Dev_Sebas on August 26, 2011, 03:23:39 PM
Hi I have a small problem
I have 2 states
1 with a mouse down
and another with a mouse up and with a play sound
When I press mouse I listened the sound but if I will be pressing the sound finish. this is only a shot. I need loop.
How can I make it?
Please help
Thanks
Title: Re: Shot
Post by: Alex Chouls on August 26, 2011, 04:38:17 PM
You could add an AudioComponent to the GameObject and use Audio actions (e.g., AudioPlay, AudioStop). This will give you more control over how the audio plays.
Title: Re: Shot
Post by: Dev_Sebas on August 26, 2011, 04:51:39 PM
Thanks Alex I will try
Bye
Title: Re: Shot
Post by: Dev_Sebas on August 26, 2011, 05:05:21 PM
It is not good too
Any help
Bye
Title: Re: Shot
Post by: Damian on August 26, 2011, 07:24:56 PM
You only need to set the sound to loop.
Then just play it and it will play the loop so long you dont turn it of or change the sound.
Title: Re: Shot
Post by: Dev_Sebas on August 26, 2011, 08:50:18 PM
Yes I try but if I up in middle of sound it don´t finish.
Bye
Title: Re: Shot
Post by: Dev_Sebas on August 28, 2011, 11:44:33 AM
Please give me some help...
Bye
Title: Re: Shot
Post by: Alex Chouls on August 28, 2011, 03:29:37 PM
If you need the sound to stop on mouse up I would suggest taking another look at the Audio Actions: Audio Play and Audio Stop.

Have you tried adding an AudioComponent to your GameObject and using the Audio actions?

What happens? Does the sound play?

Can you post what you tried?
Title: Re: Shot
Post by: Dev_Sebas on August 28, 2011, 04:08:32 PM
1-No I don´t need the sound stop on mouse up
2-Yes I have tried
3-I press and sound but if I up the sound does not finish (it´s cut)
4-Yes it plays
5-I have a som of BootCamps rifle and I want when I press play sound and when I up stop sound.
Hope you understand
Bye
Please help me
Title: Re: Shot
Post by: qholmes on August 29, 2011, 01:16:15 PM
So as a guess you want it to repeat when the mouse it down but when the mouse is up then you want it to finish the current loop but then stop??

Q
Title: Re: Shot
Post by: Dev_Sebas on August 29, 2011, 04:42:09 PM
Hi qholmes
I need this.
1 I press five seconds and play a sound per second. When I up the current sound continues playing until the end.
Is like a game.
If you help will be much appreciated.
Bye
Title: Re: Shot
Post by: qholmes on August 29, 2011, 05:12:04 PM
Yes that is what i meant by what i wrote i think..

Well i tried a simple loop using an Audio Play to play the sound.. It gives you the Finished Event sot hat you can go back to check and see if your mouse button is still pressed.. It worked but only twice then it hung up in the Audio Play State for some reason... I have no idea why.

My mouse button check state was just a Get Mouse Button and set a Bool to the value then do a Bool Test and the True Event was the Audio Play State..

But like i said it seemed to hang... Maybe it did not like to be called so quickly or something... Could put in a tiny delay there between the mouse button check and the call..

Not sure that helps but that was my quick test.. I am sure there are other ways of doing it..

Q
Title: Re: Shot
Post by: qholmes on August 29, 2011, 05:21:39 PM
Ok had a new thought....

Start event.. Get Mouse Button Down. It triggers An Audio Play and a Set Audio Loop to On Then a Send event to go to the next State

That state Checks for Get Mouse Button UP.. Which triggers to the next state that Sets the Audio Loop to Off and returns to the Start State.. 4 States and it loop pretty good.. Stays looping while the button is down and finishes last iteration when button is up and stops.

Hope that helps

Q
Title: Re: Shot
Post by: Dev_Sebas on August 29, 2011, 06:09:47 PM
Hi qholmes
Can you explain a little better I can not understand very well
Bye

Title: Re: Shot
Post by: qholmes on August 29, 2011, 07:08:13 PM
Hehh ok in a bit

Q
Title: Re: Shot
Post by: Dev_Sebas on August 29, 2011, 07:41:37 PM
I know error is my but I can not understand very well
Bye
Title: Re: Shot
Post by: Dev_Sebas on August 29, 2011, 08:27:40 PM
A image will be very great, men.
If you can of course
Bye
Title: Re: Shot
Post by: qholmes on August 29, 2011, 09:07:16 PM
no problem.. when i wrote it i realized that it would be confusing to read but maybe might do the trick.. just didnt have time to make some pics at the time.

Give me a few.. it is pretty easy what i did.

Q
Title: Re: Shot
Post by: Dev_Sebas on August 29, 2011, 09:10:26 PM
Hi qholmes
Make the image when you can :) don´t need to be now.
Thanks for the help
Bye
Title: Re: Shot
Post by: qholmes on August 29, 2011, 09:20:21 PM
No problem.. hope this works.

Q
Title: Re: Shot
Post by: qholmes on August 29, 2011, 09:21:50 PM
I dont know if it is a great way but it seems to work.. i was just trying it with a pretty short sound... it seemed to clip once in a while but i dont know why.. see if it does what you way.. otherwise will have to make an action that will trigger when it the audio is done instead.

Q
Title: Re: Shot
Post by: Dev_Sebas on August 29, 2011, 09:37:13 PM
Thanks again qholmes :) :) thanks a lot
Bye
Title: Re: Shot
Post by: qholmes on August 29, 2011, 10:02:54 PM
NP hope it works

Q