Author Topic: Dialog, CHAIN, INTERJECT and so ?...  (Read 2789 times)

Offline Baldurien

  • Planewalker
  • *****
  • Posts: 28
Dialog, CHAIN, INTERJECT and so ?...
« on: July 22, 2004, 07:23:11 PM »
Hello,

I'm tring to make a good solution for multiplayer character that you can't kick from your group without losing them, for the moment I'm trying to make the rejoin dialog (I've made the quit dialog) and then, I added certain option :
1. The Character is in a cold place
2. The Character is getting more and more drunk
3. The Character is a thief...
4. The Character is a Sexual Perverse (you see so... ) and then He want <CHARNAME> to show up some *special* Bhaal Abilities.

For the 1, 2 and 3 It's done.

But for the 4 I'm blocked : in fact I would like that NPC like Viconia refuse the proposition of the kicked character if the romance

I know I have to use either INTERJECT either CHAIN but since: I really don't understand how they work and moreover where I should use them :x

Code: [Select]
IF ~
Global( "NpcHaveSex", "LOCALS", 0)
Global( "Waiting", "LOCALS", 1 )
!InParty(MySelf)
RandomNum(9,3)
Global( "NodeGroup", "LOCALS", 0 )
!Class(MySelf, PALADIN )
!Class(MySelf, CLERIC_ALL )
AreaCheck("AR0406")~
THEN BEGIN randomdialogue4
SAY ~Text~
=
~Text~
IF ~InParty("Viconia")
Global("ViconiaRomanceActive","GLOBAL",2)
Gender(Protagonist,MALE)~
THEN
DO ~SetGlobal( "NodeGroup", "LOCALS", 4 )
SetGlobal( "NodeId", "LOCALS", 1 )~
GOTO randomdialogue4viconia
END
Now then :

1. If I use CHAIN, first how I use it ? I tried to add after the preceding code this one :
Code: [Select]
CHAIN IF ~Global( "NodeGroup", "LOCALS", 4 )
Global( "NodeId", "LOCALS", 1 )~
THEN VICONIJ randomdialogue4viconia
~Tada~
DO ~~
== VICONIJ
~text~
EXIT

What will happen ? The text will be append to viconij and if randomdialogue4viconia is set to 1 I will show it ?

2. Should I use INTERJECT instead ? How ? The examples provided by WeiDu  is more confusing that anyhing else :x


Offline Kismet

  • Devil's Minion #5
  • Global Moderator
  • Planewalker
  • *****
  • Posts: 653
  • Gender: Female
  • Veni; Vidi; Velcro.
    • Pocket Plane Group
Re: Dialog, CHAIN, INTERJECT and so ?...
« Reply #1 on: July 22, 2004, 08:27:52 PM »
I use I_C_T when I have NPCs butt into the conversation, mainly because I don't have to track where the dialog goes after the interjection.

I_C_T YourNPCDialogFile randomdialogue4 ViconiaInterjects
== VICONIJ ~InParty("Viconia") OtherTriggers()~ THEN ~Viconia says something.~ DO ~SetSomeGlobals()~
END

If Viconia isn't in the party or the one of the other triggers isn't true then the conversation should continue normally.
Cailean - An archer NPC for the insatiably nosy!  Guaranteed more fun than shampooing cats!

Offline Baldurien

  • Planewalker
  • *****
  • Posts: 28
Re: Dialog, CHAIN, INTERJECT and so ?...
« Reply #2 on: July 22, 2004, 08:41:45 PM »
I see, pretty simple :) (I hope so:))

[edit] before using it, where should I use it ? That is the "big" thing I didn't undesrtood with CHAIN/INTERJECT.
« Last Edit: July 25, 2004, 03:22:33 PM by Baldurien »

Offline jcompton

  • Niche Exploiter
  • Administrator
  • Planewalker
  • *****
  • Posts: 7244
