Jump to content

Series of IFs after PC dialogue choices?


Lauriel

Recommended Posts

Posted

I've tried, and failed, to have a series of IFs after the PC says something in a dialogue.  The best I've come up with is forcing the game into a pseudo cut-scene to do the IF/THEN logic, which I sort of hate.  And it doesn't look as good as when done in a dialogue.  Here's what I want:

::Imoen gives her equipment to the group before leaving to train with Duke (Duchess?) Jannath.
++ Wait Imoen!  Take a share of the gold (or something like that)
IF ~~ Imoen takes mininum amount
IF ~PartyGoldGT(some amount)~ Imoen takes so much
... more ifs...

That way, the verbiage saying 'You've lost so much gold' is in the dialogue.  The way it happens now, I do it in a cut scene and the loss of the gold shows up in the normal game log, not highlighted in the dialogue screen.

Once again, I'm asking if it's simply not possible to do something or have I missed some clever (or obvious) trick.

Posted

I am sorry, but I do not get what the actual problem is. Does it not work if not in a cutscene or is it only the "party lost x gold" that shouldn't show during the dialogue?

For the latter, you could try moving the loss of gold to the very end of the whole dialogue, then it should show after the dialogue is done.

Posted
4 minutes ago, jastey said:

..

For the latter, you could try moving the loss of gold to the very end of the whole dialogue, then it should show after the dialogue is done.

Could you show the intended solution in code, as it's tricky some of the times. The ENDs and EXITs & all that... my bet is that Lauriel just doesn't have a good example.

Posted (edited)

It doesn't work at all if I try the way I described in my OP.  It simply won't compile.  I want the 'party loses gold' to show up in the dialogue right after the player hits 'Wait Imoen...here's your share.'  Even if it showed up immediately before, I'd be ok, with it...not happy, but ok.

Here's what I have now:

Spoiler

APPEND IMOEN2
	IF ~GlobalGT("#L_TalkedToDukes","GLOBAL",1) Global("#L_ImTrainRsp","MYAREA",1)~ THEN BEGIN IMOEN_LIIA_1
		SAY @2103 /* ~You will come visit, <CHARNAME>!  Promise!~ */
		= @2104 /* ~Oh!  Here's my equipment.  I won't need it while studying magic.~ */
		IF ~~ THEN DO ~SetGlobal("#L_ImTrainRsp","MYAREA",4) ActionOverride("IMOEN2",GivePartyAllEquipment())~ + IMOEN_LIIA_4a
	END

	IF ~GlobalGT("#L_TalkedToDukes","GLOBAL",1) Global("#L_ImTrainRsp","MYAREA",4)~ THEN IMOEN_LIIA_4a
		SAY @2121 /* ~I can hardly wait to get started!  See ya!~ */
		++ @2105 /* ~Wait Imoen!  You've earned your share of the gold.  Take this.  But spend it wisely, kid!~ */ DO ~SetGlobal("#L_ImTrainRsp","MYAREA",5) StartCutSceneMode() StartCutscene("#L_Cut04")~ EXIT
	END
END

CHAIN
	IF ~GlobalGT("#L_TalkedToDukes","GLOBAL",1) Global("#L_ImTrainRsp","MYAREA",5)~ THEN IMOEN2J IMOEN_LIIA_5
		@2106 /* ~I'm NOT a kid!  Oooo, that's a lot of gold.  I'm a rich kid!~ */
		= @2107 /* ~Goodbye, <CHARNAME>.  Thanks for everything.~ */
		== LIIA @2122 /* ~You'll be staying on the 3rd floor, Imoen.  <CHARNAME> can visit you there whenever she wants.~ */	
		DO  ~SetGlobal("#L_TalkedToDukes","GLOBAL",3) SetGlobal("#L_ImTrainRsp","MYAREA",6) SetGlobal("#L_ImoenInPalace","GLOBAL",1) ActionOverride("IMOEN2",LeaveParty()) ActionOverride("IMOEN2",SetGlobal("KickedOut","LOCALS",2))  ActionOverride("IMOEN2",EscapeArea())~
	END
	++ @2108 /* ~Good luck, Imoen.  I'll come visit!~ */ EXIT
	++ @2109 /* ~Good bye, Imoen.  Good luck.~ */  EXIT
	++ @2126 /* ~See ya, kid.  Try not to burn down the place.~ */ EXIT

 

