Faceshifter Posted April 25, 2011 Share Posted April 25, 2011 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 EndThe 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 More sharing options...
Hickory Posted April 25, 2011 Share Posted April 25, 2011 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 More sharing options...
Faceshifter Posted April 25, 2011 Author Share Posted April 25, 2011 The prison links to the exterior in the new worldspace, so when you exit the prison, you'll be in the new worldspace ( Player.GetInWorldSpace AAANewWorld == 1 , normally )I am sorry that I haven't been clear enough in my previous post. Link to comment Share on other sites More sharing options...
Hickory Posted April 25, 2011 Share Posted April 25, 2011 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 EndI 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 More sharing options...
fg109 Posted April 25, 2011 Share Posted April 25, 2011 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 More sharing options...
Faceshifter Posted April 25, 2011 Author Share Posted April 25, 2011 Uh oh. That will make things complicated. Link to comment Share on other sites More sharing options...
fg109 Posted April 25, 2011 Share Posted April 25, 2011 (edited) 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 April 25, 2011 by fg109 Link to comment Share on other sites More sharing options...
Faceshifter Posted April 25, 2011 Author Share Posted April 25, 2011 That's perfect, thank you! Link to comment Share on other sites More sharing options...
Recommended Posts