Facebook Twitter YouTube Frictional Games | Forum | Privacy Policy | Dev Blog | Dev Wiki | Support | Gametee


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How do I get a Phonograph Working?
Statyk Offline
Schrödinger's Mod

Posts: 4,390
Threads: 72
Joined: Sep 2011
Reputation: 241
#1
How do I get a Phonograph Working?

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)
{

}
}
(This post was last modified: 12-30-2011, 07:10 PM by Statyk.)
12-30-2011, 05:42 PM
Find
Apjjm Offline
Is easy to say

Posts: 496
Threads: 18
Joined: Apr 2011
Reputation: 52
#2
RE: How do I get a Phonograph Working?

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:
SetEntityConnectionStateChangeCallback(asName, asCallback);
//Callback syntax: void Func(string &in asEntity, int alState)

12-30-2011, 06:22 PM
Find
Acies Offline
Posting Freak

Posts: 1,643
Threads: 60
Joined: Feb 2011
Reputation: 73
#3
RE: How do I get a Phonograph Working?

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);
}


[Image: mZiYnxe.png]


12-30-2011, 06:22 PM
Find
Statyk Offline
Schrödinger's Mod

Posts: 4,390
Threads: 72
Joined: Sep 2011
Reputation: 241
#4
RE: How do I get a Phonograph Working?

(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:
SetEntityConnectionStateChangeCallback(asName, asCallback);
//Callback syntax: void Func(string &in asEntity, int alState)
I tried that and it didn't do anything... >>

12-30-2011, 06:24 PM
Find
Apjjm Offline
Is easy to say

Posts: 496
Threads: 18
Joined: Apr 2011
Reputation: 52
#5
RE: How do I get a Phonograph Working?

(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?
void OnStart()
{
SetEntityConnectionStateChangeCallback("phonograph_1","cbConStatePhono1");
}

void cbConStatePhono1(string &in asEntity, int alState)
{
AddDebugMessage("Connection State Changed for: " + asEntity + " to "  + alState,false);
}
(This post was last modified: 12-30-2011, 06:32 PM by Apjjm.)
12-30-2011, 06:31 PM
Find
Statyk Offline
Schrödinger's Mod

Posts: 4,390
Threads: 72
Joined: Sep 2011
Reputation: 241
#6
RE: How do I get a Phonograph Working?

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 =]
(This post was last modified: 12-30-2011, 07:10 PM by Statyk.)
12-30-2011, 06:40 PM
Find




Users browsing this thread: 1 Guest(s)