Frictional Games Forum (read-only)
Pulling lever to trigger door unlock & monster - 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: Pulling lever to trigger door unlock & monster (/thread-17115.html)



Pulling lever to trigger door unlock & monster - HeadyBoy - 07-20-2012

I need to make a lever unlock a door and spawn an enemy that will have a patrol route before going off and disappearing, any ideas on the script?


RE: Pulling lever to trigger door unlock & monster - Ongka - 07-20-2012

Code:
void OnStart()
{
SetEntityConnectionStateChangeCallback("ENTER_LEVER_NAME", "ENTER_FUNCTION_NAME");
}

void ENTER_FUNCTION_NAME(string &in asEntity, int alState)
{
if(alState == 1 || alState == -1) //Pull lever up or down to open the door
{
    SetSwingDoorLocked("ENTER_DOOR_NAME", false, false);  //unlocks the door
    SetEntityActive("ENTER_MONSTERNAME", true);
    AddEnemyPatrolNode("ENTER_MONSTERNAME", "ENTER_PATHNODE_NAME", 0.1f, ""); //Copy this to add more pathnodes
}
else
{
//Nothing, what happens if the lever is in the middle
}
}
There you go Wink
He will disappear after finishing the pathnodes and reaching a specific distance.


RE: Pulling lever to trigger door unlock & monster - HeadyBoy - 07-20-2012

Works perfectly. Thank you Big Grin


RE: Pulling lever to trigger door unlock & monster - HeadyBoy - 07-20-2012

(07-20-2012, 03:17 AM)HeadyBoy Wrote: Works perfectly. Thank you Big Grin
Just been fiddling around.. and now it does not work, have I done something wrong here?


____________________________________________________________________

void OnStart()
{
SetEntityConnectionStateChangeCallback("lever_nice01_1", "leversuitor_1");
}

void leversuitor_1(string &in asEntity, int alState)
{
if(alState == 1 || alState == -1)
{
SetSwingDoorLocked("mansiondoor_1", false, false);
SetEntityActive("suitorman_1", true);
AddEnemyPatrolNode("suitorman_1", "PathNodeArea_1", 0.1f, "");
AddEnemyPatrolNode("suitorman_1", "PathNodeArea_2", 0.1f, "");
AddEnemyPatrolNode("suitorman_1", "PathNodeArea_3", 0.1f, "");
AddEnemyPatrolNode("suitorman_1", "PathNodeArea_4", 0.1f, "");
AddEnemyPatrolNode("suitorman_1", "PathNodeArea_5", 0.1f, "");
AddEnemyPatrolNode("suitorman_1", "PathNodeArea_6", 0.1f, "");
AddEnemyPatrolNode("suitorman_1", "PathNodeArea_7", 0.1f, "");
}
else
{

}
}


anybody have any ideas on what I have knocked out of place? because the lever doesnt trigger anything now

Edit: This is driving me mental.