AGP
Senior Member
Posts: 448
Threads: 45
Joined: Dec 2012
Reputation:
23
Phonograph and Waxroll Record
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);
}
12-24-2012, 02:16 AM
Rapture
Posting Freak
Posts: 1,078
Threads: 79
Joined: May 2011
Reputation:
30
RE: Phonograph and Waxroll Record
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!
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.
(This post was last modified: 12-24-2012, 03:11 AM by Rapture .)
12-24-2012, 03:09 AM
AGP
Senior Member
Posts: 448
Threads: 45
Joined: Dec 2012
Reputation:
23
RE: Phonograph and Waxroll Record
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. =/
12-24-2012, 04:16 AM
The chaser
Posting Freak
Posts: 2,486
Threads: 76
Joined: Jun 2012
Reputation:
113
RE: Phonograph and Waxroll Record
Do:
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?
THE OTHERWORLD (WIP)
Aculy iz dolan.
12-24-2012, 11:36 AM
AGP
Senior Member
Posts: 448
Threads: 45
Joined: Dec 2012
Reputation:
23
RE: Phonograph and Waxroll Record
(12-24-2012, 11:36 AM) The chaser Wrote: Do:
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.
12-24-2012, 08:30 PM
The chaser
Posting Freak
Posts: 2,486
Threads: 76
Joined: Jun 2012
Reputation:
113
RE: Phonograph and Waxroll Record
Well then:
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!
THE OTHERWORLD (WIP)
Aculy iz dolan.
12-24-2012, 08:51 PM
AGP
Senior Member
Posts: 448
Threads: 45
Joined: Dec 2012
Reputation:
23
RE: Phonograph and Waxroll Record
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?
12-24-2012, 11:49 PM
The chaser
Posting Freak
Posts: 2,486
Threads: 76
Joined: Jun 2012
Reputation:
113
RE: Phonograph and Waxroll Record
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);
THE OTHERWORLD (WIP)
Aculy iz dolan.
12-25-2012, 12:58 AM
AGP
Senior Member
Posts: 448
Threads: 45
Joined: Dec 2012
Reputation:
23
RE: Phonograph and Waxroll Record
(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?
(This post was last modified: 12-25-2012, 10:56 PM by AGP .)
12-25-2012, 03:56 AM
AGP
Senior Member
Posts: 448
Threads: 45
Joined: Dec 2012
Reputation:
23
RE: Phonograph and Waxroll Record
I extended the script area around the phonograph, and still nothing. No sound is heard. Am I just completely missing something?
12-26-2012, 09:29 AM