-
Notifications
You must be signed in to change notification settings - Fork 11
Description
I want an NPC ("The Woman") to patrol the area around her cave, about 6 rooms for the route.
I copy and pasted in the code from the Quest Documentation pages, and I can make it work but only so that she goes from room to room as long as I don't have any repeated rooms at all in the route. If I repeat any rooms in the list, she just goes back and forth between 2 rooms (the first repeated and the one before it, I think).
All I can do then is have a linear route where none of the rooms repeat, which is okay, but it would be more realistic if she could retrace part of her path instead of going in a straight line and then start back magically at the beginning room. Here is the code for her route, as I copied and then modified:
this.route = NewObjectList()
list add (this.route, Deep Woods)
list add (this.route, Hogs Crossing)
list add (this.route, Village)
list add (this.route, Old Mule Track)
list add (this.route, CrossRoads)
list add (this.route, Witch Cave)
this.takeaturn => {
oldroom = this.parent
index = IndexOf(this.route, this.parent)
newindex = (index + 1) % ListCount(this.route)
this.parent = ObjectListItem(this.route, newindex)
if (not oldroom = this.parent) {
PrintIfHere (oldroom, "The Woman leaves suddenly.")
PrintIfHere (this.parent, "From out of nowhere, the Woman appears.")
}
}
Is it a problem that my room names have 2 words? I think I remember reading in the Quest tutorials that two-word rooms can cause trouble, but now I can't find where it said that, and I'm not sure I got that right.
Also, I came across the NpcLib.aslx while searching for answers, and I downloaded it, but now I can't figure out how to 'initialise' it into my game (how to invoke it as a library, call its functions, or however you say that). I guess that set of codes would really do a lot of what I want, because I also had trouble getting my NPC to pause (if I repeat rooms in the list, she gets hung up there). So having conversations with the player would help with pausing...