Author Topic: PDialog  (Read 11300 times)

0 Members and 1 Guest are viewing this topic.

Offline Red Carnelian

  • Global Moderator
  • Level 1
  • *****
  • Posts: 357
  • Karma: +5/-0
  • Gender: Male
    • View Profile
    • The Stone of Askavar
PDialog
« on: January 13, 2008, 12:10:54 PM »
Working on the TUTU version of DS I noticed that all the PDialog of the new creatures are broken.
I've been trying to fix this but I keep getting odd results. So far CuChoineachs PDialog looks like this

BEGIN ~CUCHOINP~

IF WEIGHT #3 ~Global("KickedOut","LOCALS",1)~ THEN BEGIN 0
  SAY @0
  IF ~~ THEN REPLY @1 GOTO 1
  IF ~~ THEN REPLY @2 GOTO 2
END

IF ~~ THEN BEGIN 1
  SAY @3
  IF ~~ THEN DO ~JoinParty()
SetGlobal("CuChoinneachLeaves","GLOBAL",0)
SetGlobal("KickedOut","LOCALS",0)
~ EXIT
END

IF ~~ THEN BEGIN 2
  SAY @4
  IF ~~ THEN EXIT
END

IF WEIGHT #0 ~SetGlobal("KickedOut","LOCALS",0)~ THEN BEGIN 3
  SAY @4
  IF ~~ THEN DO ~SetGlobal("CuChoinneachLeaves","GLOBAL",0)
SetGlobal("KickedOut","LOCALS",1)~ EXIT
END

IF WEIGHT #1 ~false()~ THEN BEGIN 4
  SAY @5
  IF ~~ THEN EXIT
END

IF WEIGHT #2 ~StateCheck(Myself,STATE_CHARMED)~ THEN BEGIN 5
  SAY @6
  IF ~~ THEN EXIT
END

TRA file entries are:

@0  = ~So you've come back, have you? Perhaps we should join forces once again. There is much work left to be done.~
@1  = ~That is an excellent idea. Your sage advice and company have been missed.~
@2  = ~I have other plans for the moment. Perhaps another time.~
@3  = ~A wise move. Together we can't possibly fail.~
@4  = ~You've been good to me, friends. Bust some heads, will you?~
@5  = ~Fine, I'll be leaving the likes of you, then.~
@6  = ~I'll tell ya a litle secret. Darkside of the Sword Coast rules over all! Now quite the mind games and start playing the game.~

Now this seems simple to me but its not working. Whenever I remove CuCh from the party I get the right dialog but when I ask him to join again I get the same dialog. It seems stuck at weight 0 when it shouldn't be. Anyone know whats wrong?
Little is known of Nirel, a powerful cleric who could resist the spells of his enemies. However, history does record that he was a vile zealot whose hatred for followers of other faiths knew almost no bounds. It is said that he kept the heads of his victims as trophies and was personally responsible for defiling over one hundred temples of other faiths. In the centuries since, his mace has appeared in the hands of evil clerics across the Realms.

Offline Raven

  • Miriam's sane half
  • Administrator
  • Level 5
  • *****
  • Posts: 3603
  • Karma: +118/-33
  • Gender: Female
  • Like Awesome!
    • View Profile
    • Vampire Tales
Re: PDialog
« Reply #1 on: January 13, 2008, 02:46:19 PM »
Probably something to do with the one that has the false statement. The game engine will read that and stop at that because its false. That P dialog will have to be rewritten. Look at examples from the BG1 npc project. 
Per me si va nella citta dolente.
Per me si va nell eterno dolore.
Per me si va tra la perduta gente...
Lasciate ogni speranza perduta che'entrate!

Offline cmorgan

  • Newbie
  • *
  • Posts: 40
  • Karma: +4/-7
    • View Profile
Re: PDialog
« Reply #2 on: February 05, 2008, 12:49:29 PM »
I don't know if you have solved this, but there are a couple of ways - and sometimes it is just easier to let WeiDU do all that WEIGHT stuff rather than manually coding in states. Just use state labels instead of numbers, and when you COMPILE WeiDU will do all the work for you. You can experiment with different orders, then decompile the dialog, and see what it does :)

You could try:

COMPILE ~myMod/dlg/CUCHOINP.D
Code: [Select]
BEGIN ~CUCHOINP~

APPEND ~CUCHOINP~

/* Single Condition Dialogues */

IF ~StateCheck(Myself,STATE_CHARMED)~ THEN BEGIN CUCcharmed
  SAY @6 /* ~I'll tell ya a litle secret. Darkside of the Sword Coast rules over all! Now quite the mind games and start playing the game.~ */
  IF ~~ THEN EXIT
END
END

IF ~Global("KickedOut","LOCALS",1)~ THEN BEGIN CUStart
  SAY @0  /* ~So you've come back, have you? Perhaps we should join forces once again. There is much work left to be done.~ */
  IF ~~ THEN REPLY @ 1 GOTO CUJoin /* ~That is an excellent idea. Your sage advice and company have been missed.~ */
  IF ~~ THEN REPLY @2 GOTO CUrefuse /* ~I have other plans for the moment. Perhaps another time.~ */
END


/* Only fires when called from other states */

IF ~~ CUJoin
SAY @3  /* ~A wise move. Together we can't possibly fail.~ */
IF ~~ THEN DO ~JoinParty() SetGlobal("CuChoinneachLeaves","GLOBAL",0) SetGlobal("KickedOut","LOCALS",0)~ EXIT
END

IF ~~ CUrefuse
SAY @4 /* ~You've been good to me, friends. Bust some heads, will you?~ */
IF ~~ THEN EXIT
END


/* False() means it won't fire unless you call directly to it. So you could leave it in, unweighted, so it drops to the bottom. */

IF WEIGHT #1 ~false()~ THEN BEGIN CUExtraState
  SAY @5 /* ~Fine, I'll be leaving the likes of you, then.~ */
  IF ~~ THEN EXIT
END

END

See what happens on the decompile. Then, you can always move the "conditional" states around until you get them in the right order, without messing with WEIGHT.