<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Maratis forum - Play sound once]]></title>
	<link rel="self" href="http://forum.maratis3d.com/extern.php?action=feed&amp;tid=443&amp;type=atom"/>
	<updated>2014-12-19T22:45:56Z</updated>
	<generator>PunBB</generator>
	<id>http://forum.maratis3d.com/viewtopic.php?id=443</id>
		<entry>
			<title type="html"><![CDATA[Re: Play sound once]]></title>
			<link rel="alternate" href="http://forum.maratis3d.com/viewtopic.php?pid=7452#p7452"/>
			<content type="html"><![CDATA[<p>Fine thanks ! just finished a 4 months pre-forming module, <br />now i&#039;m going to hibernate for a week before starting something else <img src="http://forum.maratis3d.com/img/smilies/wink.png" width="15" height="15" alt="wink" /></p>]]></content>
			<author>
				<name><![CDATA[Vegas]]></name>
				<uri>http://forum.maratis3d.com/profile.php?id=53</uri>
			</author>
			<updated>2014-12-19T22:45:56Z</updated>
			<id>http://forum.maratis3d.com/viewtopic.php?pid=7452#p7452</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Play sound once]]></title>
			<link rel="alternate" href="http://forum.maratis3d.com/viewtopic.php?pid=7451#p7451"/>
			<content type="html"><![CDATA[<p>Thanks Vegas. I&#039;ll download them today and test. How are you By the way?</p>]]></content>
			<author>
				<name><![CDATA[Tutorial Doctor]]></name>
				<uri>http://forum.maratis3d.com/profile.php?id=2493</uri>
			</author>
			<updated>2014-12-19T16:54:22Z</updated>
			<id>http://forum.maratis3d.com/viewtopic.php?pid=7451#p7451</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Play sound once]]></title>
			<link rel="alternate" href="http://forum.maratis3d.com/viewtopic.php?pid=7450#p7450"/>
			<content type="html"><![CDATA[<p>Hey TD, the scripts Anael &amp; i posted are both valid, i assume Almighty Laxz problem was somewhere else<br />Here&#039;s a project with both scripts (you must un-comment one of the method first) : <br /><a href="https://dl.dropboxusercontent.com/u/19970067/Maratis/Soundtest.rar">https://dl.dropboxusercontent.com/u/199 &#133; ndtest.rar</a></p>]]></content>
			<author>
				<name><![CDATA[Vegas]]></name>
				<uri>http://forum.maratis3d.com/profile.php?id=53</uri>
			</author>
			<updated>2014-12-18T04:43:29Z</updated>
			<id>http://forum.maratis3d.com/viewtopic.php?pid=7450#p7450</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Play sound once]]></title>
			<link rel="alternate" href="http://forum.maratis3d.com/viewtopic.php?pid=7447#p7447"/>
			<content type="html"><![CDATA[<p>I had to revisit this post, as I need this again, however, I am on a mac now and something as simple as:</p><div class="codebox"><pre><code>if isCollisionBetween(box,trigger) then
        playSound(news)
    end</code></pre></div><p>In the update function plays the sound only once (although it plays it after the collision is finished, not upon impact). </p><p>I wonder if the issue is a Windows thing? Or at least, I don&#039;t hear the repetitions if there are any.</p><p>Nope. It still skips</p>]]></content>
			<author>
				<name><![CDATA[Tutorial Doctor]]></name>
				<uri>http://forum.maratis3d.com/profile.php?id=2493</uri>
			</author>
			<updated>2014-12-16T03:10:31Z</updated>
			<id>http://forum.maratis3d.com/viewtopic.php?pid=7447#p7447</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Play sound once]]></title>
			<link rel="alternate" href="http://forum.maratis3d.com/viewtopic.php?pid=6537#p6537"/>
			<content type="html"><![CDATA[<p>Well, I was hoping to find my answer here, guess I have to try elsewhere.</p>]]></content>
			<author>
				<name><![CDATA[Tutorial Doctor]]></name>
				<uri>http://forum.maratis3d.com/profile.php?id=2493</uri>
			</author>
			<updated>2014-03-02T23:45:46Z</updated>
			<id>http://forum.maratis3d.com/viewtopic.php?pid=6537#p6537</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Play sound once]]></title>
			<link rel="alternate" href="http://forum.maratis3d.com/viewtopic.php?pid=2639#p2639"/>
			<content type="html"><![CDATA[<p>Still not working, I now have:<br /></p><div class="quotebox"><blockquote><p>Sound0 = getObject(&quot;Sound0&quot;)<br />SOUND = {obj = Sound0, impact = 0}<br />&nbsp; &nbsp;function play_impact(sound)<br />&nbsp; &nbsp; if SOUND.impact == 0 then playSound(sound.obj) end<br />&nbsp; &nbsp; &nbsp; &nbsp;SOUND.impact = 1<br />&nbsp; &nbsp;end<br />&nbsp; &nbsp;function stop_impact(sound)<br />&nbsp; &nbsp;SOUND.impact = 0<br />&nbsp; &nbsp;end<br />function onSceneUpdate()<br />if isCollisionBetween(Car, Ground)<br />then changeCurrentCamera(Camera1)<br />deactivate(Text0)<br />deactivate(Text1)<br />camcycle = 1<br />play_impact(SOUND)<br />else<br />stop_impact(SOUND)<br />end</p></blockquote></div><p>Any other ideas?</p>]]></content>
			<author>
				<name><![CDATA[Almighty Laxz]]></name>
				<uri>http://forum.maratis3d.com/profile.php?id=1037</uri>
			</author>
			<updated>2012-09-17T22:14:13Z</updated>
			<id>http://forum.maratis3d.com/viewtopic.php?pid=2639#p2639</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Play sound once]]></title>
			<link rel="alternate" href="http://forum.maratis3d.com/viewtopic.php?pid=2615#p2615"/>
			<content type="html"><![CDATA[<p>And something like that ?</p><div class="codebox"><pre><code>Sound0 = getObject(&quot;Sound0&quot;)
SOUND = {obj = Sound0, impact = 0}

function play_impact(sound)
    if sound.impact == 0 then
        playSound(sound.obj)
        sound.impact = 1
    end
end

function stop_impact(sound)
   sound.impact = 0
end

function onSceneUpdate()
   
    if isCollisionBetween(Car, Ground) then
        changeCurrentCamera(Camera1)
        deactivate(Text0)
        deactivate(Text1)  
        camcycle = 1
        play_impact(SOUND)
    else
        stop_impact(SOUND)
    end

end</code></pre></div>]]></content>
			<author>
				<name><![CDATA[anael]]></name>
				<uri>http://forum.maratis3d.com/profile.php?id=2</uri>
			</author>
			<updated>2012-09-14T10:57:35Z</updated>
			<id>http://forum.maratis3d.com/viewtopic.php?pid=2615#p2615</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Play sound once]]></title>
			<link rel="alternate" href="http://forum.maratis3d.com/viewtopic.php?pid=2614#p2614"/>
			<content type="html"><![CDATA[<p>Whoops, it actually didn&#039;t work, its still looping. <br />I now have:<br /></p><div class="quotebox"><blockquote><p>Sound0 = getObject(&quot;Sound0&quot;)<br />SOUND = {impact = 0}<br />function onSceneUpdate()<br />&nbsp; &nbsp;function play_impact()<br />&nbsp; &nbsp; if SOUND.impact == 0 then playSound(Sound0) end<br />&nbsp; &nbsp; &nbsp; &nbsp;SOUND.impact = 1<br />&nbsp; &nbsp;end<br />&nbsp; &nbsp;function stop_impact()<br />&nbsp; &nbsp;SOUND.impact = 0<br />&nbsp; &nbsp;end<br />if isCollisionBetween(Car, Ground)<br />then changeCurrentCamera(Camera1)<br />deactivate(Text0)<br />deactivate(Text1)<br />camcycle = 1<br />play_impact()<br />else<br />stop_impact()<br />end</p></blockquote></div><p>Putting the functions after isCollisionBetween doesn&#039;t work, it stops the script working.</p>]]></content>
			<author>
				<name><![CDATA[Almighty Laxz]]></name>
				<uri>http://forum.maratis3d.com/profile.php?id=1037</uri>
			</author>
			<updated>2012-09-14T10:21:03Z</updated>
			<id>http://forum.maratis3d.com/viewtopic.php?pid=2614#p2614</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Play sound once]]></title>
			<link rel="alternate" href="http://forum.maratis3d.com/viewtopic.php?pid=2602#p2602"/>
			<content type="html"><![CDATA[<p>Try this :</p><div class="quotebox"><blockquote><p>Sound0 = getObject(&quot;Sound0&quot;)</p><p>SOUND = {impact = 0}</p><p>function onSceneUpdate()<br />&nbsp; &nbsp; if isCollisionBetween(Car, Ground) then<br />&nbsp; &nbsp; &nbsp; &nbsp; changeCurrentCamera(Camera1)<br />&nbsp; &nbsp; &nbsp; &nbsp; deactivate(Text0)<br />&nbsp; &nbsp; &nbsp; &nbsp; deactivate(Text1)<br />&nbsp; &nbsp; &nbsp; &nbsp; camcycle = 1<br />&nbsp; &nbsp; &nbsp; &nbsp; play_impact()<br />&nbsp; &nbsp; else<br />&nbsp; &nbsp; &nbsp; &nbsp; stop_impact()<br />&nbsp; &nbsp; end&nbsp; &nbsp; <br />end</p><p>function play_impact()<br />&nbsp; &nbsp; if SOUND.impact == 0 then playSound(Sound0) end<br />&nbsp; &nbsp; &nbsp; &nbsp;SOUND.impact = 1<br />end<br />&nbsp; &nbsp;<br />function stop_impact()<br />&nbsp; &nbsp; SOUND.impact = 0<br />end</p></blockquote></div>]]></content>
			<author>
				<name><![CDATA[Vegas]]></name>
				<uri>http://forum.maratis3d.com/profile.php?id=53</uri>
			</author>
			<updated>2012-09-13T10:29:10Z</updated>
			<id>http://forum.maratis3d.com/viewtopic.php?pid=2602#p2602</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Play sound once]]></title>
			<link rel="alternate" href="http://forum.maratis3d.com/viewtopic.php?pid=2601#p2601"/>
			<content type="html"><![CDATA[<p>Ok, I now have:<br /></p><div class="quotebox"><blockquote><p>Sound0 = getObject(&quot;Sound0&quot;)<br />IMPACT = {Sound0 = 0}<br />&nbsp; &nbsp;function play_impact()<br />&nbsp; &nbsp; &nbsp; &nbsp;if IMPACT.Sound0 == 0 then playSound(Sound0) end<br />&nbsp; &nbsp; &nbsp; &nbsp;IMPACT.Sound0 = 1<br />&nbsp; &nbsp;end<br />&nbsp; &nbsp;function stop_impact()<br />&nbsp; &nbsp;IMPACT.Sound0 = 0<br />&nbsp; &nbsp;end<br />function onSceneUpdate()<br />if isCollisionBetween(Car, Ground)<br />then changeCurrentCamera(Camera1)<br />deactivate(Text0)<br />deactivate(Text1)<br />camcycle = 1<br />if IMPACT.Sound0 == 0 then play_impact()<br />else<br />stop_impact()<br />end<br />end</p></blockquote></div><p>But it still loops. Any idea why?</p>]]></content>
			<author>
				<name><![CDATA[Almighty Laxz]]></name>
				<uri>http://forum.maratis3d.com/profile.php?id=1037</uri>
			</author>
			<updated>2012-09-13T10:09:27Z</updated>
			<id>http://forum.maratis3d.com/viewtopic.php?pid=2601#p2601</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Play sound once]]></title>
			<link rel="alternate" href="http://forum.maratis3d.com/viewtopic.php?pid=2600#p2600"/>
			<content type="html"><![CDATA[<p>I used that method into a test scene, maybe that&#039;s what you are looking for :</p><div class="quotebox"><blockquote><p>Bleep = getObject(&quot;Bleep&quot;)&nbsp; -- the sound file<br />SOUND = {bleep = 0}</p><p>function onSceneUpdate()<br />&nbsp; &nbsp; if isCollisionBetween(object1, object2) then<br />&nbsp; &nbsp; &nbsp; &nbsp; play_Bleep()<br />&nbsp; &nbsp; else<br />&nbsp; &nbsp; &nbsp; &nbsp; stop_Bleep()&nbsp; &nbsp; <br />&nbsp; &nbsp; end<br />end<br />&nbsp; &nbsp; <br />function play_Bleep()<br />&nbsp; &nbsp; if SOUND.bleep == 0 then playSound(Bleep) end<br />&nbsp; &nbsp; &nbsp; &nbsp;SOUND.bleep = 1<br />end</p><p>function stop_Bleep()<br />&nbsp; &nbsp; SOUND.bleep = 0<br />end</p></blockquote></div>]]></content>
			<author>
				<name><![CDATA[Vegas]]></name>
				<uri>http://forum.maratis3d.com/profile.php?id=53</uri>
			</author>
			<updated>2012-09-13T09:45:46Z</updated>
			<id>http://forum.maratis3d.com/viewtopic.php?pid=2600#p2600</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Play sound once]]></title>
			<link rel="alternate" href="http://forum.maratis3d.com/viewtopic.php?pid=2598#p2598"/>
			<content type="html"><![CDATA[<p>Hi,<br />I am having problems getting a sound to play once in my script.<br />At the start:<br />soundplay = 0<br />&nbsp; &nbsp;function playsound()<br />&nbsp; &nbsp; &nbsp; &nbsp;if soundplay == 0 then playSound(Sound0) end<br />&nbsp; &nbsp; &nbsp; &nbsp;soundplay = 1<br />&nbsp; &nbsp;end<br />Then:<br />function onSceneUpdate()<br />if isCollisionBetween(Car, Ground)<br />if soundplay == 0 then playsound()<br />else<br />soundplay = 0<br />end<br />end</p><p>It loops repeatedly, but I&#039;m not sure why, could anyone help?</p>]]></content>
			<author>
				<name><![CDATA[Almighty Laxz]]></name>
				<uri>http://forum.maratis3d.com/profile.php?id=1037</uri>
			</author>
			<updated>2012-09-13T08:55:36Z</updated>
			<id>http://forum.maratis3d.com/viewtopic.php?pid=2598#p2598</id>
		</entry>
</feed>
