Jump to content


Romance Specific coding questions


  • Please log in to reply
116 replies to this topic

#1 -Ashara-

-Ashara-
  • Guest

Posted 09 February 2004 - 07:08 PM

Well, since there is no romance making tutorials, I was wondering if we can create one? So here are my questions. If anyone knows an answer to at least one of them and post it, I will be extremely greatful!


1) Are all the romantic talks added to character?s B file?
2) Where do I set the RomanceMatch variable? Is it GLOBAL or LOCALS?
3) Where do I set the RomanceActive Variable? Is it GLOBAL or LOCALS?
4) Weight system. Say I want the talks in sequence, and a few talks occurring under certain circumstances only. How can I manage that so the ?not necessary? talks will not stop the ?sequential? talks?
5) Will you be able to provide an example of using DO functions RestParty() and PartyRested() and BAF file which is appended to the Dream script to make the dialogues happen
a) at initiating rest
B) at waking up

6) How to do the Morning After talks (ie immediate follow up after the at rest talk and rest?)
7) How many files and which type are needed to create a PC initiated talk, ie flirt? Do I need anything in the character script changed to enable him/her to be flirtable?
8) What Dialogue file do flirts go to?
9) Will you be able to provide an example of a flirt?
10) How to set up the random options of the reply?

#2 Sillara

Sillara

    He made me love him without looking at me.

  • Member
  • 537 posts

Posted 09 February 2004 - 08:08 PM

I do not know the answers to any of the questions, but I second the motion for a romance tutorial!! :rolleyes: I had exactly the same questions! :blink: :blink: Please, one of you experienced romance modders out there--respond! :(
Check out my RPG forum!

#3 Andyr

Andyr

    HERR RASENKOPF

  • Member
  • 2318 posts

Posted 10 February 2004 - 05:07 AM

Domi, romance coding is the same as normal dialogue. I will explain it to you on MSN if you want. :)
"We are the Gibberlings Three, as merry a band as you ever did see..." - Home of IE mods

< jcompton > Suggested plugs include "Click here so Compton doesn't ban me. http://www.pocketplane.net/ub"

#4 Sillara

Sillara

    He made me love him without looking at me.

  • Member
  • 537 posts

Posted 10 February 2004 - 05:14 AM

I would like the explanation, too! :o Is there a way I could see it, too? I am getting along fairly well (I think; Seifer? dorotea?) with my dialogue coding, but flirt pack and Lovetalk coding still seems mysterious to me. Is there any place that answers the 10 questions domi posted above? Those are my questions, too!

Sillara
Check out my RPG forum!

#5 Kismet

Kismet

    Mild Thang

  • Member
  • 348 posts

Posted 10 February 2004 - 05:27 AM

Well, since there is no romance making tutorials, I was wondering if we can create one? So here are my questions. If anyone knows an answer to at least one of them and post it, I will be extremely greatful!


1) Are all the romantic talks added to character?s B file?


By BioWare convention they are, but they don't *have* to be.

2) Where do I set the RomanceMatch variable? Is it GLOBAL or LOCALS?

GLOBAL

3) Where do I set the RomanceActive Variable? Is it GLOBAL or LOCALS?

GLOBAL

4) Weight system. Say I want the talks in sequence, and a few talks occurring under certain circumstances only. How can I manage that so the ?not necessary? talks will not stop the ?sequential? talks?


In the non-essential talks do not include whatever variable you're using for your sequential talks. And don't set any variables in the non-essential talks that will be checked in the sequential talks.

5) Will you be able to provide an example of using DO functions RestParty() and PartyRested() and BAF file which is appended to the Dream script to make the dialogues happen
a) at initiating rest
B) at waking up


I know Kelsey's romance and Anomen + flirt packs romance both do this. Check their files.

6) How to do the Morning After talks (ie immediate follow up after the at rest talk and rest?)


See above

7) How many files and which type are needed to create a PC initiated talk, ie flirt? Do I need anything in the character script changed to enable him/her to be flirtable?

No, but if you want the NPC to initiate flirts you would have to add a timer so that he'd flirt every so often. Again, check the flirt packs and or Kelsey.

8) What Dialogue file do flirts go to?

By convention they use the J dialog file.