Re: Dialog, CHAIN, INTERJECT and so ?...
« Reply #3 on: July 25, 2004, 06:59:30 PM »
INTERJECT is a fast way to attach a series of potential NPC reactions/responses to a state of dialogue. While some people use it for creating totally new dialogues, I find that kind of confusing and stick with CHAIN in those cases, simply using INTERJECT when I need to add NPC responses to _existing_ (Bioware) dialogue states.
Cespenar says, "Kelsey and friends be at the Pocket Plane? Ohhh yesssss!" http://www.pocketplane.net

Offline Baldurien

  • Planewalker
  • *****
  • Posts: 28
Re: Dialog, CHAIN, INTERJECT and so ?...
« Reply #4 on: July 26, 2004, 04:15:53 AM »
I finally found my problem : I was using it in the wrong place :) Now I have a problem with label

Here my code (I removed all the unusefull code (comment, text (there are in french so)) :
Code: [Select]
IF ~Some condition~
THEN BEGIN randomdialogue4
SAY ~Some text~
IF ~IsValidForPartyDialogue("Viconia")~ THEN
DO ~SetGlobal( "NodeGroup", "LOCALS", 4 )
SetGlobal( "NodeId", "LOCALS", 1 )
SetGlobal( "MMInterjectionSex", "GLOBAL", 1 )~
EXTERN VICONIJ 0
END

IF ~Global( "NodeGroup", "LOCALS", 4 )
Global( "NodeId", "LOCALS", 1 )~
THEN BEGIN randomdialogue4node1
SAY ~EOF~
END


INTERJECT_COPY_TRANS VICONIJ 0 MMViconiaSex
== VICONIJ
IF ~Global( "MMInterjectionSex", "GLOBAL", 1 )
InParty("Viconia")~
THEN
~~
== EDWINJ
IF ~Global( "MMInterjectionSex", "GLOBAL", 1 )
InParty("Edwin")
Gender(Myself, Female)~
THEN
~~
== KELDORJ
IF ~Global( "MMInterjectionSex", "GLOBAL", 1 )
InParty("Keldorn")
Gender("Edwin", Female)~
THEN
~~
END

The matter here, is that I've got the first node (0) since I go to VICONIJ state 0. I don't know how I could do so that I append to VICONIJ a node of myself (for example MMViconiaSex) via INTERJECT_COPY_TRANS since I will create a node in the state 0.

(I know, these are state not node, but well... I think it about the same in Infiniy Explorer ;))

2. Always in Infinity Explorer, I have the following order :

Code: [Select]
Starting 1
  -> Response
  |   -> VICONIJ state 0
  |   |   -> Response
  |   |   -> Response
  |   |   |   -> VICONIJ state 186 (my new node)
  |   |   |   |   -> Response
  |   |   |   |   -> Response
  |   |   |   |   |   -> KELDORJ state 252 (my new node)
  |   |   |   |   |   |   -> Response
  |   |   |   |   -> Response
  |   |   |   |   |   -> EDWINJ state 213 (my new node)
  |   |   |   |   |   |   -> Response
  |   |   |   |   |   |   -> Response
  |   |   |   |   |   |   |   -> KELDORJ state 252 (my new node)
  |   |   |   |   |   |   |   |   -> Response

I that normal ? eg: why do I have the Keldorn node before the Edwin node ?

Offline Kismet

  • Devil's Minion #5
  • Global Moderator
  • Planewalker
  • *****
  • Posts: 653
  • Gender: Female
  • Veni; Vidi; Velcro.
    • Pocket Plane Group
Re: Dialog, CHAIN, INTERJECT and so ?...
« Reply #5 on: July 26, 2004, 07:52:18 AM »
With Interjects, you don't use EXTERN to get to them.  You write the main dialog as if there are no interjects.

