Stopping sound [UNRESOLVABLE]
Stopping sound [UNRESOLVABLE]
Hi,
i'm having some problem stopping a sound.
I made an object in map play sound, unfortunatelly this sound lasts 40 seconds and i need to stop it when i change map (because i can hear it even if i changed map vertically, no matter map distance from the one playing).
I'd like to stop it instead avoid problem making new map really far from the one playing sound.
So far i tryed to destroy item playing, let him play silence, going 20 levels down (in a new map).
Anyone has a clue for me?
Ty
i'm having some problem stopping a sound.
I made an object in map play sound, unfortunatelly this sound lasts 40 seconds and i need to stop it when i change map (because i can hear it even if i changed map vertically, no matter map distance from the one playing).
I'd like to stop it instead avoid problem making new map really far from the one playing sound.
So far i tryed to destroy item playing, let him play silence, going 20 levels down (in a new map).
Anyone has a clue for me?
Ty
Last edited by Granamir on Sat Mar 14, 2015 5:14 pm, edited 3 times in total.
Re: Stopping sound
Play your sound in a SoundComponent and use SoundComponent:stop() when you need to stop it.
Grimrock 1 dungeon
Grimrock 2 resources
I no longer answer scripting questions in private messages. Please ask in a forum topic or this Discord server.
Grimrock 2 resources
I no longer answer scripting questions in private messages. Please ask in a forum topic or this Discord server.
Re: Stopping sound
After some tests it come out it doesn't works.
Don't know why, on first try it worked perfectly. Later i tryed the whole procedure, step by step, that would lead party to play that sound and nothing happens. The i tryed to play it form console and again nothing happens, but if i play with playSound it works.
I tryed everything exept the right one.
Anyone can help me?
Ty
i used 2 sound object disabling their sound component so they don't start playing form begining.
I call that function with a timer. Tryed with a print to see if it goes inside that functon and everything is fine, except i don't hear anything.
Don't know why, on first try it worked perfectly. Later i tryed the whole procedure, step by step, that would lead party to play that sound and nothing happens. The i tryed to play it form console and again nothing happens, but if i play with playSound it works.
I tryed everything exept the right one.
Anyone can help me?
Ty
Code: Select all
function sottofondo()
sound_1.sound:enable()
sound_2.sound:enable()
sound_1.sound:play("soundA")
sound_2.sound:play("soundB")
endI call that function with a timer. Tryed with a print to see if it goes inside that functon and everything is fine, except i don't hear anything.
Re: Stopping sound
Is the party on the same level as the SoundComponent? If not, then of course they won't hear the sound. If you want a sound to persistently follow the party, adding SoundComponents to the party object will probably work.
Grimrock 1 dungeon
Grimrock 2 resources
I no longer answer scripting questions in private messages. Please ask in a forum topic or this Discord server.
Grimrock 2 resources
I no longer answer scripting questions in private messages. Please ask in a forum topic or this Discord server.
Re: Stopping sound
k i think i got it
seems if party is disabled sound played by sound object can't be heard
and for some reason when i started that level with party already disbled i wasn't able to hear sound anymore, even if i enabled party later on
...so is there a way to hear sounds even if party is disabled? or a way to stop playSound?
seems if party is disabled sound played by sound object can't be heard
and for some reason when i started that level with party already disbled i wasn't able to hear sound anymore, even if i enabled party later on
...so is there a way to hear sounds even if party is disabled? or a way to stop playSound?
Re: Stopping sound
Er...what on earth do you mean by "party is disabled"?
Grimrock 1 dungeon
Grimrock 2 resources
I no longer answer scripting questions in private messages. Please ask in a forum topic or this Discord server.
Grimrock 2 resources
I no longer answer scripting questions in private messages. Please ask in a forum topic or this Discord server.
Re: Stopping sound
this:minmay wrote:Er...what on earth do you mean by "party is disabled"?
Code: Select all
for i = 1, 4 do
party.party:getChampion(i):setEnabled(false)
endRe: Stopping sound
Oh. Yes, if all 4 party members are disabled, no 3d or ambient sounds will be heard. The solution is don't do that in a situation where you want 3d or ambient sounds to be heard.
Grimrock 1 dungeon
Grimrock 2 resources
I no longer answer scripting questions in private messages. Please ask in a forum topic or this Discord server.
Grimrock 2 resources
I no longer answer scripting questions in private messages. Please ask in a forum topic or this Discord server.
Re: Stopping sound
unfortunatelly i can't because of story reasons so i guess i have to use playSound with some limitations
Ty anyway
Ty anyway