Jump to content

Home

OnFailToOpen script for locked dood


Seamhainn

Recommended Posts

Hello!

 

Once again I need scripting help, please. I have this OnFailToOpen script for a locked door:

 

void main(){

object oDoor=GetObjectByTag("tar10_lab");
object oCard=GetObjectByTag("tar10_mechid");

if (GetBaseItemType(oCard))

{

ActionOpenDoor(oDoor);

}

else

{

ActionBarkString(14614);

}

}

 

Unfortunately the string is not displayed if the pc does not have the tar10_mechid item, and also the door does not open if the pc has the tar10_mechid item.

 

Any help would be highly appreciated!

 

Thanks and take care

Link to comment
Share on other sites

Hello!

 

Once again I need scripting help, please. I have this OnFailToOpen script for a locked door:

 

Try this variant of your script:

void main(){
   object oDoor = GetObjectByTag("tar10_lab");
   object oCard = GetItemPossessedBy(GetFirstPC(), "tar10_mechid");

   if (GetIsObjectValid(oCard)) {
       SetLocked(oDoor, FALSE);
       AssignCommand(oDoor, ActionOpenDoor(oDoor));
   }
   else {
       BarkString(OBJECT_INVALID, 14614);
   }
}

Link to comment
Share on other sites

Try this variant of your script:

void main(){
   object oDoor = GetObjectByTag("tar10_lab");
   object oCard = GetItemPossessedBy(GetFirstPC(), "tar10_mechid");

   if (GetIsObjectValid(oCard)) {
       SetLocked(oDoor, FALSE);
       AssignCommand(oDoor, ActionOpenDoor(oDoor));
   }
   else {
       BarkString(OBJECT_INVALID, 14614);
   }
}

 

That did not work. The String is only barked once (!) and not anymore if I click on the door later on again, and the door does not open if I give tar10_mechid with the giveitem cheat to the pc.

 

I now locked the door and asked for the tar10_mechid key to open it. Also I changed the script to

 

void main()

{

BarkString(OBJECT_INVALID, 14614);

}

 

Everything works nicely now. EXCEPT that I still get the annoying three boxes under "Locked" when I click on the door. How can I eliminate those three boxes?

 

Thanks and take care

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...