Here my code (I removed all the unusefull code (comment, text (there are in french so)) :
Code:
IF ~Some condition~THEN BEGIN randomdialogue4
SAY ~Some text~
IF ~IsValidForPartyDialogue("Viconia")~ THEN DO ~SetGlobal( "NodeGroup", "LOCALS", 4 ) SetGlobal( "NodeId", "LOCALS", 1 ) SetGlobal( "MMInterjectionSex", "GLOBAL", 1 )~ EXIT
IF ~!IsValdForPartyDialog("Viconia")~ THEN DO ~Something Else~ EXIT
END

IF ~Global( "NodeGroup", "LOCALS", 4 )
Global( "NodeId", "LOCALS", 1 )~
THEN BEGIN randomdialogue4node1
SAY ~EOF~
END


INTERJECT_COPY_TRANS VICONIJ randomedialogue4 MMViconiaSex
== VICONIJ IF ~Global( "MMInterjectionSex", "GLOBAL", 1 ) InParty("Viconia")~ THEN ~~
== EDWINJ IF ~Global( "MMInterjectionSex", "GLOBAL", 1 ) InParty("Edwin") Gender(Myself, Female)~ THEN ~~
== KELDORJ IF ~Global( "MMInterjectionSex", "GLOBAL", 1 ) InParty("Keldorn") Gender("Edwin", Female)~ THEN ~~
END

Cailean - An archer NPC for the insatiably nosy!  Guaranteed more fun than shampooing cats!

Offline Baldurien

  • Planewalker
  • *****
  • Posts: 28
Re: Dialog, CHAIN, INTERJECT and so ?...
« Reply #6 on: July 26, 2004, 08:06:04 AM »
Hum I tried and I get that error :
Code: [Select]
ERROR: Cannot resolve internal symbolic label [randomdialogue4] for DLG [VICONIJ
]
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 2
5 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 101 102 103
104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123
124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143
144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163
164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183
184 185
ERROR: Cannot process COPY_TRANS
ERROR: problem processing D files: Failure("cannot resolve label")

(I WILL understand INTERJECT corretly one day, I know ! ;D )

Offline Kismet

  • Devil's Minion #5
  • Global Moderator
  • Planewalker
  • *****
  • Posts: 653
  • Gender: Female
  • Veni; Vidi; Velcro.
    • Pocket Plane Group
Re: Dialog, CHAIN, INTERJECT and so ?...
« Reply #7 on: July 26, 2004, 08:12:46 AM »
Err, oops.  You actually wouldn't use I_C_T Viconij but rather I_C_T YourNPCDialogFile.  Sorry about that.
Cailean - An archer NPC for the insatiably nosy!  Guaranteed more fun than shampooing cats!

Offline Baldurien

  • Planewalker
  • *****
  • Posts: 28
Re: Dialog, CHAIN, INTERJECT and so ?...
« Reply #8 on: July 26, 2004, 09:27:58 AM »
(like Dr. Frankeinstein when his monster come to life)

IT WORKED !

Well, finally I'm pretty happy of the result :)

Hum, should I use VICONIJ or BVICONI ?

and for the second problem about Keldorn and it interject that shouldn't be there (in my mind) ? Is this normal ?

Offline Kismet

  • Devil's Minion #5
  • Global Moderator
  • Planewalker
  • *****
  • Posts: 653
  • Gender: Female
  • Veni; Vidi; Velcro.
    • Pocket Plane Group
Re: Dialog, CHAIN, INTERJECT and so ?...
« Reply #9 on: July 26, 2004, 10:27:46 AM »

Hum, should I use VICONIJ or BVICONI ?

The J files are normally used for interjections.

Quote
and for the second problem about Keldorn and it interject that shouldn't be there (in my mind) ? Is this normal ?

I don't understand what you're saying here.  What's Keldorn doing that he shouldn't do (or not doing what he should do?)
Cailean - An archer NPC for the insatiably nosy!  Guaranteed more fun than shampooing cats!

Offline Baldurien

  • Planewalker
  • *****
  • Posts: 28
Re: Dialog, CHAIN, INTERJECT and so ?...
« Reply #10 on: July 26, 2004, 11:08:56 AM »
The second problem is about the tree WeiDu make when wiewing it with Infinity Explorer :

(http://www.system-tek.com/nwinter/nwn/images/dialognode.png)

Below the D code used :
Code: [Select]
BEGIN ~MULTIJ~
IF ~Global( "Waiting", "LOCALS", 1 )
!InParty(Myself)
Global( "NodeGroup", "LOCALS", 0 )~
THEN BEGIN randomdialogue4
SAY ~STARTING 1~
IF ~IsValidForPartyDialogue("Viconia")~ THEN
DO ~SetGlobal( "NodeGroup", "LOCALS", 4 )
SetGlobal( "NodeId", "LOCALS", 1 )~
GOTO randomdialogue4node1
END

IF ~Global( "NodeGroup", "LOCALS", 4 )
Global( "NodeId", "LOCALS", 1 )~
THEN BEGIN randomdialogue4node1
SAY ~EOF~
IF ~~ THEN
DO ~SetGlobal( "NodeGroup", "LOCALS", 0 )
SetGlobal( "NodeId", "LOCALS", 0 )~
EXIT

END
INTERJECT_COPY_TRANS MULTIJ randomdialogue4 MMViconiaSex
== VICONIJ
IF ~InParty("Viconia")~
THEN
~A ce que je vois, même les chiens de la surface se laissent faire par certaines femelles...~
== EDWINJ
IF ~InParty("Edwin")
Gender(Myself, Female)~
THEN
~Non, non ... ce n'est pas la même chose. Ici elle vend son corps (qui ne vaut rien comparé à mon nouveau corps de femme!)~
== KELDORJ
IF ~InParty("Keldorn")
InParty("Edwin")
Gender("Edwin", Female)~
THEN
~A ce propos, Edwin, cette féminité vous va à ravir... Il faudra songer à vous raser le crâne pour être parée à la mode de Thay, mon épée pourra y faire si vous le voulez!~
== EDWINJ
IF ~InParty("Edwin")
Gender( "Edwin", Male )~
THEN
~Ce n'est pas ça, <CHARNAME> est juste un proxénète qui en profite.~
END

I wish to know if it is normal to have two nodes with Keldorn (both of them are in green) and if it is normal, how could I avoid that ? (or is it necessary to avoid it?)

Offline jcompton

  • Niche Exploiter
  • Administrator
  • Planewalker
  • *****
  • Posts: 7244
Re: Dialog, CHAIN, INTERJECT and so ?...
« Reply #11 on: July 26, 2004, 11:30:33 AM »
It's a consequence of how INTERJECT/conditional CHAIN exploits the way the Infinity Engine evaluates transition triggers: from the bottom up.

It looks a little ugly when you browse it, but it works out fine.
Cespenar says, "Kelsey and friends be at the Pocket Plane? Ohhh yesssss!" http://www.pocketplane.net

Offline Baldurien

  • Planewalker
  • *****
  • Posts: 28
Re: Dialog, CHAIN, INTERJECT and so ?...
« Reply #12 on: July 26, 2004, 12:02:03 PM »
Ok :) if it's normal, that work for me;)

Hum, bitwise, if I use APPEND / EXTERN, could I do a proper thing ? (ie: removing the first Keldorn node)

 

With Quick-Reply you can write a post when viewing a topic without loading a new page. You can still use bulletin board code and smileys as you would in a normal post.

Warning: this topic has not been posted in for at least 120 days.
Unless you're sure you want to reply, please consider starting a new topic.

Name: Email:
Verification:
Type the letters shown in the picture
Listen to the letters / Request another image
Type the letters shown in the picture:
What color is grass?:
What is the seventh word in this sentence?:
What is five minus two (use the full word)?: