Frictional Games Forum (read-only)
[SCRIPT] Piano Scare script - Printable Version

+- Frictional Games Forum (read-only) (https://www.frictionalgames.com/forum)
+-- Forum: Amnesia: The Dark Descent (https://www.frictionalgames.com/forum/forum-6.html)
+--- Forum: Custom Stories, TCs & Mods - Development (https://www.frictionalgames.com/forum/forum-38.html)
+---- Forum: Development Support (https://www.frictionalgames.com/forum/forum-39.html)
+---- Thread: [SCRIPT] Piano Scare script (/thread-13098.html)



Piano Scare script - Bors - 02-04-2012

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);
}




RE: Piano Scare script problem. - S4n1tyM0rs0 - 02-04-2012

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);
}



RE: Piano Scare script problem. - Bors - 02-04-2012

(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.





RE: Piano Scare script - Elven - 02-04-2012

player has to be with capital letter Player, I think Smile



RE: Piano Scare script - Ninami - 02-04-2012

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.


RE: Piano Scare script - Elven - 02-04-2012

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.



RE: Piano Scare script - Ninami - 02-05-2012

Oh didn't know that Tongue Sorry for misleading hah


RE: Piano Scare script - Elven - 02-05-2012

NP, we all study one or two things Smile



RE: Piano Scare script - Bors - 02-05-2012

Its now fixed! Big Grin thanks for everything tho Big Grin