Frictional Games Forum (read-only)
[SCRIPT] Particels won't work! - 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] Particels won't work! (/thread-13124.html)

Pages: 1 2


RE: Particels won't work! - Your Computer - 02-05-2012

(02-05-2012, 11:06 PM)Ninami Wrote: Yeah as I said, "If you simply add a particle on level editor it starts right away" like rain and fog.


If you want particles to spawn at certain times, you create particles with script (at least that's what I learned).


So there were 2 "problems" here, first he shouldn't have added a particle in level editor, and he named the .ps file wrong.


Am I right, "Your Computer"?

Yeah, if you want to have a particle system exist when colliding with an area, it needs to be done through scripts. I don't have any Portal_1.ps on my side, so unless he created it himself, then he's providing the wrong file path.


RE: Particels won't work! - Ninami - 02-05-2012

Awesome, it's fun to learn and then help others haha.

Btw thanks for the video on youtube, helped me understand more Smile
When I saw your name on the video I was like, Heey isn't that the guy from the forums Big Grin


RE: Particels won't work! - trollox - 02-06-2012

Then why won't this work it's exacly the name of the ps here's that script part :



void Portal(string &in asParent, string &in asChild, int alState)
{
CreateParticleSystemAtEntity("Portal_1", "guardian_appear_explosion.ps", "PortalAltar_1", false);
}


RE: Particels won't work! - Khyrpa - 02-06-2012

void CreateParticleSystemAtEntity(string& asPSName, string& asPSFile, string& asEntity, bool abSavePS);

asEntity - the entity to create the particle system at

You should have a script area with the name PortalAltar_1 where you want the particle to spawn




RE: Particels won't work! - trollox - 02-06-2012

Well this is what i read from the wiki
asPSName - internal name
asPSFile - the particle system to use + extension .p asEntity - the entity to create the particle system at
abSavePS - determines whether a particle system should “remember” its state

Which means this should work?


void Portal(string &in asParent, string &in asChild, int alState)
{
CreateParticleSystemAtEntity("PortalArea_1", "guardian_appear_explosion.ps", "PortalAltar_1", false);
}

But for some reason it dosen't and khypa i know you know this it'd be a lot easier if you could just write down the working script instead of giving me fact that i can't actually understand , like i said i'm new to scripting and this if my first time ever trying to work with particles


RE: Particels won't work! - Your Computer - 02-06-2012

Internal name (asPSName): generally optional, except where destruction of the particle system is desired. Can be called anything you want.

Particle system (asPSFile): file name + file extension of the particle system.

Entity (asEntity): name of entity to create particle system at (script areas, that is, areas of type script should work too).

State save (abSavePS): deals with game saves, whether to save the "state" of the particle system. Generally false.

Example usage:
PHP Code:
CreateParticleSystemAtEntity("GuardianPS""guardian_appear_explosion.ps""ScriptArea_1"false); 



RE: Particels won't work! - trollox - 02-06-2012

Well it still dosen't work add. Here's the intiere script :



void OnStart()
{
AddEntityCollideCallback("Player", "ScriptArea_1", "Door", true, 1);
AddEntityCollideCallback("Player", "ScriptArea_1", "Script", true, 1);
AddEntityCollideCallback("Player", "ScriptArea_2", "Door2", true, 1);
AddEntityCollideCallback("Player", "ScriptArea_3", "Door1", true, 1);
AddEntityCollideCallback("Player", "FlyingJesus_1", "Scare", true, 1);
AddEntityCollideCallback("Jesus_1", "FlyingJesus_1", "Sound", true, 1);
AddEntityCollideCallback("Player", "PortalArea_1", "Portal", true, 1);
}

void Door(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("Door_1", true);
SetEntityActive("ScriptArea_2", true);
SetEntityActive("ScriptArea_3", true);
}

void Door1(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("Door_1", false);
}

void Scare(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("Jesus_1", true);
AddPropForce("Jesus_1", 0, 0, 0, "World");
PlaySoundAtEntity("", "24_iron_maiden.snt", "FlyingJesus_1", 0, true);
}

void Door2(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("Door_2", true);
}

void Script(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("ScriptArea_2", true);
}

void Portal(string &in asParent, string &in asChild, int alState)
{
CreateParticleSystemAtEntity("PortalPs", "guardian_appear_explosion.ps", "PortalArea_1", false);
}


////////////////////////////
// Run when entering map
void OnEnter()
{

}

////////////////////////////
// Run when leaving map
void OnLeave()
{
}



Okay so the PortalPs i got no clue what that is. The "guardian_appear_explosion.ps" is the Particle. And the PortalArea_1 is the area you collide with. So i'm guessing that the PortalPs Has somthing to do with why it's not working. Sort of didn't understand what it is , and it's function



RE: Particels won't work! - Your Computer - 02-06-2012

The internal name can be anything, even an empty string. Its use is merely for sake of reference when used in combination with DestroyParticleSystem. For debugging purposes, you may want to add a debug message inside the collision callback to see if any collision has occurred. Secondly, try creating the particle system in an area that you don't collide with but is in plain sight of the player. Finally, try preloading the particle system with PreloadParticleSystem (in OnEnter).