9) Will you be able to provide an example of a flirt?
10) How to set up the random options of the reply?


They use RandomNum(x.y) in the reply trigger. Check the flirt pack for examples.

#6 -Domi_S-

-Domi_S-
  • Guest

Posted 10 February 2004 - 06:46 AM

The problem is that looking in the existing mods for examples one runs into:

a) Shorthand - and all I know is that ++ is used for IF~~THEN REPLY. Is there a tutorial on shorthand?
B) blocks being non-sequencial - ie you do not see the full dialogue, only bits and pieces of it. alternate with other dialogues etc.

What I would like to see is an example of a flirt in the same form as the banter example in the "Road to Banter" tutorial. Ie the full text of the flirt and how it was coded in?

I know it takes time and willingness to do that, but that probably will make life much easier to both those who just start out and those who do not have to be bugged by many different people with the same question. I mean, how many times people complained that WeiDU "does not start" before Dos for Dummies was out?

Yes, it is an unelegant way to teach, but at least it provides easy access.

For morning after, again it would be nice if someone done the same thing Ghrey had done in his NPC tutorial: showed the dialogue and the associated BSC block in the dream script.

#7 Kismet

Kismet

    Mild Thang

  • Member
  • 348 posts

Posted 10 February 2004 - 08:49 AM

Okay, an example of some NPC and PC init flirts. Here's my flirt setup with filler dialog for Cailean. (note, this stuff isn't actually appearing the mod, I just put it in to make sure the flirts mechanically work)

The Cailean init flirts would look like:
C: I'm going to start a flirt now.
(random)
C: (Cailean gives you a kiss on the cheek.)

The PC init flirt menu would look like:
C: (Cailean notices you approach.)
PC1: Hold Cailean's hand.
PC2: Kiss Cailean
PC3: Cailean, I like you very much, but please don't flirt with me anymore.
PC4: (Say nothing.)

If you choose Kiss Cailean, you'd randomly get one of the kisses.

This gets appended to the J dialog file.
APPEND FWCailej

//Cailean init flirts
IF ~Global("FWCaiDisableFlirts","GLOBAL",0)
    See(Player1)
    !StateCheck(Player1,STATE_SLEEPING)
    CombatCounter(0)
    Global("FWCaileanRomanceActive","GLOBAL",1)
    Global("FWCaileanStartFlirt","GLOBAL",1)~ THEN BEGIN CaileanInitFlirts
  SAY ~I'm going to start a flirt now.~
  IF ~~ THEN DO ~IncrementGlobal("FWCaileanRandFlirt","LOCALS",1)~ GOTO CaileanInitHand
  IF ~RandomNum(2,1)~ THEN DO ~IncrementGlobal("FWCaileanRandFlirt","LOCALS",1)~ GOTO CaileanInitKiss
  IF ~RandomNum(2,2)~ THEN DO ~IncrementGlobal("FWCaileanRandFlirt","LOCALS",1)~ GOTO CaileanInitTickle
END

IF ~~ THEN BEGIN CaileanInitHand
  SAY ~(Cailean takes a hold of your hand.)~
  IF ~~ THEN EXIT
END

IF ~~ THEN BEGIN CaileanInitKiss
  SAY ~(Cailean gives you a kiss on the cheek.)~
  IF ~~ THEN EXIT
END

IF ~~ THEN BEGIN CaileanInitTickle
  SAY ~(Cailean tickles your ribs.)~
  IF ~~ THEN EXIT
END

