How to use the Sound Game Object
How to use the Sound Game Object
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
-
- Posts: 168
- Joined: Thu Oct 30, 2014 1:56 am
Re: How to use the Sound Game Object
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
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
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.
So like... skeleton_commander_1.monster
Not 100% certain, coding is not something I'm good at.
-
- Posts: 168
- Joined: Thu Oct 30, 2014 1:56 am
Re: How to use the Sound Game Object
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:
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
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?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
-
- Posts: 168
- Joined: Thu Oct 30, 2014 1:56 am
Re: How to use the Sound Game Object
I don't think that type of connection is possible, don't know why.