Instead of the cut scene with a series of if statements, I'd like to have the series of if statements after ++ WAIT IMOEN...

EDIT: like this:

Spoiler

APPEND IMOEN2J
	IF ~GlobalGT("#L_TalkedToDukes","GLOBAL",1) Global("#L_ImTrainRsp","MYAREA",1)~ THEN BEGIN IMOEN_LIIA_1
		SAY @2103 /* ~You will come visit, <CHARNAME>!  Promise!~ */
		= @2104 /* ~Oh!  Here's my equipment.  I won't need it while studying magic.~ */
		IF ~~ THEN DO ~SetGlobal("#L_ImTrainRsp","MYAREA",4) ActionOverride("IMOEN2",GivePartyAllEquipment())~ + IMOEN_LIIA_4a
	END

	IF ~GlobalGT("#L_TalkedToDukes","GLOBAL",1) Global("#L_ImTrainRsp","MYAREA",4)~ THEN IMOEN_LIIA_4a
		SAY @2121 /* ~I can hardly wait to get started!  See ya!~ */
		++ @2105 /* ~Wait Imoen!  You've earned your share of the gold.  Take this.  But spend it wisely, kid!~ */
        IF ~~ DO ~ActionOverride("IMOEN2",TakePartyGold(1500))~ + IMOEN_LIIA_5
        IF ~!PartyGoldLT(4000)~ DO ~ActionOverride("IMOEN2",TakePartyGold(2000))~ + IMOEN_LIIA_5
        IF ~!PartyGoldLT(5000)~ DO ~ActionOverride("IMOEN2",TakePartyGold(2000))~ + IMOEN_LIIA_5
        IF ~!PartyGoldLT(10000)~ DO ~ActionOverride("IMOEN2",TakePartyGold(5000))~ + IMOEN_LIIA_5
        IF ~!PartyGoldLT(20000)~ DO ~ActionOverride("IMOEN2",TakePartyGold(10000))~ + IMOEN_LIIA_5
        IF ~!PartyGoldLT(30000)~ DO ~ActionOverride("IMOEN2",TakePartyGold(1500))~ + IMOEN_LIIA_5
        IF ~!PartyGoldLT(40000)~ DO ~ActionOverride("IMOEN2",TakePartyGold(20000))~ + IMOEN_LIIA_5
        IF ~!PartyGoldLT(50000)~ DO ~ActionOverride("IMOEN2",TakePartyGold(25000))~ + IMOEN_LIIA_5
	END
END

CHAIN
	IF ~GlobalGT("#L_TalkedToDukes","GLOBAL",1) Global("#L_ImTrainRsp","MYAREA",5)~ THEN IMOEN2J IMOEN_LIIA_5
		@2106 /* ~I'm NOT a kid!  Oooo, that's a lot of gold.  I'm a rich kid!~ */
		= @2107 /* ~Goodbye, <CHARNAME>.  Thanks for everything.~ */
		== LIIA @2122 /* ~You'll be staying on the 3rd floor, Imoen.  <CHARNAME> can visit you there whenever she wants.~ */	
		DO  ~SetGlobal("#L_TalkedToDukes","GLOBAL",3) SetGlobal("#L_ImTrainRsp","MYAREA",6) SetGlobal("#L_ImoenInPalace","GLOBAL",1) ActionOverride("IMOEN2",LeaveParty()) ActionOverride("IMOEN2",SetGlobal("KickedOut","LOCALS",2))  ActionOverride("IMOEN2",EscapeArea())~
//		DO  ~SetGlobal("#L_TalkedToDukes","GLOBAL",3) SetGlobal("#L_ImTrainRsp","MYAREA",6) SetGlobal("#L_ImoenInPalace","GLOBAL",1) ActionOverride("IMOEN2",SetLeavePartyDialogueFile()) ActionOverride("IMOEN2",ChangeAIScript("",DEFAULT)) ActionOverride("IMOEN2",LeaveParty()) ActionOverride("IMOEN2",SetGlobal("KickedOut","LOCALS",99)) ActionOverride("IMOEN2",EscapeArea())~
	END
	++ @2108 /* ~Good luck, Imoen.  I'll come visit!~ */ EXIT
	++ @2109 /* ~Good bye, Imoen.  Good luck.~ */  EXIT
	++ @2126 /* ~See ya, kid.  Try not to burn down the place.~ */ EXIT

 

 

