Can't find Exit? (Beginner)
Zabikai
13 Dec 2020, 18:42Hi again! I'm trying to make it so that if the player hits a button in a room the exits lock, but when I use the lock exit function in the web GUI the drop down menu doesn't list any of the exits of the room?
mrangel
13 Dec 2020, 18:52That function will only show exits that have names. You need to put something in the "name" field for each exit if you want to use it in scripts.
(if you don't give an exit a name, it will get a name like "exit362" when the game starts; but you can't select that because it will change every time you add an exit to a room higher up in the list)
Alternatively, if you want to lock all exits from a room, you could use a piece of code like:
foreach (exit, AllExits()) {
if (exit.parent = name_of_room) {
exit.locked = true
}
}
Zabikai
13 Dec 2020, 23:16Thank you!
Curt A. P.
14 Dec 2020, 07:25Alternatively, if you want to lock all exits from a room, you could use a piece of code like:
foreach (exit, AllExits()) { if (exit.parent = name_of_room) { exit.locked = true } }
Or:
foreach (exit, ScopeExitsForRoom(name_of_room)) {
exit.locked = true
}
And if you target the exits that are in the same room as the player:
foreach (exit, ScopeExitsForRoom(game.pov.parent)) {
exit.locked = true
}