arrivingWithDesc doesn't display during a GuidedTourState

Hi! I’m experimenting with guiding with NPCs using the GuidedTourState system. I use something like this:

npcGTS1: GuidedTourState
    escortDest = room2
    stateAfterEscort = npcGTS2
    stateDesc = "The NPC's waiting for you by the door to Room 2."
    arrivingWithDesc = "The NPC walks to the door and hold it open."
;


npcGTS2: GuidedTourState
    escortDest = room3
    stateAfterEscort = npcGTS3
    stateDesc = "The NPC's hanging around the door to Room 3. Follow him, perhaps?"
    arrivingWithDesc = "The NPC heads to the door to Room 3."
;

That worked once for me. I changed a few things that I just don’t remember, and now nothing displays when you follow the NPC. Just the stateDesc displays. I could set it to change the stateDesc for every room the NPC enters but that’s cumbersome and the GuidedTourState worked perfectly fine.

I’d like to show you to the source code but it’s just one mega file with references to random items and rooms.

Could anyone tell me what’s wrong? I can clarify if I missed a detail.

So the issue is that normally you should see the arrivingWithDesc? Sorry I haven’t used guided tours myself.

Have you tried constructing a minimal test case, debugging the code to see what is called, and then debugging your own game to see if it’s skipping something it should (and maybe why?).

Not sure what went wrong but here’s a working example of the NPC alternating between two rooms:

gameMain: GameMainDef {
  initialPlayerChar = me
  showIntro() {
    NPC.setCurState(npcGTS1);  
  }
}

me: Actor 'you' 'you' @southPlace;

southPlace: Room 'South place'  north = northPlace;
northPlace: Room 'North place'  south = southPlace;

NPC: TourGuide, Person 'npc' 'NPC' desc = "He's your NPC tour guide." 
    location = northPlace
;

class CustomizedNpcGuidedInTravelState: GuidedInTravelState
    sayDeparting(conn) { 
        "The NPC noticing you are ready, leads the way to the the next room. You tag along. ";
    }
;

+npcGTS1: GuidedTourState
    escortStateClass = CustomizedNpcGuidedInTravelState
    specialDesc = "The NPC looks eager to go south"
    escortDest = southPlace   
    stateAfterEscort = npcGTS2
    stateDesc = "The NPC's waiting for you by the door to the south place."
    arrivingWithDesc = "The NPC walks back to the south door and hold it open. <q>Encore!</q>"
;

+npcGTS2: GuidedTourState
    escortStateClass = CustomizedNpcGuidedInTravelState
    specialDesc = "The NPC looks eager to go north"
    escortDest = northPlace
    stateAfterEscort = npcGTS1
    stateDesc = "The NPC's hanging around the door to the north place. Follow him, perhaps?"
    arrivingWithDesc = "The NPC walks back to the north door and hold it open. <q>Let's go back once more, shall we?</q>"
;

Result:

>n
North place

The NPC looks eager to go south

>s
The NPC noticing you are ready, leads the way to the the next room.  You tag along.

South place

The NPC walks back to the north door and hold it open.  "Let's go back once more, shall we?"

>n
The NPC noticing you are ready, leads the way to the the next room.  You tag along.

North place

The NPC walks back to the south door and hold it open.  "Encore!"

Hope that it helps!

