Jump to content


Photo

Wanna do it the easy way, but...


  • Please log in to reply
48 replies to this topic

#41 Deathsangel

Deathsangel

    Living on Wings of Dreams

  • Modder
  • 3089 posts

Posted 14 July 2007 - 03:27 AM

Yes, well I just recreated the file. Guess I have to start with other files and recreate parts of them, as I just can't add interjections later... pitty.

Kulyok, Berlinde, and Cmorgan thanks for the help

P.s. I give in I never searched for a tutorial on this, as I thought I had it by now... I tend to chaining here and there, but apparently I never understood its true power.

Still modding the Mod for the Wicked... It is a big project you know... And I got sidetracked (several times) a bit... sorry.
However, as we all know, Evil never really sleeps.


Sentences marking (my) life:

Winds of change... Endure them, and in Enduring grow Stronger
It takes a fool to look for logic in a man's heart
Never question the sanity of the insane
The Harmony of Life is Chaos
Living on Wings of Dreams



(1st march 2009) SHS women over me:
Kat: if there were more guys that looked like you out here, people's offspring wouldnt be so damn ugly
Noctalys: you are adorable :P

~~ I love it, and I am humbled! Yay! ~~


#42 Kulyok

Kulyok
  • Modder
  • 2450 posts

Posted 14 July 2007 - 03:37 AM

Weidu Readme has at least half of the tutorials you need.
(edit: though, yes, it only has the basics, but perhaps someone else will stumble upon this thread later and find this link useful)

Edited by Kulyok, 14 July 2007 - 03:39 AM.


#43 cmorgan

cmorgan
  • Modder
  • 2301 posts

Posted 14 July 2007 - 06:15 AM

Adding additional lines and responses does not take any more work under CHAIN han it does under traditional coding, so you are fine there - sometimes it is even easier, as you can add multiple entrance points without having to go see who is adding in (they are all right there).

Still not sure on something hat berelinde and Kulyok can probably help clear up -


On CHAIN, I have found (and written) code with the following:

CHAIN
~reply~
== NPC1 IF ~validFordialogue~ THEN ~reply~
== NPC2 IF ~validFordialogue~ THEN ~reply~
== NPC3 IF ~validFordialogue~ THEN ~reply~
== NPC2 IF ~validFordialogue~ THEN ~reply~
== OriginalNPC
== NPC2 IF ~validFordialogue~ THEN ~reply~
END
++
++

and I *think* it has not failed on removing the NPCs; if no characters are present, the the following should play -

CHAIN
~reply~
== OriginalNPC
END
++
++

I know in some cases the condition for triggering the banter has inclused NPC2...

It sounded like you were saying it needed to have the original speaker talk directly before the PC replies - am I misremembering, or do we need to retest this?

#44 Deathsangel

Deathsangel

    Living on Wings of Dreams

  • Modder
  • 3089 posts

Posted 14 July 2007 - 06:47 AM

That is what Kulyok says indeed, that the orignal speaker has to end the chain.

I would be useful to know if it could be done with a none original NPC (the one that started the stuff) can end a chain

Still modding the Mod for the Wicked... It is a big project you know... And I got sidetracked (several times) a bit... sorry.
However, as we all know, Evil never really sleeps.


Sentences marking (my) life:

Winds of change... Endure them, and in Enduring grow Stronger
It takes a fool to look for logic in a man's heart
Never question the sanity of the insane
The Harmony of Life is Chaos
Living on Wings of Dreams



(1st march 2009) SHS women over me:
Kat: if there were more guys that looked like you out here, people's offspring wouldnt be so damn ugly
Noctalys: you are adorable :P

~~ I love it, and I am humbled! Yay! ~~


#45 Kulyok

Kulyok
  • Modder
  • 2450 posts

Posted 14 July 2007 - 07:05 AM

Okay, give me a moment, I'll retest this...

Sheri: without Yoshi in Party, it works okay, with Yoshi in party, it works okay, the last line is Yoshi's; replies are seen. Bingo! It does work.

#46 jcompton

jcompton
  • Modder
  • 492 posts

Posted 14 July 2007 - 07:43 AM

