Jump to content

Looking for help from the Dialog Gurus


plainab

Recommended Posts

I'm working on an exploit fix/tweak in regards to Oublek, Prism and the emeralds.

 

Because of hard coded limitations I can not do a proper prevention of the exploit without having two custom emeralds (one for left eye and one for right eye) in play. I therefore need to make changes that will:

1) convert current item checks in Oublek's dialog to check for the custom items

2) add new transitions to the current state that will allow the player to turn in only one custom item if that is all they have at that moment.

 

I have completed #1 with the following .d code:

REPLACE_TRANS_TRIGGER oublek BEGIN 9 END BEGIN 1 END ~PartyHasItem("MISC43")~ ~PartyHasItem("abgfEyeL")
PartyHasItem("abgfEyeR")~
REPLACE_TRANS_TRIGGER oublek BEGIN 9 END BEGIN 4 END ~!PartyHasItem("MISC43")~ ~!PartyHasItem("abgfEyeL")
!PartyHasItem("abgfEyeR")~
REPLACE_TRANS_TRIGGER oublek BEGIN 10 END BEGIN 9 END ~PartyHasItem("MISC43")~ ~PartyHasItem("abgfEyeL")
PartyHasItem("abgfEyeR")~
REPLACE_TRANS_TRIGGER oublek BEGIN 10 END BEGIN 5 END ~!PartyHasItem("MISC43")~ ~!PartyHasItem("abgfEyeL")
!PartyHasItem("abgfEyeR")~

 

#2 is where I'm having problems. There are two states that I need to work with. I can do one, once I've seen how to do the other. Let's look at the first one shall we.

Current unmodified state #9:

IF WEIGHT #4 /* Triggers after states #: 24 even though they appear after this state */
~Global("Greywolf","GLOBAL",0)
~ THEN BEGIN 9 // from:
 SAY #4602 /* ~Ahh, my fine and honest friend.  What can I do for you today?~ */
 IF ~PartyHasItem("MISC65")
~ THEN REPLY #4611 /* ~I've come to turn in a bounty, and collect the reward that is duly mine.~ */ GOTO 8
 IF ~PartyHasItem("MISC43")
~ THEN REPLY #4627 /* ~I've come to turn in a bounty, and collect the reward that is duly mine.~ */ GOTO 4
 IF ~~ THEN REPLY #4626 /* ~What do you do here, exactly?~ */ GOTO 11
 IF ~Global("OublekBounty1","GLOBAL",0)
Global("OublekBounty2","GLOBAL",1)
~ THEN REPLY #4645 /* ~What bounties are currently unclaimed?~ */ GOTO 26
 IF ~!PartyHasItem("MISC65")
!PartyHasItem("MISC43")
~ THEN REPLY #4647 /* ~I've come to turn in a bounty, and collect the reward that is duly mine.~ */ GOTO 15
 IF ~Global("OublekBounty1","GLOBAL",1)
Global("OublekBounty2","GLOBAL",0)
~ THEN REPLY #2007 /* ~What bounties are currently unclaimed?~ */ DO ~~ GOTO 27
 IF ~Global("OublekBounty1","GLOBAL",0)
Global("OublekBounty2","GLOBAL",0)
~ THEN REPLY #8438 /* ~What bounties are currently unclaimed?~ */ DO ~~ GOTO 28
 IF ~Global("OublekBounty1","GLOBAL",1)
Global("OublekBounty2","GLOBAL",1)
~ THEN REPLY #12737 /* ~What bounties are currently unclaimed?~ */ DO ~~ GOTO 29
END

I need to somehow add additional transitions to this state. Each transition will go to new states that give half of the total reward.

 

I believe that I can add the new states by doing:

APPEND oublek
IF ~~ THEN BEGIN abLeftEye
 SAY ~One of the Emeralds! That will be a 150 gold bounty for you.  Be sure to bring the other if you should find it.~//this is custom text
 IF ~~ THEN DO ~AddexperienceParty(100)
GivePartyGold(150)
TakePartyItem("abgfEyeL")
SetGlobal("abgf_LeftEyeBounty","GLOBAL",1)
~ EXIT
END
IF ~~ THEN BEGIN abRightEye
 SAY ~One of the Emeralds! That will be a 150 gold bounty for you.  Be sure to bring the other if you should find it.~//this is custom text
 IF ~~ THEN DO ~AddexperienceParty(100)
