Frictional Games Forum (read-only)
[SCRIPT] ParticleSystem not disappearing - 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] ParticleSystem not disappearing (/thread-15367.html)



ParticleSystem not disappearing - i3670 - 05-10-2012

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:

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

}





RE: ParticleSystem not disappearing - Your Computer - 05-10-2012

You should have received a syntax error with that code.

It's not going to have a chance of working until you give that last code block a function header (i'm guessing it's supposed to have the same syntax as a checkpoint callback).


RE: ParticleSystem not disappearing - i3670 - 05-10-2012

Ye forgot to put the syntax. Edited the post.


RE: ParticleSystem not disappearing - Your Computer - 05-10-2012

I'm going to say the culprit is the 0 and possibly even the false for the AddEntityCollideCallback in OnStart.


RE: ParticleSystem not disappearing - i3670 - 05-10-2012

So it should be:

AddEntityCollideCallback("Player", "Trigger_Area_1", "Event_trigger1", true, 1);

?

Tested it out but didn't seem to work. Also when I die I spawn in a really weird position and I can't move.


RE: ParticleSystem not disappearing - i3670 - 05-13-2012

Anyone know how to solve it? Cuz I don't.


RE: ParticleSystem not disappearing - Homicide13 - 05-13-2012

EDIT: Hurp, I'm good at reading.

I dunno, it should work.

The problem you're having is that the DestroyParticleSystem(string& asParticleSystem) isn't working?

Have you considered putting a debug message in your Reset_1 function to make 100% sure it works?


RE: ParticleSystem not disappearing - i3670 - 05-13-2012

Yes, when I die and get teleported to the checkpoint, the particlesystems are still active. So that's the problem and for some reason when I die I get revived in a really weird position and can't move.

As for the AddDebugMessage, I don't know how it works.