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
Phonograph Scripting Help
Adny Offline
Posting Freak

Posts: 1,766
Threads: 6
Joined: Mar 2012
Reputation: 173
#3
RE: Phonograph Scripting Help

Music is terrifying!

*Ahem* It appears the devs used entirely new functions for the Phonograph in Justine, most notably:

PlayPhono(int iLevel, int iSet, int iPart, string &in asEntity)

Sadly, this function doesn't even appear in the Engine Scripts wiki Page, and I have no clue what it does. If my assumption is correct, the crank for the phonograph works like a spinning wheel crank (meaning it has 3 main int states, -1 as closed, 0 as between and 1 as open). Here's what I can come up with (assuming that I'm correct about it acting like a crank).

Before writing out this script, go into your level editor, then find and select the phonograph that you want to play music at; next, click the "Entity" tab on the right hand side of the screen (next to "General" tab). Third from the top, there should be a line that says "ConnectionStateChangeCallback" with a white box under it; in this white box, copy and paste: "PhonographScare". Good, now we can script!

void PhonographScare(string &in EntityName, int aIState)
{
if(alCount == 1)
{
PlaySoundAtEntity("", NAMEOFSOUND, "Phonograph", 5.0f, false);
SetPropStaticPhysics("Phonograph", true);
}
}

In layman's terms, if the player turns the crank all the way, sound will play at the phonograph and the phonograph crank will become stuck in place, and can no longer be interacted with.

Change "Phonograph" to the exact name of your phonograph in game;
Also, change NAMEOFSOUND to the name of the song*

*The song MUST be in .ogg format; you must use a sound editor like Audacity to properly convert it.

SetPropStaticPhysics will make the phonograph act like a static object, preventing the player from further interaction with it after the sound is playing.

Note: I have not tested this in game, but it should work properly. If a more advanced/educated Scripter would like to revise this, feel free.

Hope that helped!

I rate it 3 memes.
06-15-2012, 02:39 PM
Find


Messages In This Thread
Phonograph Scripting Help - by HoyChampoy - 06-15-2012, 04:42 AM
RE: Phonograph Scripting Help - by Pigsareit - 06-15-2012, 02:02 PM
RE: Phonograph Scripting Help - by Adny - 06-15-2012, 02:39 PM
RE: Phonograph Scripting Help - by HoyChampoy - 06-18-2012, 07:30 AM
RE: Phonograph Scripting Help - by Adny - 06-18-2012, 11:27 AM
RE: Phonograph Scripting Help - by HoyChampoy - 06-19-2012, 07:27 AM



Users browsing this thread: 1 Guest(s)