Jump to content

What is the best way to provide alternative SAY strings?


cdx

Recommended Posts

Is there a syntax for randomly showing one of two SAY options? Something that would work as this code looks?

IF ~~ t2.7
  SAY_OPTION(2,1) ~Hi, have you changed your mind?~
  SAY_OPTION(2,2) ~Hello, have you changed your mind?~
  + ~RandomNum(3,1)~ + ~No..~ + t2.8
  + ~RandomNum(3,2)~ + ~Nope.~ + t2.8
  + ~RandomNum(3,3)~ + ~Not at all.~ + t2.8
  ++ ~Yes.~ + t3
END

In the Branwen tutorial mod I can see a way that works but it seems quite round-about:  https://github.com/Pocket-Plane-Group/Branwen_for_BGII/blob/master/Branwen/Dialogue/O%23Bra25J.d#L841

For my example, in t2.6 I could have two identical REPLY options which lead to two different states, but then I'd need to repeat the t2.7 REPLY options in two states. A lot of repetition.

Or the t2.6 REPLY options could lead to t2.7option1 ("Hi.") and t2.7option2 ("Hello.") which both point to t2.7 ("Have you changed your mind?"). This way I'd have the t2.7 REPLY options written only once but I need two extra transitionary states.

Any way to streamline this similar to the code above? In weidu, or maybe some library from a mod?

Link to comment

The reply options are for what the player can click only. If you want your NPC to say a random line when spoken to, you'd need to make several dialogue states that include a RandomNum trigger. And yes, making them lead to the same state so you don't have to double the reply options into every state is a good idea for maintaining the mod*. Something like this:

IF ~RandomNum(2,1)~ t2.7
  SAY ~Hi!~
  IF ~~ THEN + t2.7.3
END

IF ~RandomNum(2,2)~ t2.7.2
  SAY ~Hello!~
  IF ~~ THEN + t2.7.3
END

IF ~~ t2.7.3
  SAY ~Have you changed your mind?~
  + ~RandomNum(3,1)~ + ~No..~ + t2.8
  + ~RandomNum(3,2)~ + ~Nope.~ + t2.8
  + ~RandomNum(3,3)~ + ~Not at all.~ + t2.8
  ++ ~Yes.~ + t3
END

*But keep in mind that every new line means the player has to click to advance the dialogue. Making a greeting's dialogue several clicks every time one only to talk to a quest character can easily turn into a nuisance.

Link to comment

That's nearly exactly what I had in the file :). I was hoping that there would be a more stremlined way to do it.

Thanks for pointing out about the clicking. The conversation I'm doing isn't very long, so I keep thinking more is better, but I can see how it can become tedious.

Here's a better example of what I was hoping there would be a way to do, with a different syntax (where ~%RND(3)% %x% %y% %z%~ returns a random one of x, y, or z). It would be great for replayability or repetitive processes. The "++" random selection is convenient but for "SAY" it takes fiddling.

IF ~~ t2.7
  SAY ~%RND(4)% %I'll catch you!% %You can't run away from me!% %It's pointless running!% %You've nowhere to run!%~
  = ~%RND(3)% %I'm right behind you, ha!% %I'm catching up, hehe.% %Nearly got you!%~
  = ~Theere you are. Think you can outrun me?~
  ++ ~%RND(2)% %I wasn't running, I just wanted to pick up my glove. Here, got it.% %I wasn't running from you, I just wanted to see if we could jog for a bit!%~ + t2.8
  ++ ~%RND(2)% %Ok, you've got me, happy now?.% %Well, you've got your filthy paws on me, satisfied?%~ + t2.9
END

IF~~ t2.8
  SAY ~%RND(2)% %As if. It's time to pay up, now.% %You think somebody would ever believe that? Time to pay your debt.%~
  IF ~~ + next.thing
END

