Frictional Games Forum (read-only)
How do I get a Phonograph Working? - Printable Version

+- Frictional Games Forum (read-only) (https://www.frictionalgames.com/forum)
+-- Forum: Amnesia: The Dark Descent (https://www.frictionalgames.com/forum/forum-6.html)
+--- Forum: Custom Stories, TCs & Mods - Development (https://www.frictionalgames.com/forum/forum-38.html)
+---- Forum: Development Support (https://www.frictionalgames.com/forum/forum-39.html)
+---- Thread: How do I get a Phonograph Working? (/thread-12200.html)



How do I get a Phonograph Working? - Statyk - 12-30-2011

As simply put as the title, I am trying to get a phonograph to play a song, but it's not working... Don't shake your head that I have scripted it wrong... I haven't worked with a wheel/valve yet. =[

//____________________

void OnStart()
{
SetMultiSliderCallback("phonograph_1", "playsong"); //this was in the function wiki that sounded like what I needed

}



void playsong(string &in asEntity, int alState)
{
if(alState == 1)
{
PlaySoundAtEntity("", "phonosong.snt", "phonograph_1", 0, true);
}
if(alState == -1)
{

}
}


RE: How do I get a Phonograph Working? - Apjjm - 12-30-2011

It was done using ConnectionState in the ptest maps. You might want to try using the "ConnectionStateChange" callback which can be set in the level editor or through script using:
Code:
SetEntityConnectionStateChangeCallback(asName, asCallback);
//Callback syntax: void Func(string &in asEntity, int alState)




RE: How do I get a Phonograph Working? - Acies - 12-30-2011

Onstart()
{
SetEntityPlayerInteractCallback("phonograph_1", "PlaySong", true);
}


void PlaySong(string &in asEntity)
{
SetWheelStuckState("phonograph_1", 0, false);
PlaySoundAtEntity("", "12_make_drill.snt", asEntity, 0.0f,false);
SetEntityInteractionDisabled(asEntity, true);
AddTimer("PlayTimer", 4.0f , "PlayTimerX");
}


void PlayTimerX(string &in asTimer)
{
PlaySoundAtEntity("", "Alexandria_Song.snt", "phonograph_1", 0.5f, false);
}




RE: How do I get a Phonograph Working? - Statyk - 12-30-2011

(12-30-2011, 06:22 PM)Apjjm Wrote: It was done using ConnectionState in the ptest maps. You might want to try using the "ConnectionStateChange" callback which can be set in the level editor or through script using:
Code:
SetEntityConnectionStateChangeCallback(asName, asCallback);
//Callback syntax: void Func(string &in asEntity, int alState)
I tried that and it didn't do anything... >>




RE: How do I get a Phonograph Working? - Apjjm - 12-30-2011

(12-30-2011, 06:24 PM)Statyk Wrote: I tried that and it didn't do anything... >>
The following worked fine for me. Are you sure the problem isn't with the sound / misnaming?
Code:
void OnStart()
{
SetEntityConnectionStateChangeCallback("phonograph_1","cbConStatePhono1");
}

void cbConStatePhono1(string &in asEntity, int alState)
{
AddDebugMessage("Connection State Changed for: " + asEntity + " to "  + alState,false);
}



RE: How do I get a Phonograph Working? - Statyk - 12-30-2011

are you saying I should check for a debug response?
Okay... hold on for a second, I might have this...
....... This is going to be hard to admit, so don't lose faith in me...

But.

I was working on the wrong .hps the whole time.

See, I have 2 Theater.hps's, one for Sciophobia's "custom_story" folder, and one in the full conversion folder. I was working on the CS one, and testing the FC... >>

Thanks though! You still helped me out Apjjm, I really appreciate it =]