Jump to content


Photo

Mini-Tutorial: Using Global Variables to Filter Content in a Dialogue on the Fly


1 reply to this topic

#1 Thimblerig

Thimblerig
  • Modders
  • 1375 posts
  • Gender:Female
  • Location:New Zealand

Posted 20 December 2014 - 08:06 PM

Sometimes we might want to write dialogue that while rich in literary value or important to a character's story arc has content that some players might find a bit too dark (but we know that others will adore for its fraught intensity).  Or perhaps we want a choice between Straight Dialogue and Dialogue + PST-style Descriptive Action.  We want as many players happy as we can.  (Double Happiness is a Win.)  The current state of .d coding lets us do this pretty easily.

 

Any dialogue will use IF checks in its transitions (IF Charname is a dwarf, IF a specific item is in your inventory, IF a particular dialogue option was chosen etc.)  You just factor in a player-chosen Global variable guarding that content into your transitions.  For example:

 

1.

 

IF ~~ historytalk

SAY ~You really want to hear about my family?~

+ ~Global("##MatureContent","GLOBAL",0)~ + ~Sure, tell me all about it.~ + historytalklight

+ ~Global("##MatureContent","GLOBAL",1)~ + ~Sure, tell me all about it.~ + historytalkheavy

++ ~Maybe later.~ EXIT

END

 

IF ~~ historytalklight

SAY ~We were attacked by bandits.~  

= ~I survived... barely.~  

= ~And now I'm here.~

IF ~~ EXIT

END

 

IF ~~ historytalkheavy

SAY ~We were attacked by bandits.~  

= ~It happened early one morning and I remember that I'd been listening to the larks and planning on going berry-hunting later.~

= ~(detail)~

= ~(detail)~

= ~I survived... barely.~  

= ~And now I'm here.~

IF ~~ EXIT

END

 

**

 

2.

 

Or you can do it more implicitly with something like this:

 

IF ~~ historytalk

SAY ~You really want to hear about my family?~

IF ~Global("##MatureContent","GLOBAL",0)~ + historytalklight  .

IF  ~Global("##MatureContent","GLOBAL",1)~ + historytalkheavy

END

 

etc. 

 

// all the player sees is dialogue lines coming one after another as they click [Continue]

 

**
 
3.
 
Or, if you're using CHAIN blocks
 
CHAIN IF ~~ THEN ##MYNPC historytalk
~You really want to hear about my family?~
= ~We were attacked by bandits.~
== ##MYNPC IF  ~Global("##MatureContent","GLOBAL",1)~ THEN ~It happened early one morning and I remember that I'd been listening to the larks and planning on going berry-hunting later.~
== ##MYNPC IF  ~Global("##MatureContent","GLOBAL",1)~ THEN ~(detail)~
== ##MYNPC IF  ~Global("##MatureContent","GLOBAL",1)~ THEN ~(detail)~
== ##MYNPC ~I survived... barely.~  
= ~And now I'm here.~
EXIT
 
// this will look to the player exactly like Case 2.

Edited by Thimblerig, 20 December 2014 - 10:19 PM.


#2 jastey

jastey
  • Gibberlings
  • 6632 posts
  • Gender:Female

Posted 20 December 2014 - 11:54 PM

For getting the variable into the game, there are two ways, too. berelinde's Gavin, for example, let's the player chose the level of detail via a reply option, I think.

What bg1re and my Ajantis for BGII do, though, is compile a little script upon install that sets the variable via the baldur.bcs (or baldur25.bcs, for ToB).

 

The first has the disadvantage of the 4th wall breaking - and, if it's a dumb player like me, the risk that people just DON'T GET what the NPC's question is about and that's the modder asking, in reality. (Of course in the game the NPC would ask something like "How detailed do you want me to describe my past", but my caring PC would say "oh, but I am interested in any and all detail, if you want to tell me" because she feels obliged.)

The advantage is, that players can switch during playing, that there is not another script block cluttering the baldur.bcs...

 

Doing via a small script upon install has the disadvantage that the player has to decide during install, it adds another script block to the already really long modded baldur.bcs, and the installer has one additional component. The advantage is that players really know what they get, and don't have to be afraid of missing a warning while playing.

 

(And for coding the dialogues, I'd use CHAIN as often as you can. It's so nifty for things like this. Also to distinguish between romence and not-romance case, or other NPCs chiming in!)





Reply to this topic



  


1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users