Frictional Games Forum (read-only)

Full Version: Phonograph and Waxroll Record
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
I'm trying to script for using a waxroll record on the phonograph to play music, and afters many hours of research have been able to come up with zip.

This is what I was able to find, but I've no idea what to do with it.

Spoiler below!

StateChangePhono(string &in asEntity, int alState)
{
SetWheelInteractionDisablesStuck(asEntity, false);
SetWheelStuckState(asEntity, alState, false);

SetEntityInteractionDisabled("swanlakerecord", false);

PlaySoundAtEntity("PlayMusic", "swanlakephonograph.snt", "musicphono", 0, false);

AddDebugMessage("State changed to: "+alState, false);
}
I don't have your full code, so I have no idea to what your getting stuck on... Not even sure if the parameters are even correct, but can't know that without the full hps.
Spoiler below!
Code:
void OnStart()
{
void AddUseItemCallback("", "Item_Waxroll, "Entity_Phonograph_0", "Script_Entity_Phonograph_0", true);
}

void Intro()
{

}

void OnEnter()
{

}

void Script_Entity_Phonograph_0(string &in entity, string &in type)
{
SetWheelInteractionDisablesStuck(asEntity, false);
SetWheelStuckState(asEntity, alState, false);

SetEntityInteractionDisabled("swanlakerecord", false);
PlaySoundAtEntity("PlayMusic", "swanlakephonograph.snt", "musicphono", 0, false);

AddDebugMessage("State changed to: "+alState, false);
}

Edit: Your gonna have to fix up the spacing, I don't know why the forums keeps fracking up anything I type or paste.
Here's the whole file. It's probably painfully obvious I'm newbie to this.

Spoiler below!
void OnStart ()
{
AddUseItemCallback("", "workwingkey", "workwingdoor", "UsedKeyOnDoor1", true);

AddUseItemCallback("", "deadendkey", "deadenddoor", "UsedKeyOnDoor2", true);

AddUseItemCallback("", "swanlakerecord, "musicphono", "PlayMusic", true);
}

void OnEnter()
{

}

void OnLeave()
{
SetupLoadScreen("LoadingText", "LoadTextTwo", 1, "titlescreen.jpg");
}

void UsedKeyOnDoor1(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("workwingdoor", false, true);
PlaySoundAtEntity("", "unlock_door", "workwingdoor", 0, false);
RemoveItem("workwingkey");
}

void UsedKeyOnDoor2(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("deadenddoor", false, true);
PlaySoundAtEntity("", "unlock_door", "deadenddoor", 0, false);
RemoveItem("deadendkey");
}

void PlayMusic (string &in asItem, string &in asEntity)
{
PlaySoundAtEntity ("", "swanlakephonograph.snt", "musicphono", 0, false);

Attempted to fix it up some more, but got nowhere. =/
Do:

Code:
void OnStart()
{
///Your things
AddUseItemCallback("", "swanlakerecord, "musicphono", "PlayMusic", true);
}

void PlayMusic (string &in asItem, string &in asEntity)
{
SetWheelInteractionDisablesStuck(asEntity, false);

        SetWheelStuckState(asEntity, alState, false);

    

        SetEntityInteractionDisabled("swanlakerecord", false);

    

        PlaySoundAtEntity("PlayMusic", "swanlakephonograph.snt", "musicphono", 0, false);

    

        AddDebugMessage("State changed to: "+alState, false);
}

Although I'm not really sure what you want. Do you want to play the music when you use the item, or you want to use the item and then moving the wheel so it plays?
(12-24-2012, 11:36 AM)The chaser Wrote: [ -> ]Do:

Code:
void OnStart()
{
///Your things
AddUseItemCallback("", "swanlakerecord, "musicphono", "PlayMusic", true);
}

void PlayMusic (string &in asItem, string &in asEntity)
{
SetWheelInteractionDisablesStuck(asEntity, false);

        SetWheelStuckState(asEntity, alState, false);

    

        SetEntityInteractionDisabled("swanlakerecord", false);

    

        PlaySoundAtEntity("PlayMusic", "swanlakephonograph.snt", "musicphono", 0, false);

    

        AddDebugMessage("State changed to: "+alState, false);
}

Although I'm not really sure what you want. Do you want to play the music when you use the item, or you want to use the item and then moving the wheel so it plays?

Use item and move wheel.
Well then:

Code:
void OnStart()

{
SetEntityInteractionDisabled("musicphono", true);

AddUseItemCallback("", "swanlakerecord, "musicphono", "AllowInteract", true);

}

void AllowInteract (string &in asItem, string &in asEntity)
{
SetEntityInteractionDisabled("musicphono", false);
}



void PlayMusic (string &in asEntity, int alState)

{

SetWheelInteractionDisablesStuck(asEntity, false);



        SetWheelStuckState(asEntity, alState, false);



    



        SetEntityInteractionDisabled("swanlakerecord", false);



    



        PlaySoundAtEntity("PlayMusic", "swanlakephonograph.snt", "musicphono", 0, false);



    



        AddDebugMessage("State changed to: "+alState, false);

}

Merry christmas!
Fantastic! It now allows for the item to be used without error! Thanks a ton!

The music doesn't start up though, at least, not that I could hear. There is a way to adjust the volume, but via script, but I don't remember exactly what it was, and just to make sure does the script include for it to play the music or does it need to be altered slightly for this to work?
Make a new area surrounding and adapting the shape of the phonograph and call it "soundarea". Then, use the



PlaySoundAtEntity("PlayMusic", "swanlakephonograph.snt", "soundarea", 0, false);
(12-25-2012, 12:58 AM)The chaser Wrote: [ -> ]Make a new area surrounding and adapting the shape of the phonograph and call it "soundarea". Then, use the



PlaySoundAtEntity("PlayMusic", "swanlakephonograph.snt", "soundarea", 0, false);

Where in the hps file should that go?

EDIT: All right, so I put the script into the hps file, however, the music still doesn't play. Should the area over the phonograph actually extend to the whole map, or is there something I should be doing different?
I extended the script area around the phonograph, and still nothing. No sound is heard. Am I just completely missing something?
Pages: 1 2