I don’t know if this is an issue with the door code, the .travelVia() method or my understanding of how this should work.
If an NPC moves between rooms (via doors) and the PC closes the door before the NPC travels through it, the NPC gets blocked. This is working code followed by the script it generated to show the issue:
[code]inside : Room ‘The Inside Room’
"The inside room. "
roomBeforeAction() { if (gActionIs(Yell)) { npcAgenda.isReady = true; } }
out = insideDoor
;
- insideDoor : Door ‘inside door’
"Inside door. "
isOpen = true
otherSide = outsideDoor
;
outside : Room ‘The Outside Room’
"The outside room. "
in = outsideDoor
;
- outsideDoor : Door ‘outside door’
"Outside door. "
isOpen = true
otherSide = insideDoor
;
npc : Actor ‘npc’ @inside
“An NPC.”
;
- npcAgenda : AgendaItem
isReady = nil
initiallyActive = true
count = 0
invokeItem() {
switch (count++) {
case 0:
break;
case 1:
npc.travelVia(insideDoor);
break;
case 2:
break;
case 3:
npc.travelVia(outsideDoor);
break;
}
}
;
[/code]
This is the resulting output file:
[code]The Inside Room
The inside room.
The npc was there.
out
The Outside Room
The outside room.
in
The Inside Room
The inside room.
The npc was there.
close door
Done.
out
(first opening the inside door)
The Outside Room
The outside room.
close door
Done.
in
(first opening the outside door)
The Inside Room
The inside room.
The npc was there.
yell
That was not really in my nature.
z
Time passed.
The npc left through the inside door.
z
Time passed.
z
Time passed.
The npc arrived in the area. *** Works ***
undo
One turn undone: z
undo
One turn undone: z
undo
One turn undone: z
undo
One turn undone: yell
close door
Done.
yell
That was not really in my nature.
z
Time passed.
The npc left through the inside door. (first opening the inside door)
z
Time passed.
z
Time passed.
The npc arrived in the area. *** Works ***
undo
One turn undone: z
undo
One turn undone: z
undo
One turn undone: z
undo
One turn undone: yell
yell
That was not really in my nature.
z
Time passed.
The npc left through the inside door. (first opening the inside door)
close door
Done.
z
Time passed.
The outside door was in the way. *** Does not work ***
z
Time passed. >[/code]
So if I manually close the inside door (which should close the outside door since they’re connected), the NPC gets blocked.
Am I missing something?