Jump to content

Interjecting after player response.


Glam Vrock

Recommended Posts

Let's say the player is talking to a townsperson and is given dialogue options. When the player selects one, I want a party member to interject immediately, before the townsperson says their line. Any non-fiddly way of doing this? Seems like it'd require modifying the townsperson's dlg file or hijacking the entire conversation, but maybe I'm missing something obvious.

Link to comment

I think you could do that with CHAIN easily enough. Hang on while I think this through...

 

(First case, new townsperson)

 

BEGIN ~##TOWN~

 

CHAIN IF ~NumTimesTalkedTo(0)~ ~##TOWN~ intro1

~Hello there, I see you have a nice cow. I want to buy it!~

END

 

// escaping the conversation

++ ~I love my cow and you're not having her. Come along, Bessie!~ EXIT

 

// use the death variable for your NPC here, if it's different from you dlg

// not in the party - go to normal townie conversation

+~!InParty("##MYNPC")~+ ~This intrigues me; what do you offer?~ EXTERN ~##TOWN~ intro2

 

// your NPC is in the party and available to talk:

+ ~InParty("##MYNPC") !StateCheck("##MYNPC",CD_STATE_NOTVALID)~+ ~This intrigues me; what do you offer?~ EXTERN ~##MYNPCJ~ mynpcinterrupt

 

// your NPC is in the party but NOT available to talk, go to normal conversation

+ ~InParty("##MYNPC") StateCheck("##MYNPC",CD_STATE_NOTVALID)~+ ~This intrigues me; what do you offer?~ EXTERN ~##TOWN~ intro2

 

CHAIN IF ~~ ~##TOWN~ intro2

~I have these wonderful nitrogen-fixing leguminous pods...~

EXIT

 

// And your NPC butting in:

 

CHAIN IF ~~ ~##MYNPCJ~ mynpcinterrupt

~Beans! Beans!~ EXTERN ~##TOWN~ intro2 // and back to the conversation

 

(The next part is more complicated, but I'm getting there.)

Link to comment

(Second case, existing conversation)

 

We'll assume that State 0 is the line where the townie offers to buy your cow, and State 1 is where they offer the fancy leguminous pods.

 

EXTEND_BOTTOM to add an extra reply wouldn't work, because the original responses that didn't see your NPC would still be there. So... INTERJECT can be our friend, too. I'm going to start by giving the townie another line. (We'll give them a slightly different dlg tag, for clarity.)

 

INTERJECT ~TOWNY~ 0 MyNPCInterrupt

== ~TOWNY~ ~Sorry, I meant, "I want to buy 'her'." Cows don't like being objectified.~

END

// the responses as before:

++ ~I love my cow and you're not having her. Come along, Bessie!~ EXIT

+~!InParty("##MYNPC")~+ ~This intrigues me; what do you offer?~ EXTERN ~TOWNY~ 1 // back to the original conversation

+ ~InParty("##MYNPC") !StateCheck("##MYNPC",CD_STATE_NOTVALID)~+ ~This intrigues me; what do you offer?~ EXTERN ~##MYNPCJ~ mynpcinterrupt

+ ~InParty("##MYNPC") StateCheck("##MYNPC",CD_STATE_NOTVALID)~+ ~This intrigues me; what do you offer?~ EXTERN ~TOWNY~ 1

 

// And your NPC butting in:

 

CHAIN IF ~~ ~##MYNPCJ~ mynpcinterrupt

~Beans! Beans!~ EXTERN ~TOWNY~ 1 // and back to the original conversation with the existing Towny.

 

**

I... think that should work? (INTERJECT isn't something I work with a lot, sorry.) Good luck!

 

EDIT: Found a better example of INTERJECT code, yes you can put your private copy of PC replies into the INTERJECT, example block edited for smoothness. (Yay!)

 

EDIT: Another thing to bear in mind is that the INTERJECT will skip any extra responses that other mods might put in. So just... be sparing when you use this.

Link to comment

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...