NWScript:
#include "NW_I0_GENERIC"
void main()
{
int nUser = GetUserDefinedEventNumber();
if(nUser == 1001)
{
if (GetIsNight())
{
object oDoor = GetNearestObject(OBJECT_TYPE_DOOR);
if (GetIsOpen(oDoor))
{
if (GetLocalInt(OBJECT_SELF, "nClosingDoor") != 1)
{
SetLocalInt(OBJECT_SELF, "nClosingDoor", 1);
SpeakString("Who left that door open? Hm.");
ClearAllActions();
ActionCloseDoor(oDoor);
}
else
SpeakString("Irresponsible!");
}
else
SetLocalInt(OBJECT_SELF, "nClosingDoor", 0);
if (GetCurrentAction() == ACTION_INVALID && !IsInConversation(OBJECT_SELF))
WalkWayPoints();
}
else if (GetCurrentAction() == ACTION_INVALID && !IsInConversation(OBJECT_SELF))
WalkWayPoints();
}
else if(nUser == 1002)
{
if (GetIsNight())
{
if (GetLocalInt(OBJECT_SELF, "nClosingDoor") != 1)
{
object oSeen = GetLastPerceived();
if (GetIsPC(oSeen))
{
if (GetLastPerceptionSeen())
SpeakString("Who goes there? I see you!");
else
SpeakString("Who goes there? I heard you!");
if (GetObjectSeen(oSeen))
{
ClearAllActions();
ActionStartConversation(oSeen);
}
else
{
ClearAllActions();
DelayCommand(2.0f, WalkWayPoints());
}
}
}
}
}
else if(nUser == 1003)
{
}
else if(nUser == 1004)
{
}
else if(nUser == 1005)
{
}
else if(nUser == 1006)
{
}
else if(nUser == 1007)
{
}
else if(nUser == 1008)
{
}
}