GivePartyGold(150)
TakePartyItem("abgfEyeR")
SetGlobal("abgf_RightEyeBounty","GLOBAL",1)
~ EXIT
END
IF ~~ THEN BEGIN abLeftEyeLast
 SAY ~The last of the Emeralds! That will be another 150 gold bounty for you.~//this is custom text
 IF ~~ THEN DO ~AddexperienceParty(100)
GivePartyGold(150)
TakePartyItem("abgfEyeL")
SetGlobal("abgf_LeftEyeBounty","GLOBAL",1)
~ EXIT
END
IF ~~ THEN BEGIN abRightEyeLast
 SAY ~The last of the Emeralds! That will be another 150 gold bounty for you.~//this is custom text
 IF ~~ THEN DO ~AddexperienceParty(100)
GivePartyGold(150)
TakePartyItem("abgfEyeR")
SetGlobal("abgf_RightEyeBounty","GLOBAL",1)
~ EXIT
END
END //end the append

But I am unsure how to add new transitions to an existing state.

 

Am I looking for EXTEND_TOP or EXTEND_BOTTOM? If so, would it look like this?

EXTEND_BOTTOM oublek 9 [2] 
IF ~PartyHasItem("abgfEyeL")
!PartyHasItem("abgfEyeR")
Global("abgf_LeftEyeBounty","GLOBAL",0)
Global("abgf_RightEyeBounty","GLOBAL",0)~ THEN REPLY #4627 /* ~I've come to turn in a bounty, and collect the reward that is duly mine.~ */ GOTO abLeftEye
IF ~!PartyHasItem("abgfEyeL")
PartyHasItem("abgfEyeR")
Global("abgf_LeftEyeBounty","GLOBAL",0)
Global("abgf_RightEyeBounty","GLOBAL",0)~ THEN REPLY #4627 /* ~I've come to turn in a bounty, and collect the reward that is duly mine.~ */ GOTO abRightEye
IF ~PartyHasItem("abgfEyeL")
!PartyHasItem("abgfEyeR")
Global("abgf_RightEyeBounty","GLOBAL",1)~ THEN REPLY #4627 /* ~I've come to turn in a bounty, and collect the reward that is duly mine.~ */ GOTO abLeftEyeLast
IF ~!PartyHasItem("abgfEyeL")
PartyHasItem("abgfEyeR")
Global("abgf_LeftEyeBounty","GLOBAL",1)~ THEN REPLY #4627 /* ~I've come to turn in a bounty, and collect the reward that is duly mine.~ */ GOTO abRightEyeLast
END //end the extend bottom

Or should I be doing something else all together different?

 

And if anyone is curious, I'll have a script block in the area script that once abgf_LeftEyeBounty and abgf_RightEyeBounty both reach 1 will set OublekBounty2 to 1 and add the correct journal entry...

Link to comment

Well you have some options - the traditional one is to skip out on the whole thing by False()-ing the whole thing and adding on a new state that fires in place. But you have most of the better way already coded there - just add your new replies using EXTEND_BOTTOM. EXTEND_BOTTOM will add new reply states and related transitions to the bottom of the stack (evaluated first), so if you are editing out the original items and adding new labled ones in, something like this:

EXTEND_BOTTOM ~%tutu_var%THALAN~ 32
IF ~InParty("minsc") InMyArea("minsc") !StateCheck("minsc",CD_STATE_NOTVALID)~ THEN SOLVED_JOURNAL @41
EXTERN ~%MINSC_JOINED%~ X#MinscThalanChain
END

will add a conditioned reply sate that will be evaluated before other states.

 

You could also look at a more flexible way of coding it, using what CamDawg and the bigg cooked up for the BG2 Fixpack-

 

ALTER_TRANS.

 

Here are examples - changing a transition without messing with anything else,

 

/* Amarande Remove Escape Area*/
ALTER_TRANS ~%tutu_var%AMARAN~
BEGIN 3 5 END
BEGIN 0 END
BEGIN
"ACTION" ~SetGlobal("X#RemovedEscape","GLOBAL",1)~
END

I think this is just another way of doing that R_T_T, but what sets it apart is that you can alter all sorts of things with it -

 

