Extacide Posted December 9, 2008 Share Posted December 9, 2008 Writing a script where 8 separate doors all teleport the player to a single room, and when the player goes back through the door again, he is teleported to the room he entered from. I'd like to avoid using menu's/quests and make it a simple and clean enter/exit without any pop ups. Also, it'd be even better if this could output as a very clean "door" function that you simply enter and exit, and takes you back to the room you entered from. So far, the way I'd imagine scripting this would be. 1) Create a variable for each room2) Whenever the player enters one of the 8 cells, the associated variable would be set to 1.3) When the player activates the door while leaving, it will check what variable is set to 1, and then teleport the player to that variable's cell. The problem is, I don't know the syntax for the above commands or if they're even possible. Could someone help me? Link to comment Share on other sites More sharing options...
Vagrant0 Posted December 10, 2008 Share Posted December 10, 2008 Normally, one door will always teleport to a single other door, located in another cell. For normal doors, neither location can be changed in game with any sort of scripting. As in, Door A will always lead to door B, door B will always lead to door A, and door C cannot link to either door A nor door B. In order to have both door A and door C link to door B, you will need to use specially scripted activators, that move the player to a xmarker based on the script. Since you will be wanting the ability to return to either door A or C, based on which was used when entering door B, you will need a control script which works with each of the specially scripted doors. Essentially, it's a bit complicated, and requires being a bit more specific on how things are arranged to figure out the best method of handling this. This means that you're gonna probably have to draw a picture about how you want these rooms to be chosen and linked. Is it 1 door per room, or is it 8 doors in each of the rooms. How is it determined which room is entered by using what door? Will door A always link to room 5, with all the doors in room 5 linking to a specific door in all the other rooms? Or is there some sort of random element involved? You may not even need scripting. Link to comment Share on other sites More sharing options...
Khet Posted December 10, 2008 Share Posted December 10, 2008 Well, I assume you're asking for more than the typical 'Door A leads to Door B and vice versa' kind of thing. If I'm understanding it correctly you want, say... doors A B AND C all leading to door D. If player chooses Door B and then exits though door D they're taken BACK to door B and not A or C. If so, then it would be handled through variables and XHeadingMarkers. If that IS what you want then to my knowledge you would need a quest script running in the background and a script attached to each of the doors, and might look something like this. For Doors A-C: scn DoorScript Begin OnActivate Set DoorA/B/C to 1 Player.MoveTo DoorDMarkerRef End Then simply change the DoorA/B/C to whatever you use in the quest script (I'll show that little later) For the LAST door however (that all the other doors lead to) scn DoorScript Begin OnActivate If DoorQuestScript.DoorA == 1 Player.MoveTo DoorAMarkerRef Set DoorQuestScript.DoorA to 0 EndIf If DoorQuestScript.DoorB == 1 Player.MoveTo DoorBMarkerRef Set DoorQuestScript.DoorB to 0 EndIf End And simply repeat the blocks for each door you have. Finally for the script attached to the quest it would look something like this: scn DoorQuestScript Short DoorA Short DoorB Short DoorC And that's honestly all you would need. Basically what would happen is this: Since you defined your variables in the DoorQuestScript all the other scripts would check the variables in that script. This is the reason for having the "Set DoorQuestScript.DoorA to 1" command. It's how you get one script to change the variable in another script. Now when Door A is activated it would set the DoorA variable in the Quest Script to 1, and teleport the player to Door D (just like a normal door, though without sound. I'm sure there's a way to get the sound to play) Then, since the DoorA variable is set to 1, when they activate Door D the player is teleported back to Door A (again, no sound since it isn't a true door link) and the Door A variable is set BACK to 0 so the whole process can be repeated with the other doors if need be. Hope this helps. Might be a bit confusing as I'm not that great at explaining things but hopefully I'll be able to clarify if you need it. If this isn't what you wanted to do, well, ignore the whole post then. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.