08-30-2013, 10:19 PM
I've added an inactive statue on my map, I've double-checked that it has been set to inactive but still every time I try to make it appear by entering a trigger area it is already there. I have tried adding a script to set it to inactive on map entry but it does not work as well, he is still there before entering the script area. Any ideas? Here's my script file:
Code:
////////////////////////////
// Run first time starting map
void OnStart()
{
AddEntityCollideCallback("Player", "PlateBreak", "BreakPlate", true, 1);
AddEntityCollideCallback("Player", "Footstep", "Footsteps", true, 1);
AddEntityCollideCallback("Player", "TriggerVoice", "VoiceTrigger", true, 1);
SetEntityActive("ManScare", false);
}
void BreakPlate(string &in asParent, string &in asChild, int alState)
{
AddTimer("timer01", 1.5f, "BreakPlate1");
PlaySoundAtEntity("", "scare_tingeling.snt", "Player", 0, false);
}
void Footsteps(string &in asParent, string &in asChild, int alState)
{
PlaySoundAtEntity("", "scare_steps_big.snt", "candlestick_wall_10", 0, false);
}
void BreakPlate1(string &in asTimer)
{
SetPropHealth("plate_9", 0);
SetPropHealth("plate_3", 0);
SetPropHealth("plate_8", 0);
AddPropImpulse("chair_nice02_8", 4, 8, 0, "world");
AddPropImpulse("chair_nice02_11", 6, 10, 0, "world");
AddPropImpulse("chair_nice02_1", 0, 0, -14, "world");
GiveSanityDamage(3, true);
}
void ManScream(string &in asEntity, int alState)
{
PlaySoundAtEntity("", "scare_male_terrified5.snt", "Player", 0, false);
GiveSanityDamage(5, true);
}
void VoiceTrigger(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("ManScare", true);
PlaySoundAtEntity("", "enemy_hallucination_disappear.snt", "Player", 0, false);
AddTimer("timer02", 1.0f, "RemoveMan1");
}
void RemoveMan1(string &in asTimer)
{
SetEntityActive("ManScare", false);
}
////////////////////////////
// Run when entering map
void OnEnter()
{
StopMusic(0,1);
PlayMusic("02_amb_strange.ogg", true, 1, 4, 0, false);
}
////////////////////////////
// Run when leaving map
void OnLeave()
{
}