IF~~ t2.9
  SAY ~%RND(2)% %Indeed, as happy as a kitten who gets all it's gold back.% %Indeed, as happy as a purse full of coin. Coin you owe me.%~
  IF ~~ + next.thing
END

I wonder if EEEx or TOBEx have something like this, to take a string and parse it and display just a randomly selected part of it.

It is another matter that writing with so much variation not much content would get done. After playing Hades non-repetition and text variation seem great though.

Link to comment

I will just say this: for the amount of effort you are going to put into making some lines read a little differently you can write whole new conversations and quests. Isn't that more worthwhile? Yes, it would be very nice for immersion and be an entirely novel experience if ALL conversations wobbled and varied like this. It would look much more like talking to real people. But then the writers' rocket would never get far from its launch pad, especially if the things said, and therefore to be multiplied by x here, are more profound than "hi" and "hello." Writing is about sacrificing side branches and much complexity for the sake of strength in the direction you want to go.

IF ~RandomNum(4,1)~ THEN REPLY ~To be or not to be: that is the question.~
IF ~RandomNum(4,2)~ THEN REPLY ~Yet should I be or should I not be?~
IF ~RandomNum(4,3)~ THEN REPLY ~'Tis being vs. being not, aye, that's the rub.~
IF ~RandomNum(4,4)~ THEN REPLY ~Beep-beep!~

From "The Unpublished Shakespeare."

And that's for replies. For states, though, there is no increase in clicks if you diversify the states you would show in any case with RandomNum. Your NPC is going to say SOMETHING, so in addition to his "Greetings, what can I do for you?" you can write a few more, and it won't take any longer to get to same place. However, in both cases you will be forcing the player to peruse the alternative text instead of fast-forwarding to the results, and if your alternates don't provide any real information or lead to another outcome, he will just be wasting his time. I would use these random alternates only if I could both make all of them worth reading, entertaining or informative, whichever of them the player clicks across, as well as obviously tending to the same result - by a scenic route. Familiars' conversations are an example of something that could use a bit of this, and do, I think, only they are just bad.

But ultimately, come on, make a new quest instead.

Link to comment

Instead of randomizing absolutely, you could tailor one response for class, and another for race.  Where applicable.

Link to comment
On 3/23/2022 at 10:30 PM, jastey said:

The reply options are for what the player can click only. If you want your NPC to say a random line when spoken to, you'd need to make several dialogue states that include a RandomNum trigger. And yes, making them lead to the same state so you don't have to double the reply options into every state is a good idea for maintaining the mod*. Something like this:

COPY_TRANS works just fine in dialogues being compiled so you don't have to route them to an intermediate state, e.g.

BEGIN CDTEST

  IF ~RandomNum(2,1)~ Intro1 SAY ~Greetings! I have an incredible offer for you.~
    IF ~RandomNum(3,1)~ THEN REPLY ~No thanks.~ EXIT
    IF ~RandomNum(3,1)~ THEN REPLY ~Yes.~ GOTO QuestExpo
    IF ~RandomNum(3,2)~ THEN REPLY ~Short answer: no. Long answer: noooooooooo.~ EXIT
    IF ~RandomNum(3,2)~ THEN REPLY ~Yes, please.~ GOTO QuestExpo
    IF ~RandomNum(3,3)~ THEN REPLY ~Ah, hell naw.~ EXIT
    IF ~RandomNum(3,3)~ THEN REPLY ~Ooh, tell me, tell me, tell me!~ GOTO QuestExpo
  END

  IF ~RandomNum(2,2)~ Intro2 SAY ~Hello freinds! Would you like to hear about my exciting quest?~  
    COPY_TRANS CDTEST Intro1
  END

  IF ~~ QuestExpo SAY ~(exciting quest exposition here)~    
    IF ~~ THEN EXIT
  END

Both top states will have the same six transitions, without the extra maintenance and without an extra spacebar mash for the players. Though very limited, tokens can also be used to vary dialogue a bit.