//PC init flirts -- early
IF ~IsGabber(Player1)
    CombatCounter(0)
    GlobalGT("FWCaiInitLoveTalk","GLOBAL",6)
    Global("FWCaileanQuestCompleted","GLOBAL",1)
    Global("FWCaileanRomanceActive","GLOBAL",1)~ THEN BEGIN CaiFlirtBaseEarly
  SAY ~(Cailean notices your approach.)~
  + ~RandomNum(4,1)~ + ~(Hold Cailean's hand.)~ DO ~IncrementGlobal("FWCaileanFlirtCount","LOCALS",1)~ + HandHold1
  + ~RandomNum(4,2)~ + ~(Hold Cailean's hand.)~ DO ~IncrementGlobal("FWCaileanFlirtCount","LOCALS",1)~ + HandHold2
  + ~RandomNum(4,3)~ + ~(Hold Cailean's hand.)~ DO ~IncrementGlobal("FWCaileanFlirtCount","LOCALS",1)~ + HandHold3
  + ~RandomNum(4,4)~ + ~(Hold Cailean's hand.)~ DO ~IncrementGlobal("FWCaileanFlirtCount","LOCALS",1)~ + HandHold1

  + ~RandomNum(4,1)~ + ~(Kiss Cailean.)~ DO ~IncrementGlobal("FWCaileanFlirtCount","LOCALS",1)~ + Kiss1
  + ~RandomNum(4,2)~ + ~(Kiss Cailean.)~ DO ~IncrementGlobal("FWCaileanFlirtCount","LOCALS",1)~ + Kiss2
  + ~RandomNum(4,3)~ + ~(Kiss Cailean.)~ DO ~IncrementGlobal("FWCaileanFlirtCount","LOCALS",1)~ + Kiss3
  + ~RandomNum(4,4)~ + ~(Kiss Cailean.)~ DO ~IncrementGlobal("FWCaileanFlirtCount","LOCALS",1)~ + Kiss4
  ++ ~Cailean, I like you very much, but please don't flirt with me anymore.~ DO ~SetGlobal("FWCaiDisableFlirts","GLOBAL",1)~ EXIT
  ++ ~(Say nothing.)~ EXIT
END

IF ~~ THEN BEGIN HandHold1
  SAY ~Cailean holds your hand 1.~
  IF ~~ THEN EXIT
END

IF ~~ THEN BEGIN HandHold2
  SAY ~Cailean holds your hand 2.~
  IF ~~ THEN EXIT
END

IF ~~ THEN BEGIN HandHold3
  SAY ~Cailean holds your hand 3.~
  IF ~~ THEN EXIT
END

IF ~~ THEN BEGIN Kiss1
  SAY ~Cailean kisses you 1.~
   = ~It's a really long kiss.~
  IF ~~ THEN EXIT
END

IF ~~ THEN BEGIN Kiss2
  SAY ~Cailean kisses you 2.~
  IF ~~ THEN EXIT
END

IF ~~ THEN BEGIN Kiss3
  SAY ~Cailean asks about the kiss~
  ++ ~Kiss answer 1.~ + Kiss3_1
  ++ ~Kiss answer 2.~ + Kiss3_2
  ++ ~Kiss answer 3.~ + Kiss3_3
END

IF ~~ THEN BEGIN Kiss3_1
  SAY ~Cailean kisses you 3_1~
  IF ~~ THEN EXIT
END

IF ~~ THEN BEGIN Kiss3_2
  SAY ~Cailean kisses you 3_2~
  IF ~~ THEN EXIT
END

IF ~~ THEN BEGIN Kiss3_3
  SAY ~Cailean kisses you 3_3.~
  IF ~~ THEN EXIT
END

IF ~~ THEN BEGIN Kiss4
  SAY ~(Cailean kisses you 4.)~
  IF ~~ THEN EXIT
END
END

These script blocks get added to Cailean's script and are for triggering the Cailean init flirts.

//Resets Cailean's flirt timer if in combat
IF
    RealGlobalTimerExpired("FWCaileanFlirtTimer","LOCALS")
    !CombatCounter(0)
THEN
    RESPONSE #100
        SetGlobal("FWCaileanStartFlirt","GLOBAL",0)
        RealSetGlobalTimer("FWCaileanFlirtTimer","LOCALS",100)
END

//Cailean flirts with PC
IF
    RealGlobalTimerExpired("FWCaileanFlirtTimer","LOCALS")
    Global("FWCaileanStartFlirt","GLOBAL",0)
    Global("FWCaiDisableFlirts","GLOBAL",0)
    InParty(Myself)
    !StateCheck(Player1,STATE_SLEEPING)
    Global("FWCaileanRomanceActive","GLOBAL",1)
    See(Player1)
    CombatCounter(0)
    !See([ENEMY])
    !Range([NEUTRAL],10)
THEN
    RESPONSE #100
        SetGlobal("FWCaileanStartFlirt","GLOBAL",1)
        StartDialogueNoSet(Player1)
        Wait(1)
END

//Reset flirt timer after flirting
IF
    RealGlobalTimerExpired("FWCaileanFlirtTimer","LOCALS")
    Global("FWCaileanStartFlirt","GLOBAL",1)
THEN
    RESPONSE #100
        SetGlobal("FWCaileanStartFlirt","GLOBAL",0)
        RealSetGlobalTimer("FWCaileanFlirtTimer","LOCALS",1500)
END

//Start flirt timer for first time
IF
    Global("FWCaileanFlirtsStarted","LOCALS",0)
    GlobalGT("FWCaiInitLoveTalk","GLOBAL",4)
    OR(2)
      Global("FWCaileanRomanceActive","GLOBAL",1)
      Global("FWCaileanRomanceActive","GLOBAL",2)
THEN
    RESPONSE #100
        SetGlobal("FWCaileanFlirtsStarted","LOCALS",1)
        RealSetGlobalTimer("FWCaileanFlirtTimer","LOCALS",600)
END


#8 -Ashara-

-Ashara-
  • Guest

Posted 10 February 2004 - 09:19 AM

Thank you so much! You made my day!

#9 dorotea

dorotea

    witch extraordinaire

  • Modder
  • 1927 posts

Posted 10 February 2004 - 09:49 AM

1) Are all the romantic talks added to character’s B file?

Yes - most of them. But I also use J file , especially for the weighted non-sequential talks.


2) Where do I set the RomanceMatch variable? Is it GLOBAL or LOCALS?

In the character override .bcs as in GABBER.bcs if it is SoA GABBER25.bcs if in ToB
but the naming is not essential - you set it in the cre file to be the override script.

it is GLOBAL

3) Where do I set the RomanceActive Variable? Is it GLOBAL or LOCALS?

GLOBAL - set it in the same file, ie your character override bcs script (or if you use baf's which I dislike - in the baf but it will be compiled into bcs as you can imagine)

4) Weight system. Say I want the talks in sequence, and a few talks occurring under certain circumstances only. How can I manage that so the “not necessary” talks will not stop the “sequential” talks?

All the weighted dialogs go into the character Gabberj.dlg file. Use weidu xxx.dlg to convert in-game dlg files into d files and look at them for examples. The smaller the weight the higher id the talk priority. Negative numbers is fine for weidu. So if you are modifying existing dialogs you can do -100 -99 etc and these will run 'before' the regular stuff. Be careful! These talks have to be triggered from inside the creature override bcs as in: IF (such and such condition) StartDialog(Player1) -> the game checks the weighted states in the j file after that and runs the one that is satisfying (ie its GLOBALS state match the triggers) It will scan all entries from top to bottom with the << numbers being checked first.


5) Will you be able to provide an example of using DO functions RestParty() and PartyRested() and BAF file which is appended to the Dream script to make the dialogues happen
a) at initiating rest
at waking up

