(10-23-2011, 02:38 PM)Lemorz56 Wrote: HERE IS A BETTER VERSION
-----------------------------------------------------------------------------------------
void OnStart()
{
AddUseItemCallback("", "monsterdoorkey", "monsterdoor", "UsedKeyOnDoor", true);
AddEntityCollideCallback("Player", "ScriptArea_1", "PianoScare", false, 0);
AddEntityCollideCallback("Player", "ScriptArea_2", "PianoStop", false, 0);
}
void PianoScare(string &in asParent, string &in asChild, int alState)
{
if(alState == 1)
{
PlaySoundAtEntity("PianoScareMusic", "general_piano03.ogg", "piano_1", 0, false);
}
if(alState == -1)
{
StopSound("general_piano03.ogg", 5);
}
}
void pianotimer(string &in asTimer)
{
PlaySoundAtEntity("PianoScareMusic", "general_piano03.ogg", "piano_1", 0, false);
AddTimer("pianotimer", 18, "pianotimer");
}
void PianoStop(string &in asParent, string &in asChild, int alState)
{
StopSound("PianoScareMusic", 0);
RemoveTimer("pianotimer");
SetLeverStuckState("piano_01, 0, true);
AddPropImpulse("piano_01", 0, 0, 100, "World");
PlaySoundAtEntity("PianoScareBoom", "break_wood", "piano_1", 0, false);
CreateParticleSystemAtEntity("", "ps_dust_impact.ps", "impact", false);
}
void UsedKeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("monsterdoor", false, true);
PlaySoundAtEntity("", "unlock_door.snt", "monsterdoor", 0.0f, false);
RemoveItem("monsterdoorkey");
}
The
bold text means that you haven't closed your functions properly.
void OnStart()
{
AddUseItemCallback("", "monsterdoorkey", "monsterdoor", "UsedKeyOnDoor", true);
AddEntityCollideCallback("Player", "ScriptArea_1", "PianoScare", false, 0);
AddEntityCollideCallback("Player", "ScriptArea_2", "PianoStop", false, 0);
}
void PianoScare(string &in asParent, string &in asChild, int alState)
{
if(alState == 1)
}
PlaySoundAtEntity("PianoScareMusic", "general_piano03.ogg", "piano_1", 0, false);
{
if(alState == -1)
StopSound("general_piano03.ogg", 5);
}
void pianotimer(string &in asTimer)
{
PlaySoundAtEntity("PianoScareMusic", "general_piano03.ogg", "piano_1", 0, false);
AddTimer("pianotimer", 18, "pianotimer");
}
void PianoStop(string &in asParent, string &in asChild, int alState)
{
StopSound("PianoScareMusic", 0);
RemoveTimer("pianotimer");
SetLeverStuckState("piano_01, 0, true);
AddPropImpulse("piano_01", 0, 0, 100, "World");
PlaySoundAtEntity("PianoScareBoom", "break_wood", "piano_1", 0, false);
CreateParticleSystemAtEntity("", "ps_dust_impact.ps", "impact", false);
}
void UsedKeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("monsterdoor", false, true);
PlaySoundAtEntity("", "unlock_door.snt", "monsterdoor", 0.0f, false);
RemoveItem("monsterdoorkey");
}