05-10-2012, 12:41 PM
I have this little problem in my "Insanity Event"-thingy. When you enter an area alot of particle system become active and a chase moment occurs. It's just that if the person dies the particlesystems are still active ruining the entire thing.
SCRIPT:
void OnStart()
{
AddEntityCollideCallback("Player", "Trigger_Area_1", "Event_trigger1", false, 0);
SetEntityPlayerInteractCallback("diary_paper01_1", "Interact1", true);
}
void Interact1(string &in asEntity)
{
SetEntityActive("Trigger_Area_1", true);
CheckPoint ("One", "PlayerStartArea_2", "Reset_1", "", "");
}
void Event_trigger1(string &in asParent , string &in asChild , int alState)
{
AddTimer("Explo1", 3.0f, "Guardian_Spawn");
AddTimer("Explo2", 5.0f, "Guardian_Spawn");
AddTimer("Explo3", 10.0f, "Guardian_Spawn");
AddTimer("Explo4", 14.0f, "Guardian_Spawn");
AddTimer("Explo5", 18.0f, "Guardian_Spawn");
AddTimer("Explo6", 22.0f, "Guardian_Spawn");
}
void Guardian_Spawn(string &in asTimer)
{
if(asTimer == "Explo1"){
CreateParticleSystemAtEntity("", "ps_acid_web_dissolve.ps", "Particle_area_1", false);
PlaySoundAtEntity("", "guardian_distant.snt", "Death_Area_3", 1, false);
FadeSepiaColorTo(2.0f, 6.0f);
SetMessage("Descriptions", "Hint_4", 3.0f);
}
if(asTimer == "Explo2"){
PlayMusic("14_elevator_falls.ogg", true, 4.0f, 0, 0, true);
PlaySoundAtEntity("", ".snt", "", 1, false);
SetEntityActive("Death_Area_1", true);
SetEntityActive("Trigger_Area_1", false);
CreateParticleSystemAtEntity("ps1", "ps_guardian_appear_explosion.ps", "Explosion_Area_1", false);
CreateParticleSystemAtEntity("ps2", "ps_guardian_appear_explosion.ps", "Explosion_Area_2", false);
CreateParticleSystemAtEntity("ps3", "ps_guardian_appear_explosion.ps", "Explosion_Area_4", false);
}
if(asTimer == "Explo3"){
PlaySoundAtEntity("", ".snt", "", 1, false);
SetEntityActive("Death_Area_2", true);
CreateParticleSystemAtEntity("ps4", "ps_guardian_danger_fog_loop.ps", "Particle_area_1", false);
CreateParticleSystemAtEntity("ps5", "ps_guardian_danger_fog_loop.ps", "Particle_area_2", false);
CreateParticleSystemAtEntity("ps6", "ps_guardian_danger_fog_loop.ps", "Particle_area_3", false);
CreateParticleSystemAtEntity("ps7", "ps_guardian_appear_explosion.ps", "Explosion_Area_3", false);
CreateParticleSystemAtEntity("ps8", "ps_guardian_appear_explosion.ps", "Explosion_Area_5", false);
CreateParticleSystemAtEntity("ps9", "ps_guardian_appear_explosion.ps", "Explosion_Area_9", false);
}
if(asTimer == "Explo4"){
PlaySoundAtEntity("", ".snt", "", 1, false);
SetEntityActive("Death_Area_3", true);
CreateParticleSystemAtEntity("ps10", "ps_guardian_danger_fog_loop.ps", "Particle_area_4", false);
CreateParticleSystemAtEntity("ps11", "ps_guardian_danger_fog_loop.ps", "Particle_area_5", false);
CreateParticleSystemAtEntity("ps12", "ps_guardian_appear_explosion.ps", "Explosion_Area_6", false);
CreateParticleSystemAtEntity("ps13", "ps_guardian_appear_explosion.ps", "Explosion_Area_7", false);
CreateParticleSystemAtEntity("ps14", "ps_guardian_appear_explosion.ps", "Explosion_Area_8", false);
}
if(asTimer == "Explo5"){
PlaySoundAtEntity("", ".snt", "", 1, false);
SetEntityActive("Death_Area_4", true);
CreateParticleSystemAtEntity("ps15", "ps_guardian_danger_fog_loop.ps", "Particle_area_6", false);
CreateParticleSystemAtEntity("ps16", "ps_guardian_danger_fog_loop.ps", "Particle_area_7", false);
CreateParticleSystemAtEntity("ps17", "ps_guardian_appear_explosion.ps", "Explosion_Area_11", false);
CreateParticleSystemAtEntity("ps18", "ps_guardian_appear_explosion.ps", "Explosion_Area_12", false);
}
if(asTimer == "Explo6"){
PlaySoundAtEntity("", ".snt", "", 1, false);
SetEntityActive("Death_Area_5", true);
CreateParticleSystemAtEntity("ps19", "ps_guardian_appear_explosion.ps", "Explosion_Area_10", false);
CreateParticleSystemAtEntity("ps20", "ps_guardian_danger_fog_loop.ps", "Particle_area_8", false);
}
}
void Reset_1(string &in asName, int alCount)
{
ResetProp("Trigger_Area_1");
ResetProp("Death_Area_1");
ResetProp("Death_Area_2");
ResetProp("Death_Area_3");
ResetProp("Death_Area_4");
ResetProp("Death_Area_5");
SetEntityActive("Trigger_Area_1", true);
DestroyParticleSystem("ps1");
DestroyParticleSystem("ps2");
DestroyParticleSystem("ps3");
DestroyParticleSystem("ps4");
DestroyParticleSystem("ps5");
DestroyParticleSystem("ps6");
DestroyParticleSystem("ps7");
DestroyParticleSystem("ps8");
DestroyParticleSystem("ps9");
DestroyParticleSystem("ps10");
DestroyParticleSystem("ps11");
DestroyParticleSystem("ps12");
DestroyParticleSystem("ps13");
DestroyParticleSystem("ps14");
DestroyParticleSystem("ps15");
DestroyParticleSystem("ps16");
DestroyParticleSystem("ps17");
DestroyParticleSystem("ps18");
DestroyParticleSystem("ps19");
DestroyParticleSystem("ps20");
}
SCRIPT:
Spoiler below!
void OnStart()
{
AddEntityCollideCallback("Player", "Trigger_Area_1", "Event_trigger1", false, 0);
SetEntityPlayerInteractCallback("diary_paper01_1", "Interact1", true);
}
void Interact1(string &in asEntity)
{
SetEntityActive("Trigger_Area_1", true);
CheckPoint ("One", "PlayerStartArea_2", "Reset_1", "", "");
}
void Event_trigger1(string &in asParent , string &in asChild , int alState)
{
AddTimer("Explo1", 3.0f, "Guardian_Spawn");
AddTimer("Explo2", 5.0f, "Guardian_Spawn");
AddTimer("Explo3", 10.0f, "Guardian_Spawn");
AddTimer("Explo4", 14.0f, "Guardian_Spawn");
AddTimer("Explo5", 18.0f, "Guardian_Spawn");
AddTimer("Explo6", 22.0f, "Guardian_Spawn");
}
void Guardian_Spawn(string &in asTimer)
{
if(asTimer == "Explo1"){
CreateParticleSystemAtEntity("", "ps_acid_web_dissolve.ps", "Particle_area_1", false);
PlaySoundAtEntity("", "guardian_distant.snt", "Death_Area_3", 1, false);
FadeSepiaColorTo(2.0f, 6.0f);
SetMessage("Descriptions", "Hint_4", 3.0f);
}
if(asTimer == "Explo2"){
PlayMusic("14_elevator_falls.ogg", true, 4.0f, 0, 0, true);
PlaySoundAtEntity("", ".snt", "", 1, false);
SetEntityActive("Death_Area_1", true);
SetEntityActive("Trigger_Area_1", false);
CreateParticleSystemAtEntity("ps1", "ps_guardian_appear_explosion.ps", "Explosion_Area_1", false);
CreateParticleSystemAtEntity("ps2", "ps_guardian_appear_explosion.ps", "Explosion_Area_2", false);
CreateParticleSystemAtEntity("ps3", "ps_guardian_appear_explosion.ps", "Explosion_Area_4", false);
}
if(asTimer == "Explo3"){
PlaySoundAtEntity("", ".snt", "", 1, false);
SetEntityActive("Death_Area_2", true);
CreateParticleSystemAtEntity("ps4", "ps_guardian_danger_fog_loop.ps", "Particle_area_1", false);
CreateParticleSystemAtEntity("ps5", "ps_guardian_danger_fog_loop.ps", "Particle_area_2", false);
CreateParticleSystemAtEntity("ps6", "ps_guardian_danger_fog_loop.ps", "Particle_area_3", false);
CreateParticleSystemAtEntity("ps7", "ps_guardian_appear_explosion.ps", "Explosion_Area_3", false);
CreateParticleSystemAtEntity("ps8", "ps_guardian_appear_explosion.ps", "Explosion_Area_5", false);
CreateParticleSystemAtEntity("ps9", "ps_guardian_appear_explosion.ps", "Explosion_Area_9", false);
}
if(asTimer == "Explo4"){
PlaySoundAtEntity("", ".snt", "", 1, false);
SetEntityActive("Death_Area_3", true);
CreateParticleSystemAtEntity("ps10", "ps_guardian_danger_fog_loop.ps", "Particle_area_4", false);
CreateParticleSystemAtEntity("ps11", "ps_guardian_danger_fog_loop.ps", "Particle_area_5", false);
CreateParticleSystemAtEntity("ps12", "ps_guardian_appear_explosion.ps", "Explosion_Area_6", false);
CreateParticleSystemAtEntity("ps13", "ps_guardian_appear_explosion.ps", "Explosion_Area_7", false);
CreateParticleSystemAtEntity("ps14", "ps_guardian_appear_explosion.ps", "Explosion_Area_8", false);
}
if(asTimer == "Explo5"){
PlaySoundAtEntity("", ".snt", "", 1, false);
SetEntityActive("Death_Area_4", true);
CreateParticleSystemAtEntity("ps15", "ps_guardian_danger_fog_loop.ps", "Particle_area_6", false);
CreateParticleSystemAtEntity("ps16", "ps_guardian_danger_fog_loop.ps", "Particle_area_7", false);
CreateParticleSystemAtEntity("ps17", "ps_guardian_appear_explosion.ps", "Explosion_Area_11", false);
CreateParticleSystemAtEntity("ps18", "ps_guardian_appear_explosion.ps", "Explosion_Area_12", false);
}
if(asTimer == "Explo6"){
PlaySoundAtEntity("", ".snt", "", 1, false);
SetEntityActive("Death_Area_5", true);
CreateParticleSystemAtEntity("ps19", "ps_guardian_appear_explosion.ps", "Explosion_Area_10", false);
CreateParticleSystemAtEntity("ps20", "ps_guardian_danger_fog_loop.ps", "Particle_area_8", false);
}
}
void Reset_1(string &in asName, int alCount)
{
ResetProp("Trigger_Area_1");
ResetProp("Death_Area_1");
ResetProp("Death_Area_2");
ResetProp("Death_Area_3");
ResetProp("Death_Area_4");
ResetProp("Death_Area_5");
SetEntityActive("Trigger_Area_1", true);
DestroyParticleSystem("ps1");
DestroyParticleSystem("ps2");
DestroyParticleSystem("ps3");
DestroyParticleSystem("ps4");
DestroyParticleSystem("ps5");
DestroyParticleSystem("ps6");
DestroyParticleSystem("ps7");
DestroyParticleSystem("ps8");
DestroyParticleSystem("ps9");
DestroyParticleSystem("ps10");
DestroyParticleSystem("ps11");
DestroyParticleSystem("ps12");
DestroyParticleSystem("ps13");
DestroyParticleSystem("ps14");
DestroyParticleSystem("ps15");
DestroyParticleSystem("ps16");
DestroyParticleSystem("ps17");
DestroyParticleSystem("ps18");
DestroyParticleSystem("ps19");
DestroyParticleSystem("ps20");
}