The confusion here may have been that if you are unsure which character will display the last line in a conditional chain, you must not use GOTO in the chain's transition block. (Use EXTERN instead, which I believe you have been in these examples. I'm just saying.) When you use GOTO, you might be inside NPC1 or NPC2 at the time the GOTO is evaluated, which of course would lead to different places.

(Not that anybody asked, but WeiNGINE really does have a "you must end a chain on line which always plays" rule. It's one of the few places it's more constrained than WeiDU/Infinity for dialogue.)

#47 cmorgan

cmorgan
  • Modder
  • 2301 posts

Posted 14 July 2007 - 07:54 AM

Cool - I think the safest bet for IE parsing is to suggest that instaed of using GOTO or other materials, exclusvely use EXTERN - after all, it makes sense. What you are really doing is patching in an independent set of states, calling on a bunch of separate dialogue files - WeiDU will turn them all into GOTOs in their respective files.

I just think of CHAIN as an infinitely extendable all in one "patch" of several coexisting dialogue states (after The Grim Squeaker kindly and patiently and very very slowly led me through it multiple times...)

As for the "restriction" of WeiNGINE, I don't find that a restriction, I think that is really good and safe coding practice. Actually, I like Kulyok's more conservative use in the first place - it makes sense to me that most banters between PC and NPC should end between the two. You can always add conditions that trigger a second NPC only banter, or EXTERN during a reply stae if certain NPCs are present. I think it encourages tighter dialogue and tighter coding (my submissions improved when Kulyok tightened some of the states and statelinks. Sometimes, too many words is just too many words - less is usually more in the first place! :) )

I *know* I have posted this before somewhere, but let me throw a customizab;e template for CHAIN on BG2 up here. It might save someone some hassle.

Be right back...

for quick copy/paste/reference

[tp2 code line added: EXTEND_BOTTOM ~MyNPC.bcs~ ~myNPC.baf~]
[contents of file myNPC.baf:]
IF
Global("GLOBAL_PLACEHOLDER","GLOBAL",0)
InParty(Myself)
// remaining conditons for banter
// including at least one participant ok
THEN 
RESPONSE #100
SetGlobal("GLOBAL_PLACEHOLDER","GLOBAL",1)
END

IF
Global("GLOBAL_PLACEHOLDER","GLOBAL",1)
InParty(Myself)
InMyArea(Player1)
!StateCheck(Player1,CD_STATE_NOTVALID)
!StateCheck(Myself,CD_STATE_NOTVALID)
CombatCounter(0)
!See([ENEMY])
THEN 
RESPONSE #100
Interact(Player1)
END
[/myNPC.baf]