Edited by Lauriel
Posted

The END is at the wrong spot. It needs to be after the ++ lines, not before them... or at least there needs to be one after them, I can't say the one before is correct or not... I am not a good dialog coder... so take it as such. jastey will probably be able to help more. Which is why I originally responded with the request for a better help than I can give. :devlook:

Posted

Did you try something like this? (Sorry for rearranging the two first dialogue states, too. It's just an example.)

CHAIN
	IF ~GlobalGT("#L_TalkedToDukes","GLOBAL",1) Global("#L_ImTrainRsp","MYAREA",1)~ THEN IMOEN2 IMOEN_LIIA_1
		@2103 /* ~You will come visit, <CHARNAME>!  Promise!~ */
		= @2104 /* ~Oh!  Here's my equipment.  I won't need it while studying magic.~ */ DO ~ActionOverride("IMOEN2",GivePartyAllEquipment())~ 
		= @2121 /* ~I can hardly wait to get started!  See ya!~ */
	END
		++ @2105 /* ~Wait Imoen!  You've earned your share of the gold.  Take this.  But spend it wisely, kid!~ */ + IMOEN_LIIA_5

APPEND IMOEN2
	IF ~~ THEN IMOEN_LIIA_5
		SAY @2106 /* ~I'm NOT a kid!  Oooo, that's a lot of gold.  I'm a rich kid!~ */
	IF ~~ THEN DO ~[Imoen gets Amount0]~ + IMOEN_LIIA_5_a
	IF ~[Condition1]~ THEN DO ~[Imoen gets Amount1]~ + IMOEN_LIIA_5_a
	IF ~[Condition2]~ THEN DO ~[Imoen gets Amount2]~ + IMOEN_LIIA_5_a
	IF ~[Condition3]~ THEN DO ~[Imoen gets Amount3]~ + IMOEN_LIIA_5_a
	END

END

CHAIN
	IF ~~ THEN IMOEN2 IMOEN_LIIA_5_a
		@2107 /* ~Goodbye, <CHARNAME>.  Thanks for everything.~ */
		== LIIA @2122 /* ~You'll be staying on the 3rd floor, Imoen.  <CHARNAME> can visit you there whenever she wants.~ */	
		DO  ~SetGlobal("#L_TalkedToDukes","GLOBAL",3) SetGlobal("#L_ImTrainRsp","MYAREA",6) SetGlobal("#L_ImoenInPalace","GLOBAL",1) ActionOverride("IMOEN2",LeaveParty()) ActionOverride("IMOEN2",SetGlobal("KickedOut","LOCALS",2))  ActionOverride("IMOEN2",EscapeArea())~
	END
	++ @2108 /* ~Good luck, Imoen.  I'll come visit!~ */ EXIT
	++ @2109 /* ~Good bye, Imoen.  Good luck.~ */  EXIT
	++ @2126 /* ~See ya, kid.  Try not to burn down the place.~ */ EXIT

 

Posted
2 minutes ago, Jarno Mikkola said:

The END is at the wrong spot. It needs to be after the ++ lines, not before them... or at least there needs to be one after them, I can't say the one before is correct or not... I am not a good dialog coder... so take it as such. jastey will probably be able to help more. Which is why I originally responded with the request for a better help than I can give. :devlook:

The END needs to be before the reply options if it's a CHAIN.

Posted
1 minute ago, jastey said:

Did you try something like this?

No, I didn't think to use a chain when there was only 1 NPC speaking.  I'll try that.  Thank you!!

Posted
Just now, Lauriel said:

No, I didn't think to use a chain when there was only 1 NPC speaking.

In this case it's not as thrilling as the line with the DO ~GivePartyAllEquipment()~ doesn't have a different condition so you also could just put it at the end of teh whole dialogue, as well.

The question is whether the IF statements where they are now do what you want them to.

Posted
2 minutes ago, jastey said:

In this case it's not as thrilling as the line with the DO ~GivePartyAllEquipment()~ doesn't have a different condition so you also could just put it at the end of teh whole dialogue, as well.

The question is whether the IF statements where they are now do what you want them to.

I think I was approaching this way too linearly.  Once again, thank you for helping me look for solutions outside the box.  It doesn't HAVE to flow like a normal conversation.  It can be a little out of sequence. I don't particularly LIKE it that way, but I like it better than the cut scene.  I'd really prefer it to flow like a normal conversation.  1) Imoen: I don't need leather armor, 2) action: Imoen gives party her equpment 3) PC: You deserve your share of the gold, 4) action: Imoen takes share of the gold... but I'll take what I can get.