The wake up dialogs have to be scripted using the GABBERD.bcs - check Anomens for example, I cannot give my own examples as they are 'proprietory' of the Edwin mod.

But Anomen is much similar. -> open his AnomenD.bcs and have a looksie. Have no clue as to how they do it in other mods though...

Again I dislike BAFs but they are just uncompiled bcs's

DO ~RestParty()~ works in the Dialog like a charm... what is the problem again?

to start the morning after talk you have to use GabberD.bcs again...

6) How to do the Morning After talks (ie immediate follow up after the at rest talk and rest?)

See above

7) How many files and which type are needed to create a PC initiated talk, ie flirt? Do I need anything in the character script changed to enable him/her to be flirtable?

No clue - never did flirts. Kismet gave you a very good answer though.

8) What Dialogue file do flirts go to?

see above

9) Will you be able to provide an example of a flirt?

10) How to set up the random options of the reply?

I am no expert on flirts. :) The difficulty of coding the romance cometh mostly from setting Timers IHMO - but since you did not ask for it yet I shall stay mum.

Happy coding!

Freedom cannot be equated with goodness, virtue, or perfection. Freedom has its own unique self-contained nature; freedom is freedom ? not universal goodness. Any confusion or deliberate equalization of freedom with goodness and excellence is in itself negation of freedom, and acceptance of the path of restraint and enforcement.

Nikolai Berdyaev - Christian Existentialist, Philosopher of Freedom.