More complicated, in Coran's Quest, we wanted to change what Brielbara said and set up a new set of possibilities. In the first block, we were able to do it without messing with the flow, allowing others to still use the state as intended - the minor word modifications did not change the overall gist of what was being said:

/* REPLACEMENTS */

REPLACE_SAY ~%CORAN_JOINED%~ %BGTCORANJState4% @0

REPLACE_SAY ~%tutu_var%BRIELB~ 14 @1
ALTER_TRANS ~%tutu_var%BRIELB~ BEGIN 14 END BEGIN 0 END BEGIN ACTION ~SetGlobal("P#Briel_Stay","GLOBAL",1) RealSetGlobalTimer("X#BriLostPatience","GLOBAL",1800)~ END

but in the next one we had to blow away the state and replace it with a new one (a bad idea, but sometimes unavoidable)

/* RETAINED - can't see another way to code it without a messy E_B-fest*/
REPLACE ~%tutu_var%BRIELB~
IF ~Global("HelpBrielbara","GLOBAL",1)~ THEN BEGIN 16 // from:
SAY @2
IF ~Global("P#CoranBaby","GLOBAL",2) Global("P#Briel_Stay","GLOBAL",1) InParty("coran")~ THEN DO ~SetGlobal("X#BriFinale","GLOBAL",1)~ GOTO returnBriel
IF ~GlobalLT("P#CoranBaby","GLOBAL",2) Global("P#Briel_Stay","GLOBAL",1) InParty("coran")~ THEN DO ~SetGlobal("X#BriFinale","GLOBAL",1)~ GOTO NamaraCor
IF ~Global("P#Briel_Stay","GLOBAL",2) InParty("coran")~ THEN DO ~SetGlobal("X#BriFinale","GLOBAL",1)~ GOTO BrielCurse
IF ~Global("P#Briel_Stay","GLOBAL",3)~ THEN DO ~SetGlobal("X#BriFinale","GLOBAL",1)~ GOTO CoranStay
IF ~Global("P#Briel_Stay","GLOBAL",1) !InParty("coran")~ THEN DO ~SetGlobal("X#BriFinale","GLOBAL",1)~ EXIT
IF ~!Global("P#Briel_Stay","GLOBAL",1) !InParty("coran")~ THEN DO ~SetGlobal("X#BriFinale","GLOBAL",1)~ EXIT
IF ~GlobalGT("P#Briel_Stay","GLOBAL",1)~ THEN DO ~SetGlobal("X#BriFinale","GLOBAL",1)~ EXIT
END
END

 

There are lots of examples more in the BG2 fixpack, which it was coded for...

 

// corrects invalid transition to mazzy25a
ALTER_TRANS SARCNT01 BEGIN 14 END BEGIN 1 END // filename, state, trans
BEGIN // list of changes, see below for flags
 EPILOGUE ~EXTERN MAZZY25J 9~
END

// same state, should check for knight anomen
ALTER_TRANS SARCNT01 BEGIN 14 END BEGIN 6 END // filename, state, trans
BEGIN // list of changes, see below for flags
 TRIGGER ~IsValidForPartyDialog("Anomen") Alignment("Anomen",MASK_GOOD)~
END

 

and there are many things that it can tackle. It looks like (from the usage) you might not be able to stack up flags, but we would have to test - not many folks use this particular command.

 

The usage tutorial by CamDawg. The thing covers the following changes:

* TRIGGER: The trigger condition for the transition. i.e "TRIGGER" ~Global("foo","GLOBAL",0)~

* ACTION: The action performed if the transition is selected. i.e. "ACTION" ~SetGlobal("foo","GLOBAL",1)~

* REPLY: The player’s reply, if any. i.e. "REPLY" ~#57922~

* JOURNAL: Can add or change the journal entry. i.e. "JOURNAL" ~@100~

* SOLVED_JOURNAL: Same as JOURNAL, except for entries into the solved section of the journal.

* UNSOLVED_JOURNAL: Same as JOURNAL, except for entries into the unsolved section of the journal.

* EPILOGUE: Specifies where the transition leads to (GOTO, EXTERN, or EXIT) i.e. EPILOGUE" ~EXTERN BVICONI 0~

* FLAGS: Used to set transition flags manually, though I can’t imagine why one would do this.

and means you can patch the original state to look like your new one without messing about too much. Then you an always add more possibilities using EXTEND_BOTTOM.

Link to comment

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...