Frictional Games Forum (read-only)
[Solved] Scripting in need of help:/ - 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: [Solved] Scripting in need of help:/ (/thread-13699.html)

Pages: 1 2


[Solved] Scripting in need of help:/ - Froggit - 03-02-2012

When I walk into "ScriptArea_3" I want all of the lights to fade to "pointlight_25". I made a physical feature called "ParticleSystem_3" which I want to activate when I enter "ScriptArea_3" (ps_dust_whirl.ps) and the lights are "light1" and "light2". Plus I want a sound of dust whirl when enter "ScriptArea_3" but I dont know the file for that.I'm wondering if someone could post a script for It because I have no idea how to:/ . I'm really sorry if this is too much but i'm trying to perfect this mod for PewDiePie.
Thank you for any help




RE: Scripting in need of help:/ - flamez3 - 03-02-2012

inb4flaming.

void OnStart()
{
AddEntityCollideCalbback("Player", "ScriptArea_3", "LightFade", true, 1);
}

void LightFade(string &in asParent, string &in asChild, int alState)
{
SetLightVisible("pointlight_0", false);
SetLightVisible("pointlight_1", false);
SetLightVisible("pointlight_2", false);
CreateParticleSystemAtEntity("ps", "ps_dust_whirl.ps", "ScriptAreaParticle", true);
SetLightVisible("light1", true);
SetLightVisible("light2", true);
PlaySoundAtEntity("", "nameofsound, "ScriptAreaParticle", 0, true);
}

Now repeat the lightvisible event until pointlight_25. There are easier ways of doing this but for your sake just do it this way.

For the createpartclesystematentity, delete the particlesystem in the level editor and make a ScriptArea in the exact place you want it to go. And rename it to ScriptAreaParticle


Any other questions just ask.




RE: flamez3 - Froggit - 03-02-2012

@flamez3 It says error(102, 2) //Its probably obvious but i'm not good at this. P.S: If your the flamez3 that made/makes maps for PewdiePie your frickin' beast.
////////////////////////////
// Run when entering map
void OnEnter()
{
}
void OnStart()
{
AddEntityCollideCallback("Player", "ScriptArea_1", "MonsterFunction", true, 1);
AddEntityCollideCallback("Player", "ScriptArea_2", "dust", true, 1);
AddEntityCollideCallback("Player", "ScriptArea_3", "LightFade", true, 1);

}
void MonsterFunction(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("servant_brute_1", true);
AddEnemyPatrolNode("servant_brute_1", "PathNodeArea_1", 2, "");
AddEnemyPatrolNode("servant_brute_1", "PathNodeArea_2", 0, "");
AddEnemyPatrolNode("servant_brute_1", "PathNodeArea_3", 0, "");
AddEnemyPatrolNode("servant_brute_1", "PathNodeArea_4", 0, "");
AddEnemyPatrolNode("servant_brute_1", "PathNodeArea_5", 0, "");
AddEnemyPatrolNode("servant_brute_1", "PathNodeArea_6", 0, "");
AddEnemyPatrolNode("servant_brute_1", "PathNodeArea_7", 0, "");
AddEnemyPatrolNode("servant_brute_1", "PathNodeArea_8", 0, "");
AddEnemyPatrolNode("servant_brute_1", "PathNodeArea_9", 0, "");
AddEnemyPatrolNode("servant_brute_1", "PathNodeArea_10", 0, "");
AddEnemyPatrolNode("servant_brute_1", "PathNodeArea_11", 0, "");
AddEnemyPatrolNode("servant_brute_1", "PathNodeArea_12", 0, "");
AddEnemyPatrolNode("servant_brute_1", "PathNodeArea_13", 0, "");
}
void dust(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("ParticleSystem_2", true);
}
void LightFade(string &in asParent, string &in asChild, int alState)
{
SetLightVisible("pointlight_0", false);
SetLightVisible("pointlight_1", false);
SetLightVisible("pointlight_2", false);
SetLightVisible("pointlight_3", false);
SetLightVisible("pointlight_4", false);
SetLightVisible("pointlight_5", false);
SetLightVisible("pointlight_6", false);
SetLightVisible("pointlight_7", false);
SetLightVisible("pointlight_8", false);
SetLightVisible("pointlight_9", false);
SetLightVisible("pointlight_10", false);
SetLightVisible("pointlight_11", false);
SetLightVisible("pointlight_12", false);
SetLightVisible("pointlight_13", false);
SetLightVisible("pointlight_14", false);
SetLightVisible("pointlight_15", false);
SetLightVisible("pointlight_16", false);
SetLightVisible("pointlight_17", false);
SetLightVisible("pointlight_18", false);
SetLightVisible("pointlight_19", false);
SetLightVisible("pointlight_20", false);
SetLightVisible("pointlight_21", false);
SetLightVisible("pointlight_22", false);
SetLightVisible("pointlight_23", false);
SetLightVisible("pointlight_24", false);
SetLightVisible("pointlight_25", false);
CreateParticleSystemAtEntity("ps", "ps_dust_whirl.ps", "ScriptAreaParticle", true);
SetLightVisible("torch_static01_1", true);
SetLightVisible("torch_static01_2", true);
SetLightVisible("torch_static01_3", true);
SetLightVisible("torch_static01_4", true);
SetLightVisible("torch_static01_5", true);
SetLightVisible("torch_static01_6", true);
SetLightVisible("torch_static01_7", true);
SetLightVisible("torch_static01_8", true);
SetLightVisible("torch_static01_9", true);
SetLightVisible("torch_static01_10", true);
SetLightVisible("torch_static01_11", true);
SetLightVisible("torch_static01_12", true);
SetLightVisible("torch_static01_13", true);
SetLightVisible("torch_static01_14", true);
SetLightVisible("torch_static01_15", true);
SetLightVisible("torch_static01_16", true);
SetLightVisible("torch_static01_17", true);
SetLightVisible("torch_static01_18", true);
SetLightVisible("torch_static01_19", true);
SetLightVisible("torch_static01_20", true);
SetLightVisible("torch_static01_21", true);
SetLightVisible("torch_static01_22", true);
SetLightVisible("torch_static01_23", true);
PlaySoundAtEntity("", "sound3, "ScriptAreaParticle", 0, true);
}

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



RE: Scripting in need of help:/ - flamez3 - 03-02-2012

Use this:

void OnStart()
{
AddEntityCollideCallback("Player", "ScriptArea_1", "MonsterFunction", true, 1);
AddEntityCollideCallback("Player", "ScriptArea_2", "dust", true, 1);
AddEntityCollideCallback("Player", "ScriptArea_3", "LightFade", true, 1);

}
void MonsterFunction(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("servant_brute_1", true);
AddEnemyPatrolNode("servant_brute_1", "PathNodeArea_1", 2, "");
AddEnemyPatrolNode("servant_brute_1", "PathNodeArea_2", 0, "");
AddEnemyPatrolNode("servant_brute_1", "PathNodeArea_3", 0, "");
AddEnemyPatrolNode("servant_brute_1", "PathNodeArea_4", 0, "");
AddEnemyPatrolNode("servant_brute_1", "PathNodeArea_5", 0, "");
AddEnemyPatrolNode("servant_brute_1", "PathNodeArea_6", 0, "");
AddEnemyPatrolNode("servant_brute_1", "PathNodeArea_7", 0, "");
AddEnemyPatrolNode("servant_brute_1", "PathNodeArea_8", 0, "");
AddEnemyPatrolNode("servant_brute_1", "PathNodeArea_9", 0, "");
AddEnemyPatrolNode("servant_brute_1", "PathNodeArea_10", 0, "");
AddEnemyPatrolNode("servant_brute_1", "PathNodeArea_11", 0, "");
AddEnemyPatrolNode("servant_brute_1", "PathNodeArea_12", 0, "");
AddEnemyPatrolNode("servant_brute_1", "PathNodeArea_13", 0, "");
}
void dust(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("ParticleSystem_2", true);
}
void LightFade(string &in asParent, string &in asChild, int alState)
{
SetLightVisible("pointlight_0", false);
SetLightVisible("pointlight_1", false);
SetLightVisible("pointlight_2", false);
SetLightVisible("pointlight_3", false);
SetLightVisible("pointlight_4", false);
SetLightVisible("pointlight_5", false);
SetLightVisible("pointlight_6", false);
SetLightVisible("pointlight_7", false);
SetLightVisible("pointlight_8", false);
SetLightVisible("pointlight_9", false);
SetLightVisible("pointlight_10", false);
SetLightVisible("pointlight_11", false);
SetLightVisible("pointlight_12", false);
SetLightVisible("pointlight_13", false);
SetLightVisible("pointlight_14", false);
SetLightVisible("pointlight_15", false);
SetLightVisible("pointlight_16", false);
SetLightVisible("pointlight_17", false);
SetLightVisible("pointlight_18", false);
SetLightVisible("pointlight_19", false);
SetLightVisible("pointlight_20", false);
SetLightVisible("pointlight_21", false);
SetLightVisible("pointlight_22", false);
SetLightVisible("pointlight_23", false);
SetLightVisible("pointlight_24", false);
SetLightVisible("pointlight_25", false);
CreateParticleSystemAtEntity("ps", "ps_dust_whirl.ps", "ScriptAreaParticle", true);
SetLightVisible("torch_static01_1", true);
SetLightVisible("torch_static01_2", true);
SetLightVisible("torch_static01_3", true);
SetLightVisible("torch_static01_4", true);
SetLightVisible("torch_static01_5", true);
SetLightVisible("torch_static01_6", true);
SetLightVisible("torch_static01_7", true);
SetLightVisible("torch_static01_8", true);
SetLightVisible("torch_static01_9", true);
SetLightVisible("torch_static01_10", true);
SetLightVisible("torch_static01_11", true);
SetLightVisible("torch_static01_12", true);
SetLightVisible("torch_static01_13", true);
SetLightVisible("torch_static01_14", true);
SetLightVisible("torch_static01_15", true);
SetLightVisible("torch_static01_16", true);
SetLightVisible("torch_static01_17", true);
SetLightVisible("torch_static01_18", true);
SetLightVisible("torch_static01_19", true);
SetLightVisible("torch_static01_20", true);
SetLightVisible("torch_static01_21", true);
SetLightVisible("torch_static01_22", true);
SetLightVisible("torch_static01_23", true);
PlaySoundAtEntity("", "sound3", "ScriptAreaParticle", 0, true);
}

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

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

On PlaySoundAtEntity in the last function you didn't use the " on the end of sound3.


RE: flamez3 - Froggit - 03-02-2012

(03-02-2012, 05:41 AM)flamez3 Wrote: Use this:

void OnStart()
{
AddEntityCollideCallback("Player", "ScriptArea_1", "MonsterFunction", true, 1);
AddEntityCollideCallback("Player", "ScriptArea_2", "dust", true, 1);
AddEntityCollideCallback("Player", "ScriptArea_3", "LightFade", true, 1);

}
void MonsterFunction(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("servant_brute_1", true);
AddEnemyPatrolNode("servant_brute_1", "PathNodeArea_1", 2, "");
AddEnemyPatrolNode("servant_brute_1", "PathNodeArea_2", 0, "");
AddEnemyPatrolNode("servant_brute_1", "PathNodeArea_3", 0, "");
AddEnemyPatrolNode("servant_brute_1", "PathNodeArea_4", 0, "");
AddEnemyPatrolNode("servant_brute_1", "PathNodeArea_5", 0, "");
AddEnemyPatrolNode("servant_brute_1", "PathNodeArea_6", 0, "");
AddEnemyPatrolNode("servant_brute_1", "PathNodeArea_7", 0, "");
AddEnemyPatrolNode("servant_brute_1", "PathNodeArea_8", 0, "");
AddEnemyPatrolNode("servant_brute_1", "PathNodeArea_9", 0, "");
AddEnemyPatrolNode("servant_brute_1", "PathNodeArea_10", 0, "");
AddEnemyPatrolNode("servant_brute_1", "PathNodeArea_11", 0, "");
AddEnemyPatrolNode("servant_brute_1", "PathNodeArea_12", 0, "");
AddEnemyPatrolNode("servant_brute_1", "PathNodeArea_13", 0, "");
}
void dust(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("ParticleSystem_2", true);
}
void LightFade(string &in asParent, string &in asChild, int alState)
{
SetLightVisible("pointlight_0", false);
SetLightVisible("pointlight_1", false);
SetLightVisible("pointlight_2", false);
SetLightVisible("pointlight_3", false);
SetLightVisible("pointlight_4", false);
SetLightVisible("pointlight_5", false);
SetLightVisible("pointlight_6", false);
SetLightVisible("pointlight_7", false);
SetLightVisible("pointlight_8", false);
SetLightVisible("pointlight_9", false);
SetLightVisible("pointlight_10", false);
SetLightVisible("pointlight_11", false);
SetLightVisible("pointlight_12", false);
SetLightVisible("pointlight_13", false);
SetLightVisible("pointlight_14", false);
SetLightVisible("pointlight_15", false);
SetLightVisible("pointlight_16", false);
SetLightVisible("pointlight_17", false);
SetLightVisible("pointlight_18", false);
SetLightVisible("pointlight_19", false);
SetLightVisible("pointlight_20", false);
SetLightVisible("pointlight_21", false);
SetLightVisible("pointlight_22", false);
SetLightVisible("pointlight_23", false);
SetLightVisible("pointlight_24", false);
SetLightVisible("pointlight_25", false);
CreateParticleSystemAtEntity("ps", "ps_dust_whirl.ps", "ScriptAreaParticle", true);
SetLightVisible("torch_static01_1", true);
SetLightVisible("torch_static01_2", true);
SetLightVisible("torch_static01_3", true);
SetLightVisible("torch_static01_4", true);
SetLightVisible("torch_static01_5", true);
SetLightVisible("torch_static01_6", true);
SetLightVisible("torch_static01_7", true);
SetLightVisible("torch_static01_8", true);
SetLightVisible("torch_static01_9", true);
SetLightVisible("torch_static01_10", true);
SetLightVisible("torch_static01_11", true);
SetLightVisible("torch_static01_12", true);
SetLightVisible("torch_static01_13", true);
SetLightVisible("torch_static01_14", true);
SetLightVisible("torch_static01_15", true);
SetLightVisible("torch_static01_16", true);
SetLightVisible("torch_static01_17", true);
SetLightVisible("torch_static01_18", true);
SetLightVisible("torch_static01_19", true);
SetLightVisible("torch_static01_20", true);
SetLightVisible("torch_static01_21", true);
SetLightVisible("torch_static01_22", true);
SetLightVisible("torch_static01_23", true);
PlaySoundAtEntity("", "sound3", "ScriptAreaParticle", 0, true);
}

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

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

On PlaySoundAtEntity in the last function you didn't use the " on the end of sound3.

My map worked but the flamez3 didn't fade. Should I fit the script area to the size of the room maby? I dont know but thank you tons for helping me bro.


RE: Scripting in need of help:/ - flamez3 - 03-02-2012

What exactly do you mean fade? Setting it invisible will fade it (although not very good)


RE: flamez3 - Froggit - 03-02-2012

(03-02-2012, 03:10 PM)flamez3 Wrote: What exactly do you mean fade? Setting it invisible will fade it (although not very good)
Like in the first map of amnesia when you walk in one of the rooms at the end and all of the lights go out. So when I walk into a room filled with lights(torches) I want all of them to go out. With the particle gust of wind and sound gust of wind when I walk into the room on the same scrip area if thats posible.





RE: Scripting in need of help:/ - flamez3 - 03-03-2012

Ah sorry, wrong event. c:

Replace the SetLightVisible("torch_static_01, true); with


SetLampLit("torch_static01_1", false, true);


All the way down to torch_static_23



RE: flamez3 - Froggit - 03-03-2012

(03-03-2012, 03:13 AM)flamez3 Wrote: Ah sorry, wrong event. c:

Replace the SetLightVisible("torch_static_01, true); with


SetLampLit("torch_static01_1", false, true);


All the way down to torch_static_23
Wooohhh!!! It workedBig Grin . But the sound and the particle system didnt work. Did I have to change that stuff also? And I dont have a particle system in level editor just the 2 script areas, one for lights and a small box for particle i think. Here is my script updated. And im really sorry if this is stressing you out because I dont know scripting for sh*t Tongue
void OnStart()
{
AddEntityCollideCallback("Player", "ScriptArea_1", "MonsterFunction", true, 1);
AddEntityCollideCallback("Player", "ScriptArea_2", "dust", true, 1);
AddEntityCollideCallback("Player", "ScriptArea_3", "LightFade", true, 1);

}
void MonsterFunction(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("servant_brute_1", true);
AddEnemyPatrolNode("servant_brute_1", "PathNodeArea_1", 2, "");
AddEnemyPatrolNode("servant_brute_1", "PathNodeArea_2", 0, "");
AddEnemyPatrolNode("servant_brute_1", "PathNodeArea_3", 0, "");
AddEnemyPatrolNode("servant_brute_1", "PathNodeArea_4", 0, "");
AddEnemyPatrolNode("servant_brute_1", "PathNodeArea_5", 0, "");
AddEnemyPatrolNode("servant_brute_1", "PathNodeArea_6", 0, "");
AddEnemyPatrolNode("servant_brute_1", "PathNodeArea_7", 0, "");
AddEnemyPatrolNode("servant_brute_1", "PathNodeArea_8", 0, "");
AddEnemyPatrolNode("servant_brute_1", "PathNodeArea_9", 0, "");
AddEnemyPatrolNode("servant_brute_1", "PathNodeArea_10", 0, "");
AddEnemyPatrolNode("servant_brute_1", "PathNodeArea_11", 0, "");
AddEnemyPatrolNode("servant_brute_1", "PathNodeArea_12", 0, "");
AddEnemyPatrolNode("servant_brute_1", "PathNodeArea_13", 0, "");
}
void dust(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("ParticleSystem_2", true);
}
void LightFade(string &in asParent, string &in asChild, int alState)
{
SetLightVisible("pointlight_0", false);
SetLightVisible("pointlight_1", false);
SetLightVisible("pointlight_2", false);
SetLightVisible("pointlight_3", false);
SetLightVisible("pointlight_4", false);
SetLightVisible("pointlight_5", false);
SetLightVisible("pointlight_6", false);
SetLightVisible("pointlight_7", false);
SetLightVisible("pointlight_8", false);
SetLightVisible("pointlight_9", false);
SetLightVisible("pointlight_10", false);
SetLightVisible("pointlight_11", false);
SetLightVisible("pointlight_12", false);
SetLightVisible("pointlight_13", false);
SetLightVisible("pointlight_14", false);
SetLightVisible("pointlight_15", false);
SetLightVisible("pointlight_16", false);
SetLightVisible("pointlight_17", false);
SetLightVisible("pointlight_18", false);
SetLightVisible("pointlight_19", false);
SetLightVisible("pointlight_20", false);
SetLightVisible("pointlight_21", false);
SetLightVisible("pointlight_22", false);
SetLightVisible("pointlight_23", false);
SetLightVisible("pointlight_24", false);
SetLightVisible("pointlight_25", false);
CreateParticleSystemAtEntity("ps", "ps_dust_whirl.ps", "ScriptAreaParticle", true);
SetLampLit("torch_static01_1", false, true);
SetLampLit("torch_static01_2", false, true);
SetLampLit("torch_static01_3", false, true);
SetLampLit("torch_static01_4", false, true);
SetLampLit("torch_static01_5", false, true);
SetLampLit("torch_static01_6", false, true);
SetLampLit("torch_static01_7", false, true);
SetLampLit("torch_static01_8", false, true);
SetLampLit("torch_static01_9", false, true);
SetLampLit("torch_static01_10", false, true);
SetLampLit("torch_static01_11", false, true);
SetLampLit("torch_static01_12", false, true);
SetLampLit("torch_static01_13", false, true);
SetLampLit("torch_static01_14", false, true);
SetLampLit("torch_static01_15", false, true);
SetLampLit("torch_static01_16", false, true);
SetLampLit("torch_static01_17", false, true);
SetLampLit("torch_static01_18", false, true);
SetLampLit("torch_static01_19", false, true);
SetLampLit("torch_static01_20", false, true);
SetLampLit("torch_static01_21", false, true);
SetLampLit("torch_static01_22", false, true);
SetLampLit("torch_static01_23", false, true);
PlaySoundAtEntity("", "sound3", "ScriptAreaParticle", 0, true);
}

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

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



RE: Scripting in need of help:/ - flamez3 - 03-03-2012

Have you got an area called ScriptAreaParticle?