Wintermute Engine Forum
Wintermute Engine => Technical forum => Topic started by: Jose on February 13, 2011, 04:57:12 PM
-
Hi,
I've trying to use the PlaySoundEvent method in an scene_init.script but it seems that the event never rises. I've tried with this.PlaySoundEvent() and also creating an entity and executing the PlaySoundEvent from the entity but the event had been never rised.
If I execute the PlaySoundEvent from a script attached to a scene region entity then the event rises fine.
Anyone can help me?
Thanks in advance.
-
How exactly are you using the function? The event is triggered in the object that's used to play sound. So if you use "this.PlaySoundEvent()" in scene_init.script, "this" is a scene, so the event is triggered in scripts attached to a scene.
This should work.
-
Hi Mnemonic I've a scene_init.script like that
#include "scripts\base.inc"
// here comes the stuff which initializes the scene
this.PlaySoundEvent("music\intro\intro.ogg", "soundOver");
////////////////////////////////////////////////////////////////////////////////
on "soundOver"
{
Game.Msg("On event");
}
////////////////////////////////////////////////////////////////////////////////
// scene state
global Stateintro;
// default values
if(Stateintro==null)
{
Stateintro.Visited = false;
// add scene states here
}
////////////////////////////////////////////////////////////////////////////////
// setup scene according to state variables
////////////////////////////////////////////////////////////////////////////////
if(!Stateintro.Visited)
{
Stateintro.Visited = true;
// this is our first visit in this scene...
}
but when the game run, on that scene I can hear the sound but I can't see the message. Even if I set a breakpoint on the Game.Msg line the game doesn't stop on it.
-
Well, if this doesn't work, it's a bug, I'm afraid.
-
OK, I'll try to find a workaround ;)
Thanx!
-
It does seem to work for entities, only scene has a problem.
-
Yes, but only for entities created in Scene Editor. If you create it dynamically, for example in scene_init.script, it does neither work I think...
-
maybe I am missing something really obvious, whynot just
Scene.PlaySoundEvent()
-
I'm afraid it doesn't work either eborr...