You are on page 1of 3

//File name: bmp_trig_door_en

//Created by: Shawn Lucas
//Created on: February 17, 2008

/*This script should go in each door trigger's OnEnter tab. It allows certain
doors to be opened by specific NPCs. The PC must position the correct NPC within
the trigger next to the door, which will unlock & open the door.*/

void main()
{
//Defines entering object.
object oPC = GetEnteringObject();

//Defines NPCs.
object oRed = GetObjectByTag("RED_NPC");
object oBlue = GetObjectByTag("BLUE_NPC");
object oGreen = GetObjectByTag("GREEN_NPC");
object oCyan = GetObjectByTag("CYAN_NPC");
object oYellow = GetObjectByTag("YELLOW_NPC");
object oMagenta = GetObjectByTag("MAGENTA_NPC");

//Defines doors that entering NPCs unlock & open.
object oDoor;
object oRedDoor01 = GetObjectByTag("DT_RED_DOOR_01");
object oRedDoor02 = GetObjectByTag("DT_RED_DOOR_02");
object oRedDoor03 = GetObjectByTag("DT_RED_DOOR_03");
object oBlueDoor = GetObjectByTag("DT_BLUE_DOOR");
object oGreenDoor = GetObjectByTag("DT_GREEN_DOOR");
object oCyanDoor = GetObjectByTag("DT_CYAN_DOOR");
object oYellowDoor = GetObjectByTag("DT_YELLOW_DOOR");
object oMagentaDoor = GetObjectByTag("DT_MAGENTA_DOOR");

//If it's red trigger 01.
if(GetTag(OBJECT_SELF) == "TT_RED_DOOR_01")
{
//Check entering object is Red NPC.
if(oPC == oRed)

//Set value.
oDoor = oRedDoor01;
}

//If it's red trigger 02.
else if(GetTag(OBJECT_SELF) == "TT_RED_DOOR_02")
{
//Check entering object is Red NPC.
if(oPC == oRed)

//Set value.
oDoor = oRedDoor02;
}

//If it's red trigger 03.
else if(GetTag(OBJECT_SELF) == "TT_RED_DOOR_03")
{
//Check entering object is Red NPC.

oDoor = oBlueDoor. oDoor = oCyanDoor. oDoor = oMagentaDoor. if(oPC == oMagenta) //Set value. else if(GetTag(OBJECT_SELF) == "TT_YELLOW_DOOR") { //Check entering object is Yellow NPC. oDoor = oYellowDoor. if(oPC == oYellow) //Set value. } //If it's magenta trigger. oDoor = oGreenDoor. } //If it's yellow trigger. else if(GetTag(OBJECT_SELF) == "TT_BLUE_DOOR") { //Check entering object is Blue NPC. else if(GetTag(OBJECT_SELF) == "TT_MAGENTA_DOOR") { //Check entering object is Magenta NPC. else if(GetTag(OBJECT_SELF) == "TT_GREEN_DOOR") { //Check entering object is Green NPC. oDoor = oRedDoor03. } . if(oPC == oBlue) //Set value. } //If it's green trigger. if(oPC == oCyan) //Set value. else if(GetTag(OBJECT_SELF) == "TT_CYAN_DOOR") { //Check entering object is Cyan NPC. if(oPC == oRed) //Set value. } //If it's cyan trigger. if(oPC == oGreen) //Set value. } //If it's blue trigger.

} . ActionOpenDoor(oDoor)). ActionUnlockObject(oDoor)). //Unlock & open correct door. AssignCommand(oDoor. AssignCommand(oDoor.