The Longer Road mod
Redemption mod
Bitter Grey Ashes


#10 Rastor

Rastor

    Yes, I really am a dragon. Yes, I am a jerk. Live with it.

  • Member
  • 2001 posts

Posted 10 February 2004 - 11:26 AM

1) Are all the romantic talks added to character?s B file?


The ones that are fired when resting are not. They go into the BXXXD.dlg file. Technically, the romance talks can go into the J file, but usually the B is used.

2) Where do I set the RomanceMatch variable? Is it GLOBAL or LOCALS?


LOCALS would probably work, but all of the Bioware ones are GLOBAL, so that's the better way to go.

3) Where do I set the RomanceActive Variable? Is it GLOBAL or LOCALS?


If you want anything except for that particular character to be able to see the state of your romance, make it a GLOBAL. Technically, the talks will fire either way, though.

6) How to do the Morning After talks (ie immediate follow up after the at rest talk and rest?)


Use the PartyRested() Trigger coupled with the Lovetalks in your NPC's scripts.

7) How many files and which type are needed to create a PC initiated talk, ie flirt? Do I need anything in the character script changed to enable him/her to be flirtable?


In the NPC's J file, do IF ~IsGabber(Player1)~ THEN BEGIN Flirts.

Kitanya expands on this a great deal, so if you want more than just that, check her files (as soon as I get the mod released).

8) What Dialogue file do flirts go to?


Put them in whichever one you did not put the LoveTalks into.
Home of Kitanya, Improved Asylum, more...

Posted Image

#11 Grim Squeaker

Grim Squeaker

    Fallen

  • Member
  • 1018 posts

Posted 10 February 2004 - 11:40 AM

1) Are all the romantic talks added to character?s B file?


The ones that are fired when resting are not. They go into the BXXXD.dlg file. Technically, the romance talks can go into the J file, but usually the B is used.

Actually in the Bioware ones they are just in the B####.dlg file. The triggering script for them however is the #####D.bcs.
"You alone can make my song take flight..."

#12 -Ashara-

-Ashara-
  • Guest

Posted 10 February 2004 - 05:41 PM

Thank you everyone for answers! It truly helps!

Now, I still have a couple of questions for the dream script.

Here is the ANOMEND.BSC

IF
!Global("AnomenRomanceActive","GLOBAL",0)
!Global("AnomenRomanceActive","GLOBAL",3)
Global("AnomenMatch","GLOBAL",1)
See(Player1)
CombatCounter(0)
OR(2)
  Global("LoveTalk","LOCALS",31)
  Global("LoveTalk","LOCALS",35)
THEN
RESPONSE #100
  IncrementGlobal("LoveTalk","LOCALS",1)
  RealSetGlobalTimer("AnomenRomance","GLOBAL",1)
  PlaySong(35)
  Interact(Player1)
END


It looks like the Dream Script below should trigger the LT's 32 and 36 (both from BANOMEN.DLG:

LT32 is this (looks like it has standard conditions, I cannot see anything specific related to dreaming:

IF WEIGHT #22 ~Global("AnomenMatch","GLOBAL",1)
Global("LoveTalk","LOCALS",32)
Global("AnomenIsKnight","GLOBAL",1)~ THEN BEGIN 425 // from:
SAY #35831 /* ~Might I be able to draw you away from the others for a while as they prepare to sleep? I have something to speak to you of, and 'tis for your ears only.~ [ANOMEN89] */
IF ~~ THEN REPLY #35833 /* ~Very well, I shall go with you.~ */ GOTO 426
IF ~~ THEN REPLY #35834 /* ~I'll go with you, Anomen...so long as there's no funny business.~ */ GOTO 430
IF ~~ THEN REPLY #35835 /* ~Forget it, Anomen...I just want to sleep.~ */ GOTO 431
END

The questions are:

1) What does this line do?

IncrementGlobal("LoveTalk","LOCALS",1)

2) What does this timer do?

RealSetGlobalTimer("AnomenRomance","GLOBAL",1)

#13 Rastor

Rastor

    Yes, I really am a dragon. Yes, I am a jerk. Live with it.

  • Member
  • 2001 posts

Posted 10 February 2004 - 06:00 PM

