Frictional Games Forum (read-only)
[SCRIPT] Can't get Areas active - 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] Can't get Areas active (/thread-13097.html)



Can't get Areas active - trollox - 02-04-2012

Alright so the idea is to make the "player" walk through 3 areas.
1. makes the door active and blockes him off --done.
2. The first area set's the 2nd area active aswell as the door "no fatal erros , so i guess it works"
3. When he goes back and touches the 2nd area the player is suppose to make the 2nd door active and confuse the player so he thinks he's stuck. The 2nd script also activate the 3rd script "havn't scripted this part yet since the 2nd area dosen't get active.
4. When touching the 3rd area the 1st door dissapear and the player can contiune with the mod.

But for some reason the 1st script area don't activate the 2nd scripting area and that's my problem.
While i'm writing this helping requiest i also wonder how do i make the 1st door dissapear is it like making it active but the opposite so instead of : SetEntityActive("Door_1", true);
I change it to : SetEntityActive("Door_1", false); would that do it? I really need help i'm so confused.

Here's the full script if you need to read it :


void OnStart()
{
AddEntityCollideCallback("Player", "ScriptArea_1", "Door", true, 1);
AddEntityCollideCallback("Player", "ScriptArea_1", "Script", true, 1);
AddEntityCollideCallback("Player", "ScriptArea_2", "Door2", true, 1);
}

void Door(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("Door_1", 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);
}














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

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


RE: Can't get Areas active - Elven - 02-04-2012

Why so complicated, make it like this instead:

void OnStart()
{
AddEntityCollideCallback("Player", "ScriptArea_1", "Door", true, 1);
AddEntityCollideCallback("Player", "ScriptArea_1", "Script", true, 1);
}

void Door(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("Door_1", 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)
{
AddEntityCollideCallback("Player", "ScriptArea_2", "Door2", true, 1);
}

And make sure all script areas are activated (enabled)




RE: Can't get Areas active - trollox - 02-04-2012

But that dosen't tell me how to remove the door.


RE: Can't get Areas active - Elven - 02-04-2012

SetEntityActive("DoorName", false); ? -> just put it into correct spot Smile



RE: Can't get Areas active - vcplz - 02-04-2012


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

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

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

}

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