Frictional Games Forum

Full Version: Pulling lever to trigger door unlock & monster
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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?
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.
Works perfectly. Thank you Big Grin
(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.