Switch to Actor State from ConvNode

Hi again! I think I’m bothering you all too much, but I keep having questions and problems.

I have this test NPC called Michael. The game so far requires you to go up to him, answer “yes” or “no”, and then follow him. The yes/no part works right. My problem now is switching from the ConvNode for the yes/no to the GuidedTourState.

When I use Michael.setCurState(touring) in the YesTopic for the node, it gives me an error that an “=” comes after a property, not a ‘.’. I suppose it thinks Michael is a property for the YesTopic.

Every manual I found only shows setCurState inside another state, not a ConvNode. Is there a solution to this?

Would be easier to help with a code segment. But from the sound of it your code seems to be in property section of your topic class instead of in a specific method.

I think what you are trying to achieve can be solved by setting the property “nextState=touring”. (p.232 learning tads3)
(Then you won’t need setCurState at all)

Be careful where it is placed though. Safest bet would be at the bottom of the YesTopic so it won’t interfere with the template fields

1 Like

I was mistaken it seems. nextState property only seems to work if placed in InConversationState and will trigger only if Michael.endConversation() was executed.

A simpler way to do it would be

++YesTopic, SuggestedYesTopic
   topicResponse() {
       “The text...”;

Not sure if it is the best way but it works.

1 Like

Ah, turns out all I had to do was to put it inside the topicResponse property. Thanks a bunch!