[tp2 code added: COMPILE (//or COMPILE EVALUATE_BUFFER if you are using variables) myNPC.d ]
[contents of file myNPC.d:]
/* Banter 1 */

CHAIN IF WEIGHT#-1 ~Global("GLOBAL_PLACEHOLDER","GLOBAL",1)~  THEN BEGIN ~BVALYGA~ BeginFirstBanterState
~ XXXXX SPOKEN XXXX ~  DO ~Global("GLOBAL_PLACEHOLDER","GLOBAL",2)~  //first statement by myNPC
= ~ ( XXXX action/descriptor XXXX ) ~ //multisay - same person speaks aain

== ~BAERIE~ IF ~InParty("Aerie") InMyArea("Aerie") !StateCheck("Aerie",CD_STATE_NOTVALID)~ THEN ~ XXXX SPOKEN XXXX ( XXXX ACTION XXXX ) ~ //add in options, if you need to set a global only if the state runs, you can even EXTERN:  DO ~ XXXX SET SPECIAL GLOBAL XXXX ~ <<EXTERN AnotherDialogueFile>>

== ~BANOMEN~ IF ~InParty("Anomen") InMyArea("Anomen") !StateCheck("Anomen",CD_STATE_NOTVALID)~ THEN ~ XXXX SPOKEN XXXX ( XXXX ACTION XXXX ) ~  //optional:  DO ~ XXXX SET SPECIAL GLOBAL XXXX ~ // optional branching <<EXTERN AnotherDialogueFile>>

== ~BCERND~ IF ~InParty("Cernd") InMyArea("Cernd") !StateCheck("Cernd",CD_STATE_NOTVALID)~ THEN ~ XXXX SPOKEN XXXX ( XXXX ACTION XXXX ) ~  //optional:  DO ~ XXXX SET SPECIAL GLOBAL XXXX ~ // optional branching <<EXTERN AnotherDialogueFile>>

== ~BEDWIN~ IF ~InParty("Edwin") InMyArea("Edwin") !StateCheck("Edwin",CD_STATE_NOTVALID)~ THEN ~ XXXX SPOKEN XXXX ( XXXX ACTION XXXX ) ~  //optional:  DO ~ XXXX SET SPECIAL GLOBAL XXXX ~ // optional branching <<EXTERN AnotherDialogueFile>>

== ~BHAERDA~ IF ~InParty("HaerDalis") InMyArea("HaerDalis") !StateCheck("HaerDalis",CD_STATE_NOTVALID)~ THEN ~ XXXX SPOKEN XXXX ( XXXX ACTION XXXX ) ~  //optional:  DO ~ XXXX SET SPECIAL GLOBAL XXXX ~ // optional branching <<EXTERN AnotherDialogueFile>>


== ~BJAHEIR~ IF ~InParty("Jaheira") InMyArea("Jaheira") !StateCheck("Jaheira",CD_STATE_NOTVALID)~ THEN ~ XXXX SPOKEN XXXX ( XXXX ACTION XXXX ) ~  //optional:  DO ~ XXXX SET SPECIAL GLOBAL XXXX ~ // optional branching <<EXTERN AnotherDialogueFile>>

== ~BJAN~ IF ~InParty("Jan") InMyArea("Jan") !StateCheck("Jan",CD_STATE_NOTVALID)~ THEN ~ XXXX SPOKEN XXXX ( XXXX ACTION XXXX ) ~  //optional:  DO ~ XXXX SET SPECIAL GLOBAL XXXX ~ // optional branching <<EXTERN AnotherDialogueFile>>

== ~BKELDOR~ IF ~InParty("Keldorn") InMyArea("Keldorn") !StateCheck("Keldorn",CD_STATE_NOTVALID)~ THEN ~ XXXX SPOKEN XXXX ( XXXX ACTION XXXX ) ~  //optional:  DO ~ XXXX SET SPECIAL GLOBAL XXXX ~ // optional branching <<EXTERN AnotherDialogueFile>>


== ~BKORGAN~ IF ~InParty("Korgan") InMyArea("Korgan") !StateCheck("Korgan",CD_STATE_NOTVALID)~ THEN ~ XXXX SPOKEN XXXX ( XXXX ACTION XXXX ) ~ //optional:  DO ~ XXXX SET SPECIAL GLOBAL XXXX ~ // optional branching <<EXTERN AnotherDialogueFile>>

== ~BMAZZY~ IF ~InParty("Mazzy") InMyArea("Mazzy") !StateCheck("Mazzy",CD_STATE_NOTVALID)~ THEN ~ XXXX SPOKEN XXXX ( XXXX ACTION XXXX ) ~ //optional:  DO ~ XXXX SET SPECIAL GLOBAL XXXX ~ // optional branching <<EXTERN AnotherDialogueFile>>

== ~BMINSC~ IF ~InParty("Minsc") InMyArea("Minsc") !StateCheck("Minsc",CD_STATE_NOTVALID)~ THEN ~ XXXX SPOKEN XXXX ( XXXX ACTION XXXX ) ~ //optional:  DO ~ XXXX SET SPECIAL GLOBAL XXXX ~ // optional branching <<EXTERN AnotherDialogueFile>>

== ~BNALIA~ IF ~InParty("Nalia") InMyArea("Nalia") !StateCheck("Nalia",CD_STATE_NOTVALID)~ THEN ~ XXXX SPOKEN XXXX ( XXXX ACTION XXXX ) ~ //optional:  DO ~ XXXX SET SPECIAL GLOBAL XXXX ~ // optional branching <<EXTERN AnotherDialogueFile>>

== ~BVALYGA~ IF ~InParty("Valygar") InMyArea("Valygar") !StateCheck("Valygar",CD_STATE_NOTVALID)~ THEN ~ XXXX SPOKEN XXXX ( XXXX ACTION XXXX ) ~ //optional:  DO ~ XXXX SET SPECIAL GLOBAL XXXX ~ // optional branching <<EXTERN AnotherDialogueFile>>

== ~BVICONI~ IF ~InParty("Viconia") InMyArea("Viconia") !StateCheck("Viconia",CD_STATE_NOTVALID)~ THEN ~ XXXX SPOKEN XXXX ( XXXX ACTION XXXX ) ~ //optional:  DO ~ XXXX SET SPECIAL GLOBAL XXXX ~ // optional branching <<EXTERN AnotherDialogueFile>>

== ~BYOSHIM~ IF ~InParty("Yoshimo") InMyArea("Yoshimo") !StateCheck("Yoshimo",CD_STATE_NOTVALID)~ THEN ~ XXXX SPOKEN XXXX ( XXXX ACTION XXXX ) ~ //optional:  DO ~ XXXX SET SPECIAL GLOBAL XXXX ~ // optional branching <<EXTERN AnotherDialogueFile>>

== ~BIMOEN2~ IF ~InParty("Imoen2") InMyArea("Imoen2") !StateCheck("Imoen2",CD_STATE_NOTVALID)~ THEN ~ XXXX SPOKEN XXXX ( XXXX ACTION XXXX ) ~ //optional:  DO ~ XXXX SET SPECIAL GLOBAL XXXX ~ // optional branching <<EXTERN AnotherDialogueFile>>

END
++ ~ XXXX player response XXXX ~ EXTERN ~BVALYGA~ FirstBanterOne
+ ~ <<CONDITION_PLACEHOLDER>> ~ + ~ XXXX conditional player response XXXX ~ DO ~Optional Actions Inserted Here~ EXTERN ~BVALYGA~ FirstBanterConditional

/* Sample Usages */
+ ~Class(Player1,RANGER_ALL) Gender(Player1,MALE)~ + ~ XXXX SPOKEN XXXX ( XXXX ACTION XXXX ) ~ EXTERN ~BANTERFILE~ <<NEW_STATE_PLACEHOLDER>>

+ ~Class(Player1,RANGER_ALL) Gender(Player1,FEMALE)~ + ~ XXXX SPOKEN XXXX ( XXXX ACTION XXXX ) ~ EXTERN ~BANTERFILE~ <<NEW_STATE_PLACEHOLDER>>

+ ~Race(Player1,ELF) Gender(Player1,MALE)~ + ~ XXXX SPOKEN XXXX ( XXXX ACTION XXXX ) ~ EXTERN ~BANTERFILE~ <<NEW_STATE_PLACEHOLDER>>

+ ~Race(Player1,ELF) Gender(Player1,FEMALE)~ + ~ XXXX SPOKEN XXXX ( XXXX ACTION XXXX ) ~ EXTERN ~BANTERFILE~ <<NEW_STATE_PLACEHOLDER>>

+ ~Alignment(Player1,MASK_EVIL) Gender(Player1,MALE)~ + ~ XXXX SPOKEN XXXX ( XXXX ACTION XXXX ) ~ EXTERN ~BANTERFILE~ <<NEW_STATE_PLACEHOLDER>>

+ ~Alignment(Player1,MASK_EVIL) Gender(Player1,FEMALE)~ + ~ XXXX SPOKEN XXXX ( XXXX ACTION XXXX ) ~ EXTERN ~BANTERFILE~ <<NEW_STATE_PLACEHOLDER>>

+ ~Alignment(Player1,MASK_NEUTRAL) Gender(Player1,MALE)~ + ~ XXXX SPOKEN XXXX ( XXXX ACTION XXXX ) ~ EXTERN ~BANTERFILE~ <<NEW_STATE_PLACEHOLDER>>

+ ~Alignment(Player1,MASK_NEUTRAL) Gender(Player1,FEMALE)~ + ~ XXXX SPOKEN XXXX ( XXXX ACTION XXXX ) ~ EXTERN ~BANTERFILE~ <<NEW_STATE_PLACEHOLDER>>

+ ~Alignment(Player1,MASK_GOOD) Gender(Player1,MALE)~ + ~ XXXX SPOKEN XXXX ( XXXX ACTION XXXX ) ~ EXTERN ~BANTERFILE~ <<NEW_STATE_PLACEHOLDER>>

+ ~Alignment(Player1,MASK_GOOD) Gender(Player1,FEMALE)~ + ~ XXXX SPOKEN XXXX ( XXXX ACTION XXXX ) ~ EXTERN ~BANTERFILE~ <<NEW_STATE_PLACEHOLDER>>

++ ~ XXXX SPOKEN XXXX ( XXXX ACTION XXXX ) ~ EXTERN ~BANTERFILE~ <<NEW_STATE_PLACEHOLDER>>


/* At the Bottom of the reply states, if you want an immediate "hijack" to another state, just add this line (bottom state will be evaluated first */
IF ~ <<CONDITION>> ~ THEN EXTERN ~BANTERFILE~ <<NEW_STATE_PLACEHOLDER>>


/* Any and all Reply States can replace the EXTERN with END to exit the dialogue state chain... ending the sequence. */
[/myNPC.D]


I'll be back with the JFile variant. Probably need to post this somewhere permanent instead of copying/pasting; I'll come up with a setup that gives templates to go alongside berelinde's Comprehensive Tutuorials.

What we really need to do is get a cross-community comprehensive rebuild of the WeiDU documentation for the bigg, to distribute with WeiDU, that leaves the current technically oriented docs in place but gives a "WeiDU for Dummies" variant following berelinde's really simple step by step breakdowns, while giving some advancd usage materials form the WeiDU Gurus.

Edited by cmorgan, 14 July 2007 - 08:27 AM.


#48 jcompton

jcompton
  • Modder
  • 492 posts

Posted 14 July 2007 - 08:36 AM

WeiDU will turn them all into GOTOs in their respective files.


While the result is the same (mechanically, there is no difference between "GOTO statelabel" and "EXTERN SAMEDLG statelabel") this is not, strictly speaking, true--EXTERN is always EXTERN and GOTO is always GOTO.

As for the "restriction" of WeiNGINE, I don't find that a restriction, I think that is really good and safe coding practice.


Well, it really is a restriction, although as you point out there are ways to work around it (long-form conditional branch at the end, etc.) if you really want an optional line at the end of the on-screen text. It was a tradeoff for some other improved capabilities--specifically, that a state can have zero "say" lines, which is more useful than you might think.

#49 Deathsangel

Deathsangel

    Living on Wings of Dreams

  • Modder
  • 3089 posts

Posted 14 July 2007 - 09:16 AM

Okay, now I have just have gotten the feeling I've been bounced back to the nOOb couch, as I am unsure if I get the discussion.

May I try to put it in different words and that I be corrected if it is wrong (preferrable Jcompton as he is probably the most knowledgable on this ;))

It is is possible to end with another NPC responding (hence forward named NPC2), instead the one that initiated the dialogue (henced forward NPC1), the two restrictions are:

I) You must use of EXTERN and not GOTO, if this is done
II) It must be certain that the line does play of NPC2! So, if NPC2 is to react it must be sure that before the dialogue starts this NPC2 is ready to response, by i.e. putting these conditions in the script file of NPC1 that calls up the start of this dialogue.

