Frictional Games Forum (read-only)
Failing on the phonograph - 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: Failing on the phonograph (/thread-9934.html)



Failing on the phonograph - Acies - 08-23-2011

Hi! I'm failing to get a phonograph to play a sound.


This is a part of the original code:
Spoiler below!

// The phonograph by the entrance
void StateChangePhono01(string &in asEntity, int alState)
{
PlayPhono(2, 1, 2, asEntity);
}

// Play the phonograph messages on interact with phonograph
void PlayPhono(int iLevel, int iSet, int iPart, string &in sEntity)
{
SetEntityInteractionDisabled(sEntity, true); //No more interact with phono as it does not do anything.

SetLocalVarInt("PlayPhono", 1);

PlaySoundAtEntity("phono_scrape", "ptest_phono_loop", sEntity, 1.0f, false);

for(int i = 1;i<=iPart;i++)
AddEffectVoice("justine_rec_lvl"+iLevel+"_0"+iSet+"_0"+i+".ogg",
"",
"Recording", "justine_rec_lvl"+iLevel+"_0"+iSet+"_0"+i,
true, sEntity, 4, 16
);

SetEffectVoiceOverCallback("VoiceOverPhono");
}



This is my code:
Spoiler below!

void PlaySong(string &in asEntity, int alState)
{
SetEntityInteractionDisabled("asEntity", true);
SetEntityActive("wood_box02_13", true);
PlaySoundAtEntity("", "Alexandria_Song.snt", "phonograph_1", 0.5f, false);
}


I have put the function in the connectionstatecallback on the entity. I'd appreciate some help Smile


RE: Failing on the phonograph - palistov - 08-23-2011

Try making the entity for the connection state callback "phonograph_1_lever" or something like that. Open the entity in the model editor and see what the lever body is called and just append that onto your phonograph's name.


RE: Failing on the phonograph - Acies - 08-23-2011

It confuses me how that will affect it, since there are no name changes in justine. I'll give it a try though. On an off-topic note I will soon give you further details on the map I'm making for the community project.


RE: Failing on the phonograph - Acies - 08-23-2011

It didn't work. If someone has managed this I would appreciate any guidelines Smile


RE: Failing on the phonograph - Tanshaydar - 08-24-2011

Completely blind:
Code:
void PlaySong(string &in asEntity, int alState)
{
   if( alState == 1)
   {
                 SetEntityInteractionDisabled("asEntity", true);
                 SetEntityActive("wood_box02_13", true);
                 PlaySoundAtEntity("", "Alexandria_Song.snt", "phonograph_1", 0.5f, false);
   }
}



RE: Failing on the phonograph - Acies - 08-24-2011

(08-24-2011, 08:10 AM)Tanshaydar Wrote: Completely blind:
Code:
void PlaySong(string &in asEntity, int alState)
{
   if( alState == 1)
   {
                 SetEntityInteractionDisabled("asEntity", true);
                 SetEntityActive("wood_box02_13", true);
                 PlaySoundAtEntity("", "Alexandria_Song.snt", "phonograph_1", 0.5f, false);
   }
}

I have tried both alState 1 and alState -1. I'll give it a shot again though Smile



RE: Failing on the phonograph - Tanshaydar - 08-24-2011

Phonograph is basically a valve, so it has its states. The code you wrote would invoke regardless of the state.
In Justine, there are more than one functions bound to phonograph. You might want to take a look at all of them.


RE: Failing on the phonograph - Acies - 08-24-2011

(08-24-2011, 10:57 AM)Tanshaydar Wrote: Phonograph is basically a valve, so it has its states. The code you wrote would invoke regardless of the state.
In Justine, there are more than one functions bound to phonograph. You might want to take a look at all of them.

I have looked at what I percieve as "all of them". The ones I posted in the original post is the ones which makes it play a sound. I can not mimic it though, which is why I ask for help. If you could take the time to try it out I would appreciate that Smile




RE: Failing on the phonograph - Tanshaydar - 08-24-2011

Sure, I'll try it when I get home, now I don't have access to my pc. I want to use phonograph too.


RE: Failing on the phonograph - Elven - 08-24-2011

I used it this way and it worked:

void UseWaxOnPhono(string &in asItem, string &in asEntity)
{
SetWheelStuckState("bloopersphono", 0, false);
PlaySoundAtEntity("", "12_make_drill.snt", asEntity, 0.0f,false);
SetEntityPlayerInteractCallback("bloopersphono", "", false);
RemoveItem(asItem);
SetEntityConnectionStateChangeCallback("bloopersphono", "StateChangeBloopersPhono");
}

void StateChangeBloopersPhono(string &in asEntity, int alState)
{
if(alState != 1) return;
SetEntityInteractionDisabled(asEntity, true);

AddEffectVoice("bloopers_extra.ogg",
"",
"Recording", "Bloopers",
true, asEntity, 4, 16
);
}

On start I put:
AddUseItemCallback("bloopers", "bloopers_item", "bloopersphono", "UseWaxOnPhono", false);
SetWheelStuckState("bloopersphono", -1, false);

That brings back to the info that Wiki is wrong again. It asks in wiki entry first and then category, even tho it is opposite Tongue