Page 1 of 1

How to use the Sound Game Object

Posted: Sat Nov 08, 2014 6:51 am
by Echoplex
So I recently stumbled onto this what seemed to be awesome object to place and utilize however I cant seem to get it to run correctly. I can pick the sound out but it seems to fire off immediately at the start of the level. I tried connecting plates to it to activate when stepped on, disabling sound and controller in the object to stop it from preemptively firing off but all that seems to do is disable it permanently. So my question is: How would I script and match this thing up to fire off at a specific time or place? Thanks

Re: How to use the Sound Game Object

Posted: Sat Nov 08, 2014 5:01 pm
by GoldenShadowGS
This is pretty simple: uncheck the sound component if you want it to start silent.

Code: Select all

function soundenable()
	if lever_1.lever:isActivated() then
	sound_1.sound:enable()
	else
	sound_1.sound:disable()
	end
end

Re: How to use the Sound Game Object

Posted: Sun Nov 09, 2014 12:18 am
by Echoplex
So I tried to fit that into what I was doing and am still hitting errors. Heres what I have. Im getting errors with the then statement so im not sure where to put it. I tried several different places.

Code: Select all

function laugh()
     if skeleton_commander_1:die();
      die = true; then
     sound_1.sound:enable()
     else
     sound_1.sound:disable()
     end
end

Re: How to use the Sound Game Object

Posted: Sun Nov 09, 2014 12:32 am
by Oxijyn
I think you need a .monster after the end of skeleton_commander_1

So like... skeleton_commander_1.monster

Not 100% certain, coding is not something I'm good at.

Re: How to use the Sound Game Object

Posted: Sun Nov 09, 2014 1:22 am
by GoldenShadowGS
if you just want to turn the sound on when a certain enemy is killed, try this:

Do a connector from the monster to the script entity. OnDie, Script_entity_1, soundon

In the script put this:

Code: Select all

function soundon()
sound_1.sound:enable()
end

Re: How to use the Sound Game Object

Posted: Sun Nov 09, 2014 2:33 am
by Echoplex
GoldenShadowGS wrote:if you just want to turn the sound on when a certain enemy is killed, try this:

Do a connector from the monster to the script entity. OnDie, Script_entity_1, soundon

In the script put this:

Code: Select all

function soundon()
sound_1.sound:enable()
end
Thanks that ended up working nicely. Is there a reason why you just cant unclick the sound on the sound object and then tie it to on die connector?

Re: How to use the Sound Game Object

Posted: Sun Nov 09, 2014 2:35 am
by GoldenShadowGS
I don't think that type of connection is possible, don't know why.