Link to comment
1 hour ago, CamDawg said:

Both top states will have the same six transitions, without the extra maintenance and without an extra spacebar mash for the players.

I knew that! .. But never thought of actually using it in own dialogue states to spare doubling of reply options. That's genius.

Link to comment
On 3/26/2022 at 8:14 AM, CamDawg said:

COPY_TRANS works just fine in dialogues being compiled so you don't have to route them to an intermediate state, e.g.

BEGIN CDTEST

  IF ~RandomNum(2,1)~ Intro1 SAY ~Greetings! I have an incredible offer for you.~
    IF ~RandomNum(3,1)~ THEN REPLY ~No thanks.~ EXIT
    IF ~RandomNum(3,1)~ THEN REPLY ~Yes.~ GOTO QuestExpo
    IF ~RandomNum(3,2)~ THEN REPLY ~Short answer: no. Long answer: noooooooooo.~ EXIT
    IF ~RandomNum(3,2)~ THEN REPLY ~Yes, please.~ GOTO QuestExpo
    IF ~RandomNum(3,3)~ THEN REPLY ~Ah, hell naw.~ EXIT
    IF ~RandomNum(3,3)~ THEN REPLY ~Ooh, tell me, tell me, tell me!~ GOTO QuestExpo
  END

  IF ~RandomNum(2,2)~ Intro2 SAY ~Hello freinds! Would you like to hear about my exciting quest?~  
    COPY_TRANS CDTEST Intro1
  END

  IF ~~ QuestExpo SAY ~(exciting quest exposition here)~    
    IF ~~ THEN EXIT
  END

Both top states will have the same six transitions, without the extra maintenance and without an extra spacebar mash for the players. Though very limited, tokens can also be used to vary dialogue a bit.

@CamDawg did you try to use COPY_TRANS like this? I just did and it tells me it can't resolve the custom internal label.

Link to comment

@CamDawg this is what I am trying to compile:

EDIT: oh, I'm still at v246. Does this make a difference?

Spoiler

APPEND bdjaheir

IF ~~ THEN warning_boarskyr_bridge
SAY ~yadda.~
++ ~You sound concerned, Jaheira.~ + warning_boarskyr_bridge_0A
++ ~Enlighten me.~ + warning_boarskyr_bridge_0B
END

IF ~~ THEN warning_boarskyr_bridge_0A
SAY ~blah~
IF ~~ THEN + warning_boarskyr_bridge
END

IF ~~ THEN warning_boarskyr_bridge_0B
SAY ~more blah~
IF ~~ THEN + warning_boarskyr_bridge
END

IF ~~ THEN warning_boarskyr_bridge_00
SAY ~blahblah~
COPY_TRANS bdjaheir warning_boarskyr_bridge
END

END

And this is the error message:

Spoiler

[BDJAHEIR.DLG] loaded
ERROR: Cannot resolve internal symbolic label [warning_boarskyr_bridge] for DLG [BDJAHEIR]
Known labels: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100
ERROR: Cannot process COPY_TRANS (Failure("cannot resolve label"))
ERROR: processing COPY_TRANS [tb#_compile_eval_buffer/c#sodboabri/acknoweldge_boareskyr_bridge/bhaalheritage_boareskyr_bridge.d]: Failure("cannot resolve label")
Stopping installation because of error.

 

(I know there is a typo in the bridge's name.)

If this is something obvious I don't see it.

Link to comment

There's a long and boring technical reason, but basically it's the difference between creating a new dialogue with BEGIN vs. adding to one with APPEND. The tl;dr is to use COPY_TRANS_LATE here instead.

(Basically: COPY_TRANS captures transitions at the moment of compilation, and the state 'warning_boarskyr_bridge' doesn't exist at the time. It works with the example above because WeiDU makes an exception when you're creating a new dialogue and adds the state labels for use.)

 

Link to comment

Join the conversation

You are posting as a guest. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...