EmC-Unit Posted September 6, 2014 Report Share Posted September 6, 2014 Hey people, i'm trying to add a sound in the script when action happens and need your help, everything iv'e tryed - failed object Strahlung_messen : CommandScript{ Strahlung_messen() { SetIcon("geiger"); SetCursor("geiger"); SetValidTargets(ACTOR_FLOOR | ACTOR_STREET); } bool CheckTarget(GameObject *Caller, Actor *Target, int childID) { return true; } void PushActions(GameObject *Caller, Actor *Target, int childID) { Vector tpos = Game::GetCommandPos(); if(Game::IsInTrigger("flu01", tpos))// Name des Triggers { Caller->PushActionMove(ACTION_APPEND, tpos); Caller->PushActionSwitchAnim(ACTION_APPEND,"useobjmid"); Caller->PushActionWait(ACTION_APPEND, 5); Caller->PushActionExecuteCommand(ACTION_APPEND,"Meldung1",Target); return; } else { Caller->PushActionMove(ACTION_APPEND, tpos); Caller->PushActionSwitchAnim(ACTION_APPEND,"useobjmid"); Caller->PushActionWait(ACTION_APPEND, 5); Caller->PushActionExecuteCommand(ACTION_APPEND,"Meldung2",Target); } }};object Meldung1: CommandScript{ Meldung1() { SetIcon("geiger"); SetCursor("geiger"); } bool CheckTarget(GameObject *Caller, Actor *Target, int childID) { return true; } void PushActions(GameObject *Caller, Actor *Target, int childID) { Mission::PlayHint("!!!!!!"); }};object Meldung2: CommandScript{ Meldung2() { SetIcon("geiger"); SetCursor("geiger"); } bool CheckTarget(GameObject *Caller, Actor *Target, int childID) { return true; } void PushActions(GameObject *Caller, Actor *Target, int childID) { Mission::PlayHint("T"); }};Can anybody helps me with what line should i add so it works? it should be simple Quote Link to comment Share on other sites More sharing options...
Hoppah Posted September 7, 2014 Report Share Posted September 7, 2014 I assume you want to play an audio file in those 2 'Meldung' scripts? try: Audio::PlaySample("mod:Audio/FX/Misc/blah.wav"); Obviously, you gotta change the path to the file.This simply plays an audio file. In case you want to play the sound from a specific location on the map, use this: Vector pos = Caller->GetPosition();Audio::PlaySample3D("mod:Audio/FX/mod:Audio/FX/Misc/blah.wav", pos, false); Quote Link to comment Share on other sites More sharing options...
EmC-Unit Posted September 7, 2014 Author Report Share Posted September 7, 2014 I assume you want to play an audio file in those 2 'Meldung' scripts? try: Audio::PlaySample("mod:Audio/FX/Misc/blah.wav"); Obviously, you gotta change the path to the file.This simply plays an audio file. In case you want to play the sound from a specific location on the map, use this: Vector pos = Caller->GetPosition();Audio::PlaySample3D("mod:Audio/FX/mod:Audio/FX/Misc/blah.wav", pos, false);Yes in Meldung. Thank you sir, it works! Quote Link to comment Share on other sites More sharing options...