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
Failing on the phonograph
Acies Offline
Posting Freak

Posts: 1,643
Threads: 60
Joined: Feb 2011
Reputation: 73
#1
Failing on the phonograph

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

[Image: mZiYnxe.png]


08-23-2011, 01:22 AM
Find
palistov Offline
Posting Freak

Posts: 1,208
Threads: 67
Joined: Mar 2011
Reputation: 57
#2
RE: Failing on the phonograph

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.

08-23-2011, 07:25 AM
Find
Acies Offline
Posting Freak

Posts: 1,643
Threads: 60
Joined: Feb 2011
Reputation: 73
#3
RE: Failing on the phonograph

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.

[Image: mZiYnxe.png]


08-23-2011, 09:33 AM
Find
Acies Offline
Posting Freak

Posts: 1,643
Threads: 60
Joined: Feb 2011
Reputation: 73
#4
RE: Failing on the phonograph

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

[Image: mZiYnxe.png]


08-23-2011, 09:14 PM
Find
Tanshaydar Offline
From Beyond

Posts: 3,085
Threads: 17
Joined: Mar 2009
Reputation: 67
#5
RE: Failing on the phonograph

Completely blind:
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);
   }
}

08-24-2011, 08:10 AM
Website Find
Acies Offline
Posting Freak

Posts: 1,643
Threads: 60
Joined: Feb 2011
Reputation: 73
#6
RE: Failing on the phonograph

(08-24-2011, 08:10 AM)Tanshaydar Wrote: Completely blind:
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

[Image: mZiYnxe.png]


(This post was last modified: 08-24-2011, 10:52 AM by Acies.)
08-24-2011, 10:52 AM
Find
Tanshaydar Offline
From Beyond

Posts: 3,085
Threads: 17
Joined: Mar 2009
Reputation: 67
#7
RE: Failing on the phonograph

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.

08-24-2011, 10:57 AM
Website Find
Acies Offline
Posting Freak

Posts: 1,643
Threads: 60
Joined: Feb 2011
Reputation: 73
#8
RE: Failing on the phonograph

(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


[Image: mZiYnxe.png]


08-24-2011, 12:01 PM
Find
Tanshaydar Offline
From Beyond

Posts: 3,085
Threads: 17
Joined: Mar 2009
Reputation: 67
#9
RE: Failing on the phonograph

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

08-24-2011, 12:30 PM
Website Find
Elven Offline
Posting Freak

Posts: 862
Threads: 37
Joined: Aug 2011
Reputation: 26
#10
RE: Failing on the phonograph

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

The Interrogation
Chapter 1

My tutorials
(This post was last modified: 08-24-2011, 03:00 PM by Elven.)
08-24-2011, 02:59 PM
Find




Users browsing this thread: 1 Guest(s)