Jump to content

Home

open a door through scripting?


Vox Kalam

Recommended Posts

void main()

{

string sTag = GetScriptStringParameter();

int iDelay = GetScriptParameter(1);

 

object oDoor = GetObjectByTag("attackdoor");

DelayCommand(IntToFloat(iDelay), AssignCommand(oDoor,ActionUnlockObject(oDoor)));

DelayCommand(IntToFloat(iDelay), AssignCommand(oDoor,ActionOpenDoor(oDoor)));

}

How do you like that? The stubborn door won't open.

 

EDIT: I tried this one, too...nothing.

void main() {

object oDoor = GetObjectByTag("TagOfTheDoor");

AssignCommand(oDoor, ActionOpenDoor(oDoor));

SetLocked(oDoor, FALSE);

}

Link to comment
Share on other sites

Give this a try. Pass the door's tag as the StringParam and the delay in seconds as P1.

void main()
{
   string sTagOfDoor = GetScriptStringParameter();
   int iDelay = GetScriptParameter(1);
   object oDoor = GetObjectByTag(sTagOfDoor);

   SetLocked(oDoor,FALSE);
   DelayCommand(IntToFloat(iDelay), DoDoorAction(oDoor, DOOR_ACTION_OPEN));
}

Link to comment
Share on other sites

void main()

{

string sTagOfDoor = GetScriptStringParameter();

int iDelay = GetScriptParameter(1);

object oDoor = GetObjectByTag("attackdoor");

 

SetLocked(oDoor,FALSE);

DelayCommand(IntToFloat(1), DoDoorAction(oDoor, DOOR_ACTION_OPEN));

}

 

Like this? Not working...Dids I do it wrong?

Link to comment
Share on other sites

Is the tag of your door "attackdoor"? I assumed you were calling this script via a dialog and so you could put the string "attackdoor" in the dialog StringParam field as I mentioned.

 

If this script is not called by a dialog or this is for KotOR1,

void main()
{
  SendMessageToPC(GetFirstPC(),"DEBUG: Trying to open attackdoor");
  object oDoor = GetObjectByTag("attackdoor"); //confirm this tag is correct
  SetLocked(oDoor,FALSE);
  DelayCommand(1.0, DoDoorAction(oDoor, DOOR_ACTION_OPEN));
  SendMessageToPC(GetFirstPC(),"DEBUG: Tried to open attackdoor");
}

Check your feedback screen after running the above script. You should see both debug messages there.

Link to comment
Share on other sites

It's for TSL

 

This works here to unlock and open a door. If it doesn't do anything in your game then either the script isn't running at all, or the tag of the door is either wrong or you have more than one door in the module with the same tag:

 

void main() {
   object oDoor = GetObjectByTag("attackdoor"); 
   SetLocked(oDoor, FALSE);
   AssignCommand(oDoor, ActionOpenDoor(oDoor));
}

Link to comment
Share on other sites

  • 1 month later...

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...