"AnomenRomance" is the timer that controls how fast the lovetalks fire.

IncrementGlobal("LoveTalk","LOCALS",1)


That increases the value of LoveTalk by 1. LoveTalks only fire on the (even or odd, different sources give different answers), so incrementing it by one ensures that a LoveTalk won't fire before time is up.
Home of Kitanya, Improved Asylum, more...

Posted Image

#14 Kismet

Kismet

    Mild Thang

  • Member
  • 348 posts

Posted 10 February 2004 - 06:00 PM

This script will return true only if the Global("LoveTalk","LOCALS") is 31 or 35 (in addition to the other conditions). IncrementGlobal will increase that Global("LoveTalk","LOCALS") to 32 (or 36). When it's 32, you get the LoveTalk you copied. If you look at Anomen.bcs you'll see that the block of the script that calls the lovetalks will not include lovetalks 31/35

The timer is Anomen's lovetalk timer. This talk happens the next time you rest regardless of whether or not the lovetalk timer has expired. Setting the timer to 1 expires the timer so that the script can reset it for the next lovetalk.

#15 Gabrielle

Gabrielle

    Do what thou wilt

  • Member
  • 1567 posts

Posted 10 February 2004 - 06:56 PM

Ah something I've been waiting for. This should help me understand romance scripts and dialogues and how they work together. One of the reasons why I've cease work on Ginafae is I do not understand all this yet.
For all of your BG modding needs: Chosen of Mystra.

This is The End.

#16 -Ashara-

-Ashara-
  • Guest

Posted 10 February 2004 - 07:19 PM

Rastor, Kismet - thank you so much for detailed answers!

@Gabrielle - yeah, I figured that I might not be the only one puzzling over it :lol:

OK, we are still not in the clear on the Morning Afters. I'll see if I can ask one of the gurus to allow to have their LT dissected and analysed :)

#17 dorotea

dorotea

    witch extraordinaire

  • Modder
  • 1927 posts

Posted 11 February 2004 - 06:20 AM

Sorry if my answer was not detailed enough to earn the thanks as well. ;) But you can always email or message me with specific question as you well know.

Freedom cannot be equated with goodness, virtue, or perfection. Freedom has its own unique self-contained nature; freedom is freedom ? not universal goodness. Any confusion or deliberate equalization of freedom with goodness and excellence is in itself negation of freedom, and acceptance of the path of restraint and enforcement.

Nikolai Berdyaev - Christian Existentialist, Philosopher of Freedom.


The Longer Road mod
Redemption mod
Bitter Grey Ashes


#18 -Ashara-

-Ashara-
  • Guest

Posted 11 February 2004 - 06:48 AM

I simply put thanks separately for the first section of the questions and for the second one. And I am really greatful to you for the explanation on the setting up of the RomanceMatch issue and the treatment of the non-sequential dialogues in particular -_-

#19 Sillara

Sillara

    He made me love him without looking at me.

  • Member
  • 537 posts

Posted 11 February 2004 - 02:40 PM

Hurrah! This is the best, most useful thread I have read in ages!!!! I love this thread! :wub: Thank you, all of you Romance Gurus.

Sillara, the eternally grateful
Check out my RPG forum!

#20 dorotea

dorotea

    witch extraordinaire

  • Modder
  • 1927 posts

Posted 11 February 2004 - 09:24 PM

Hi Sillara,

I corrected your file and send it to you today.

By the way - as I suspected there is no need to start your file names with

J#, JK# or any other prefixes.

Quoting Ghreyfain:

I'll name mine
J#Vondo.d. The first line of code we should right is "BEGIN J#Vondo", which means
that at the time of compilation, it will create a file called *J#Vondo.dlg.

* Note that you don't need to use the prefix "J#", this is just a naming convention
I use for all my files to keep them from overwriting other people's custom files.


Freedom cannot be equated with goodness, virtue, or perfection. Freedom has its own unique self-contained nature; freedom is freedom ? not universal goodness. Any confusion or deliberate equalization of freedom with goodness and excellence is in itself negation of freedom, and acceptance of the path of restraint and enforcement.

Nikolai Berdyaev - Christian Existentialist, Philosopher of Freedom.


The Longer Road mod
Redemption mod
Bitter Grey Ashes