Frictional Games Forum (read-only)

Full Version: Piano Scare script
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
So, i have a problem with a script. (im not getting errors). Dodgy

the script should do like this, the piano plays a song in a loop, but when you enter an a script area it will stop play and it will slam with dust comming.

The music loop works but not the slam and the dust particels. (sorry for bad english) Tongue

So here is the Script=

void OnStart()
{
AddTimer("pianotimer", 0, "pianotimer");
AddEntityCollideCallback("player", "pianostop", "pianostop", true, 1);
}

void pianotimer(string &in asTimer)
{
PlaySoundAtEntity("piano", "general_piano03", "piano", 0, false);
AddTimer("pianotimer", 18, "pianotimer");
}

void pianostop(string &in asParent, string &in asChild, int alState)
{
StopSound("piano", 0);
RemoveTimer("pianotimer");
SetLeverStuckState("piano", 0, true);
AddPropImpulse("piano", 0, 0, 100, "world");
PlaySoundAtEntity("piano", "break_wood", "piano", 0, false);
CreateParticleSystemAtEntity("", "st_impact.ps", "impact", false);
}

void OnStart()
{
AddTimer("pianotimer", 0, "pianotimer");
AddEntityCollideCallback("player", "pianostop", "pianostop", true, 1);
}

void pianotimer(string &in asTimer)
{
PlaySoundAtEntity("piano", "general_piano03", "piano", 0, false);
AddTimer("pianotimer", 18, "pianotimer");
}

void pianostop(string &in asParent, string &in asChild, int alState)
{
StopSound("piano", 0);
RemoveTimer("pianotimer");
SetLeverStuckState("piano", -1, true);
AddPropImpulse("piano", 0, 0, 100, "world");
PlaySoundAtEntity("piano", "break_wood", "piano", 0, false);
CreateParticleSystemAtEntity("", "ps_dust_impact.ps", "impact", false);
}
(02-04-2012, 05:41 PM)S4n1tyM0rs0 Wrote: [ -> ]void OnStart()
{
AddTimer("pianotimer", 0, "pianotimer");
AddEntityCollideCallback("player", "pianostop", "pianostop", true, 1);
}

void pianotimer(string &in asTimer)
{
PlaySoundAtEntity("piano", "general_piano03", "piano", 0, false);
AddTimer("pianotimer", 18, "pianotimer");
}

void pianostop(string &in asParent, string &in asChild, int alState)
{
StopSound("piano", 0);
RemoveTimer("pianotimer");
SetLeverStuckState("piano", -1, true);
AddPropImpulse("piano", 0, 0, 100, "world");
PlaySoundAtEntity("piano", "break_wood", "piano", 0, false);
CreateParticleSystemAtEntity("", "ps_dust_impact.ps", "impact", false);
}
yes you have right i think, i did test but it still didnt work :/

thanks for the help tho.


player has to be with capital letter Player, I think Smile
PHP Code:
void OnStart()
{
AddTimer("pianotimer"0"pianotimer");
AddEntityCollideCallback("player""pianostop""pianostop"true1);


is the name for the Area that stops the music "pianostop"?

If it is then you should try changing the name since you have 1 function and 1 area with the same name.
That cant be problem Smile. Function and area name can be same. I use that method a lot, since I am lazy to think new names Tongue.
Oh didn't know that Tongue Sorry for misleading hah
NP, we all study one or two things Smile
Its now fixed! Big Grin thanks for everything tho Big Grin