Posted

Hm, you could do something like this. It's just a bit messier, I think. And it doesn't have a "fail safe" option, so you'd need to work with GT/LT to cover all instances.

CHAIN
	IF ~GlobalGT("#L_TalkedToDukes","GLOBAL",1) Global("#L_ImTrainRsp","MYAREA",1)~ THEN IMOEN2 IMOEN_LIIA_1
		@2103 /* ~You will come visit, <CHARNAME>!  Promise!~ */
		= @2104 /* ~Oh!  Here's my equipment.  I won't need it while studying magic.~ */ DO ~ActionOverride("IMOEN2",GivePartyAllEquipment())~ 
		= @2121 /* ~I can hardly wait to get started!  See ya!~ */
	END
		+ ~[Condition0]~ + @2105 /* ~Wait Imoen!  You've earned your share of the gold.  Take this.  But spend it wisely, kid!~ */ DO ~[Imoen takes Amount0]+ IMOEN_LIIA_5
		+ ~[Condition1]~ + @2105 /* ~Wait Imoen!  You've earned your share of the gold.  Take this.  But spend it wisely, kid!~ */ DO ~[Imoen takes Amount1]+ IMOEN_LIIA_5
		+ ~[Condition2]~ + @2105 /* ~Wait Imoen!  You've earned your share of the gold.  Take this.  But spend it wisely, kid!~ */ DO ~[Imoen takes Amount2]+ IMOEN_LIIA_5
		+ ~[Condition3]~ + @2105 /* ~Wait Imoen!  You've earned your share of the gold.  Take this.  But spend it wisely, kid!~ */ DO ~[Imoen takes Amount3]+ IMOEN_LIIA_5
		+ ~[Condition4]~ + @2105 /* ~Wait Imoen!  You've earned your share of the gold.  Take this.  But spend it wisely, kid!~ */ DO ~[Imoen takes Amount4]+ IMOEN_LIIA_5


CHAIN
	IF ~~ THEN IMOEN2 IMOEN_LIIA_5
		@2106 /* ~I'm NOT a kid!  Oooo, that's a lot of gold.  I'm a rich kid!~ */
		= @2107 /* ~Goodbye, <CHARNAME>.  Thanks for everything.~ */
		== LIIA @2122 /* ~You'll be staying on the 3rd floor, Imoen.  <CHARNAME> can visit you there whenever she wants.~ */	
		DO  ~SetGlobal("#L_TalkedToDukes","GLOBAL",3) SetGlobal("#L_ImTrainRsp","MYAREA",6) SetGlobal("#L_ImoenInPalace","GLOBAL",1) ActionOverride("IMOEN2",LeaveParty()) ActionOverride("IMOEN2",SetGlobal("KickedOut","LOCALS",2))  ActionOverride("IMOEN2",EscapeArea())~
	END
	++ @2108 /* ~Good luck, Imoen.  I'll come visit!~ */ EXIT
	++ @2109 /* ~Good bye, Imoen.  Good luck.~ */  EXIT
	++ @2126 /* ~See ya, kid.  Try not to burn down the place.~ */ EXIT

 

Posted
3 minutes ago, jastey said:

Hm, you could do something like this. It's just a bit messier, I think. And it doesn't have a "fail safe" option, so you'd need to work with GT/LT to cover all instances.

OMG, that's friggen PERFECT!  You are a dialogue WIZARD!  Danke shoen!!

Join the conversation

You are posting as a guest. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...