About point II; If so how does it that Kulyok does get it to run without Yoshimo in the party. For that means the last line doesn't run (and this is why I am getting confused)
[edit]
or is this only a restriction associated with the WeiNIGINE of the Broken hour glass
(I accedently hit on the name of the engine of the Broken Hour glass site while browsing it (looks better and better by the way (especially drooling over the tinker spell functions - I ought to watch more often than every now and so, when the link pops into my eyes))
[/edit]
Beside the technological discussion, the general practice is to let the initiator of the dialogues end the conversation.

P.s. I do understand Cmorgan's code ;)
P.p.s. Sorry for the fuzz and thanks for the answers

Edited by Deathsangel, 14 July 2007 - 09:30 AM.

Still modding the Mod for the Wicked... It is a big project you know... And I got sidetracked (several times) a bit... sorry.
However, as we all know, Evil never really sleeps.


Sentences marking (my) life:

Winds of change... Endure them, and in Enduring grow Stronger
It takes a fool to look for logic in a man's heart
Never question the sanity of the insane
The Harmony of Life is Chaos
Living on Wings of Dreams



(1st march 2009) SHS women over me:
Kat: if there were more guys that looked like you out here, people's offspring wouldnt be so damn ugly
Noctalys: you are adorable :P

~~ I love it, and I am humbled! Yay! ~~