Jump to content

Prison doors: How to lock them


Faceshifter

Recommended Posts

I am in distress. I have created a script, but do not know why it won't work.

Here it goes:

Scriptname FacePrisonDoorScript

Begin GameMode

If Player.GetInWorldSpace AAANewWorld == 1

FaceWesternEndPrisonDoor2.Lock 80

Endif

End

The CS doesn't report any mistakes. The target is to lock the door, once out of the prison. Should I create more prisons, it would work as well ( that's why I used Worldspace instead of cell).

Should I use GetInCell? Doesn't GetInWorldSpace work?

Link to comment
Share on other sites

If I am understanding you correctly, once your character is out of the prison he/she is no longer in that cell/worldspace, so you might try:

 

Scriptname FacePrisonDoorScript

Begin GameMode

If ( Player.GetInCell PRISONCELL == 0 ) && 
( Player.GetInCell TARGETCELL == 1 )

       FaceWesternEndPrisonDoor2.Lock 80

Endif

End

Link to comment
Share on other sites

Then I can't see why that would not work. Normally, I would write your script as:

Scriptname FacePrisonDoorScript

Begin GameMode

   If ( Player.GetInWorldSpace AAANewWorld == 1 )

      	FaceWesternEndPrisonDoor2.Lock 80

   Endif

End

I don't know if the parenthesis makes any difference in a simple condition like that, but I doubt it.

Link to comment
Share on other sites

The reason why it doesn't work is because objects that aren't loaded don't run their scripts. So once you get out of the cell with the prison door and into the exterior, the door is no longer loaded. So that script won't run. It will only run while you're in the cell, but whenever you're in the cell, it doesn't lock...
Link to comment
Share on other sites

You can try using this:

 

scn example

Begin OnLoad

Lock 80

End

 

That will make it so that whenever the door the script is attached to is loaded, the door will lock. So whenever you enter the cell or load the game from the cell, the door will be locked.

 

Another option is to put an X marker inside the actual prison cell and lock it whenever the player is far enough away that he/she has to have gotten past the door.

 

scn example

float tempfloat

Begin GameMode

set tempfloat to (GetDistance "X marker") + 100
if (Player.GetDistance "X marker" > tempfloat)
	Lock 80
endif

End

 

Or, you can keep your original script and instead attach it to something else. For example, the exterior door that leads into the prison.

Edited by fg109
Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...