The door wasn’t already open when the npc opens it, but the reason I wrote it that way is because I don’t really know what i’m doing, only experience with this is from NWN lexicon and NWN itself. Didn’t know ! could change the meaning. The door was actually opening the way I intended with my script somehow?
My only real problem is the script occuring twice.
This whole thing is from the NESS(Neshke’s Extendable Spawning System) spawn_sc_patrol script.
https://neverwintervault.org/project/nwn1/script/neshkes-extendable-spawning-system-ness-v813
Here’s the entire script file I’m writing in, its suppose to pick from a list of scripts and then you tag your number to the way point the npc goes to, when he reaches that way point it fires the script.
//
// Patrol Scripts
//
#include “spawn_functions”
//
object GetChildByTag(object oSpawn, string sChildTag);
object GetChildByNumber(object oSpawn, int nChildNum);
object GetSpawnByID(int nSpawnID);
void DeactivateSpawn(object oSpawn);
void DeactivateSpawnsByTag(string sSpawnTag);
void DeactivateAllSpawns();
void DespawnChildren(object oSpawn);
void DespawnChildrenByTag(object oSpawn, string sSpawnTag);
//
//
void main()
{
// Retrieve Script Number
int nPatrolScript = GetLocalInt(OBJECT_SELF, “PatrolScript”);
// Retrieve Stop Information
int nStopNumber = GetLocalInt(OBJECT_SELF, "PR_NEXTSTOP");
object oStop = GetLocalObject(OBJECT_SELF, "PR_SN" + PadIntToString(nStopNumber, 2));
// Invalid Script
if (nPatrolScript == -1)
{
return;
}
//
// Only Make Modifications Between These Lines
// -------------------------------------------
// Script 00
if (nPatrolScript == 0)
{
ActionDoCommand(SpeakString("Example!"));
}
//
// Turn Off Lights
if (nPatrolScript == 7)
{
object oLight = GetNearestObjectByTag("Light", oStop);
if ((GetIsDay() == TRUE && GetPlaceableIllumination(oLight) == TRUE)
|| (GetIsNight() == TRUE && GetPlaceableIllumination(oLight) == FALSE))
{
ActionDoCommand(DoPlaceableObjectAction(oLight, PLACEABLE_ACTION_USE));
}
}
//
// Trap-Setting Rogue
if (nPatrolScript == 1)
{
object oTrap = GetNearestTrapToObject();
if (oTrap == OBJECT_INVALID || GetDistanceToObject(oTrap) > 5.0)
{
// Create a Trap Kit
object oTrapKit = CreateItemOnObject("NW_IT_TRAP001", OBJECT_SELF, 1);
// Set Trap
SignalEvent(GetModule(), EventActivateItem(oTrapKit, GetLocation(OBJECT_SELF)));
}
}
//Sit 1
if (nPatrolScript == 3)
{
object oChair = GetObjectByTag(“ZEP_CHBOG_002”);
ActionMoveToObject(oChair);
ActionSit(oChair);
DelayCommand(81.0, ClearAllActions());
DelayCommand(82.0,AddPatrolStop(00,00));
DelayCommand(82.5,SetPatrolRoute(00));
DelayCommand(83.0,DoPatrolRoute(00,2));
}
//Sit 2
if (nPatrolScript == 2)
{
object oChair = GetObjectByTag(“BenchPew”);
ActionMoveToObject(oChair);
ActionSit(oChair);
DelayCommand(81.0, ClearAllActions());
DelayCommand(82.0,AddPatrolStop(02,00));
DelayCommand(82.5,SetPatrolRoute(02));
DelayCommand(83.0,DoPatrolRoute(02,3));
}
//Toilet
if (nPatrolScript == 6)
{
object oChair = GetObjectByTag(“ZEP_TOILET001”);
ActionMoveToObject(oChair);
ActionSit(oChair);
DelayCommand(81.0, ClearAllActions());
DelayCommand(82.0,AddPatrolStop(01,00));
DelayCommand(82.5,SetPatrolRoute(01));
DelayCommand(83.0,DoPatrolRoute(01,2));
}
//Fiddle with something
if (nPatrolScript == 4)
{
ActionPlayAnimation(ANIMATION_LOOPING_GET_MID,1.0,5.0);
}
//Open Door
if (nPatrolScript == 5)
{
object oNearestDoor = GetNearestObjectByTag(“x3_door_wood003”);
ActionMoveToObject(oNearestDoor);
ActionDoCommand(ClearAllActions());
if (GetIsOpen(oNearestDoor))ActionOpenDoor(oNearestDoor);
}
// -------------------------------------------
// Only Make Modifications Between These Lines
//
}