02-04-2012, 05:29 PM
So, i have a problem with a script. (im not getting errors).
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)
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);
}
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)
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);
}