For a little different thing, I have toyed (perhaps “fooled around” guiding NPC, and I found an interesting problem: the NPC ending not only in a room, but also sitting, say, on a chair (I think is a classic scene: NPC leading the PC his study/office and sitting on his desk chair)

How this can be done ? I think that is an interesting weekend coding challenge… :wink:

Best regards from Italy,
dott. Piergiorgio.

I almost feel like Marty McFly that cannot resist a challenge :wink:

But code challenges are in general a great idea, so why not!

My contribution would be to set the stateAfterEscort property in the last GuidedInTravelState to the new ActorState and in that next state handle it in the arrivingTurn method. I expanded on the previous example:


gameMain: GameMainDef {
  initialPlayerChar = me
  showIntro() {
        "<.p><q>Hey! I really need to fetch cup before the interview, follow me and I'll let you see the cafeteria </q> Mr Funky says.<.p>";
        MrFunky.setCurState(mrFunkyGuideToCoffeeMachine);  
  }
}

class CustomizedNpcGuidedInTravelState: GuidedInTravelState
    sayDeparting(conn) { 
        "Mr Funky leads the way. You tag along. ";
    }
;

me: Actor 'you' 'you' @office;

coffeeMachineArea: Room 'The coffee machine area' 'the coffee machine area' 
    north = office;
+coffeeMachine: Fixture 'coffee machine' 'coffee machine';


office: Room 'The office place' 'the office place' 
    south = coffeeMachineArea;

+chair: Chair 'mr Funky\'s chair' 'chair';

MrFunky: TourGuide, Person 'mr Funky' 'mr Funky' 
    desc = "He's Mr Funky, looking crazy similar to Newman. Nevertheless he's your potentially new boss here at Funky Place. " 
    location = office
    isHim = true
    isProperName = true
;

+mrFunkyGuideToCoffeeMachine: GuidedTourState
    escortStateClass = CustomizedNpcGuidedInTravelState
    specialDesc = "Mr Funky looks eager to go to fetch some coffee (at the south exit). "
    escortDest = coffeeMachineArea   
    stateAfterEscort = mrFunkyGuidingBackToOfficeState
    stateDesc = "Mr Funky's waiting for you by the door. "
;

+mrFunkyGuidingBackToOfficeState: GuidedTourState
    escortStateClass = CustomizedNpcGuidedInTravelState
    specialDesc = "Mr Funky looks eager to go back to the office"
    escortDest = office
    stateAfterEscort = mrFunkyInterviewingState
    stateDesc = "Mr Funky's hanging around the door to the office. You'll have to forget about your coffee this time. "
    arrivingWithDesc = "Mr Funky, quickly fetches a cup, presses a few buttons and then grabs his mug of hot brew. Obviously forgetting to ask if you would like some. <.p>Then he walks right back to the north door and hold it open. <q>Let's go back and continue the interview, shall we?</q>"
;

+mrFunkyInterviewingState: ActorState
    arrivingWithDesc = ""
    arrivingTurn() {
        MrFunky.moveInto(chair);
        MrFunky.posture = sitting;
        "Mr Funky sits down in his chair. ";
        MrFunky.initiateConversation(nil, 'mrfunky-interview');
    }
    specialDesc() {
        if(self.isIn(chair)) {
            "Mr. Funky is sitting in his chair, interviewing you. ";
        }
        "Mr Funky is here, interviewing you. ";
    }
;

+ DefaultAskTellTopic "<q>I see...</q> Mr Funky says. ";    

+ ConvNode 'mrfunky-interview' npcGreetingMsg = "<.p><q>So tell me about yourself</q> he asks. ";

++ AskTellTopic @me "<q>Well... ahem..</q> you begin... ";;
 

Interesting example; but how you compiled it ? :wink:

(hint:

symbol_export mrfunk.t -> obj/mrfunk.t3s

mrfunk.t(21): error: too many ‘+’ signs in object definition - location not defined
mrfunk.t(27): error: too many ‘+’ signs in object definition - location not defined
mrfunk.t(38): error: too many ‘+’ signs in object definition - location not defined
mrfunk.t(47): error: too many ‘+’ signs in object definition - location not defined
mrfunk.t(60): error: too many ‘+’ signs in object definition - location not defined
mrfunk.t(75): error: too many ‘+’ signs in object definition - location not defined
mrfunk.t(77): error: too many ‘+’ signs in object definition - location not defined
mrfunk.t(80): error: too many ‘+’ signs in object definition - location not defined
Errors: 8
Warnings: 0
)

Best regards from Italy,
dott. Piergiorgio.

You’ll need the regular headers and versionInfo also. I’ll update the example

Right. no need to add those to your source; pasting into a skeleton is enough (I prefer skeleton to shell, because for me (Linux user…) the latter is a very different type of program/code…)

Alright! Just ping me if there’s any trouble, but that should be it.

np. the solution is good; you can consider yourself the solver of this exercise [1] :slight_smile:

[1] Being a military historian, “problem” for me means also “the tactical situation to be studied and answered”

Best regards from Italy,
dott. Piergiorgio.